|
@ -4,16 +4,17 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.service.course.CourseService;
|
|
|
import com.yihu.jw.entity.care.course.CourseDO;
|
|
|
import com.yihu.jw.restmodel.ResponseContant;
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
import com.yihu.jw.util.tencent.TencentVODUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
@ -31,6 +32,10 @@ public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
@Autowired
|
|
|
private CourseService courseService;
|
|
|
@Value("${tencent.secretId}")
|
|
|
private String secretId;
|
|
|
@Value("${tencent.secretKey}")
|
|
|
private String secretKey;
|
|
|
|
|
|
@GetMapping(value = "myCourseList")
|
|
|
@ApiOperation(value = "我的课程列表")
|
|
@ -52,4 +57,42 @@ public class DoctorCourseEndpoint extends EnvelopRestEndpoint {
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "courseDetail")
|
|
|
@ApiOperation(value = "课程详情")
|
|
|
public ObjEnvelop courseDetail(
|
|
|
@ApiParam(name = "id", value = "id") @RequestParam(value = "id", required = true) String id) {
|
|
|
try{
|
|
|
JSONObject result = courseService.courseDetail(id);
|
|
|
return ObjEnvelop.getSuccess("查询成功",result);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return ObjEnvelop.getError("查询失败");
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "addCourse")
|
|
|
@ApiOperation(value = "新增课程")
|
|
|
public ObjEnvelop addCourse(
|
|
|
@ApiParam(name = "doctorId", value = "doctorId") @RequestParam(value = "doctorId", required = true) String doctorId,
|
|
|
@ApiParam(name = "jsonData", value = "jsonData") @RequestParam(value = "jsonData", required = true) String jsonData) {
|
|
|
try{
|
|
|
JSONObject result = courseService.addCourse(doctorId, jsonData);
|
|
|
if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
|
|
|
return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
|
|
|
}
|
|
|
return ObjEnvelop.getSuccess("新增成功",result);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return ObjEnvelop.getError("新增失败");
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "getTXUploadSignature")
|
|
|
@ApiOperation(value = "获取腾讯视频上传签名")
|
|
|
public Envelop getTXUploadSignature() throws Exception {
|
|
|
TencentVODUtil tencentVODUtil = new TencentVODUtil();
|
|
|
tencentVODUtil.setSecretId(secretId);
|
|
|
tencentVODUtil.setSecretKey(secretKey);
|
|
|
return success(tencentVODUtil.getUploadSignature());
|
|
|
}
|
|
|
}
|