123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- 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"
- )
- 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)
- }
- 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)
- }
|