package com.zcloud.modules.api.controller;

import com.alibaba.fastjson.JSONObject;
import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.modules.api.service.ApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@Api(tags = "api")
@RestController
@RequestMapping("api")
public class ApiController {

    @Resource
    private ApiService apiService;

    @ApiOperation("API-课程列表")
    @SysLog("API-课程列表")
    @PostMapping("/curriculumList")
    public R curriculumList(@RequestBody Map<String, Object> params) {
        PageUtils page = apiService.curriculumList(params);
        return R.ok().put("page", page);
    }

    @ApiOperation("API-课程详情")
    @SysLog("API-课程详情")
    @PostMapping("/curriculumInfo")
    public R curriculumInfo(@RequestBody Map<String, Object> params) {
        JSONObject data = apiService.curriculumInfo(params);
        return R.ok().put("data", data);
    }

}
