package activity import ( "github.com/gin-gonic/gin" "hongze/hongze_yb/controller/response" activity2 "hongze/hongze_yb/models/request/activity" "hongze/hongze_yb/services/activity" "hongze/hongze_yb/services/user" ) // AddRemind 添加提醒 // @Tags 活动模块 // @Summary 添加提醒 // @Description 添加提醒 // @Security ApiKeyAuth // @Param Authorization header string true "Bearer 31a165baebe6dec616b1f8f3207b4273" // @Accept json // @Product json // @Param activity_id query int true "活动ID" // @Success 200 {string} string "操作成功" // @failure 400 {string} string "操作失败" // @failure 4001 {object} activity.RemindCheckInfo "指定错误" // @Router /activity/addRemind [post] func AddRemind(c *gin.Context) { var req activity2.RemindReq if c.ShouldBind(&req) != nil { response.Fail("参数异常", c) return } userInfo := user.GetInfoByClaims(c) ok, permissionCheckInfo, err := activity.CheckActivityPermission(userInfo, req.ActivityID) if !ok { response.AuthError(permissionCheckInfo, "暂无权限", c) return } err, remindCheck := activity.CreateRemind(req.ActivityID, userInfo) if err != nil { if remindCheck.Specific == 1 { response.SpecificFail(remindCheck, remindCheck.Msg, c) } else { response.Fail(err.Error(), c) } return } response.OkData("操作成功", "", c) } // CancelRemind 取消提醒 // @Tags 活动模块 // @Summary 取消提醒 // @Description 取消提醒 // @Security ApiKeyAuth // @Param Authorization header string true "Bearer 31a165baebe6dec616b1f8f3207b4273" // @Accept json // @Product json // @Param activity_id query int true "活动ID" // @Success 200 {string} string "操作成功" // @failure 400 {string} string "操作失败" // @Router /activity/cancelRemind [post] func CancelRemind(c *gin.Context) { var req activity2.RemindReq if c.ShouldBind(&req) != nil { response.Fail("参数异常", c) return } userInfo := user.GetInfoByClaims(c) ok, permissionCheckInfo, err := activity.CheckActivityPermission(userInfo, req.ActivityID) if !ok { response.AuthError(permissionCheckInfo, "暂无权限", c) return } err = activity.CancelRemind(req.ActivityID, userInfo) if err != nil { response.Fail(err.Error(), c) return } response.OkData("操作成功", "", c) }