|
@@ -77,49 +77,6 @@ func (this *MyReportController) List() {
|
|
|
br.Ret = 200
|
|
|
}
|
|
|
|
|
|
-// @Title IsCollect
|
|
|
-// @Description create users
|
|
|
-// @Param request body request.ReportRecordReq true "type json string"
|
|
|
-// @Success 200 {object} models.BaseResponse
|
|
|
-// @Failure 403 {object} models.BaseResponse
|
|
|
-// @router /isCollect [post]
|
|
|
-func (this *MyReportController) IsCollect() {
|
|
|
- br := new(models.BaseResponse).Init()
|
|
|
- defer func() {
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
- }()
|
|
|
-
|
|
|
- var req request.MyReportCollectReq
|
|
|
- if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
|
|
|
- br.Msg = "参数解析失败"
|
|
|
- br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- user := this.User
|
|
|
- if user.Status != 2 {
|
|
|
- br.Msg = "用户没有权限收藏"
|
|
|
- return
|
|
|
- }
|
|
|
- count, err := models.GetMyReportByUserIdAndReportId(user.UserId, req.ReportId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "查询收藏数量失败"
|
|
|
- br.ErrMsg = "查询收藏数量失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- resp := new(response.MyReportIsCollectResp)
|
|
|
- if count > 0 {
|
|
|
- resp.IsCollect = true
|
|
|
- } else {
|
|
|
- resp.IsCollect = false
|
|
|
- }
|
|
|
- br.Data = resp
|
|
|
- br.Msg = "查询成功"
|
|
|
- br.Success = true
|
|
|
- br.Ret = 200
|
|
|
-}
|
|
|
-
|
|
|
// @Title 收藏研报
|
|
|
// @Description 收藏研报
|
|
|
// @Success 200 {object} models.BaseResponse
|