package com.xhkjedu.slive.controller.liveplay;

import com.xhkjedu.slive.model.liveplay.LCourseSectionAskteacher;
import com.xhkjedu.slive.service.liveplay.CSAskTeacherService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ywx
 * @classname CSAskTeacherController
 * @description 
 * @date 2021/6/16 10:38
 **/
@RestController
@RequestMapping("/csateacher")
public class CSAskTeacherController {
    @Resource
    private CSAskTeacherService csAskTeacherService;

    @PostMapping("/add")
    public ResultVo add(@RequestBody LCourseSectionAskteacher ask) {
        csAskTeacherService.save(ask);
        return new ResultVo(0, "保存成功");
    }

    @PostMapping("/set_answer")
    public ResultVo setAnswer(@RequestBody LCourseSectionAskteacher ask) {
        N_Utils.validation(new Object[]{ask.getSatid(),"课节互动id",1,ask.getRa(),"答案",2});
        csAskTeacherService.setAnswer(ask);
        return new ResultVo(0,"设置答案成功");
    }
}
