diff --git a/modules/context/point.go b/modules/context/point.go index 9fbff61be..8fd4724ee 100644 --- a/modules/context/point.go +++ b/modules/context/point.go @@ -1,6 +1,7 @@ package context import ( + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/reward/point/account" "gitea.com/macaron/macaron" ) @@ -14,6 +15,7 @@ func PointAccount() macaron.Handler { return } ctx.Data["PointAccount"] = a + ctx.Data["CloudBrainPaySwitch"] = setting.CloudBrainPaySwitch ctx.Next() } } diff --git a/routers/reward/point/point.go b/routers/reward/point/point.go index a8ae00ce4..7b3e0fe49 100644 --- a/routers/reward/point/point.go +++ b/routers/reward/point/point.go @@ -71,7 +71,7 @@ func GetPointRecordList(ctx *context.Context) { func OperatePointAccountBalance(ctx *context.Context, req models.AdminRewardOperateReq) { req.RewardType = models.RewardTypePoint - if req.OperateType.Name() == "" { + if req.OperateType.Name() == "" || req.Remark == "" { ctx.JSON(http.StatusOK, "param error") return } diff --git a/services/reward/notify.go b/services/reward/notify.go index 875dde199..4f3190d67 100644 --- a/services/reward/notify.go +++ b/services/reward/notify.go @@ -11,7 +11,15 @@ import ( "time" ) -func NotifyRewardOperation(userId, amount int64, rewardType models.RewardType, operateType models.RewardOperateType) { +func NotifyRewardOperation(userId, amount int64, sourceType models.SourceType, rewardType models.RewardType, operateType models.RewardOperateType) { + switch sourceType { + case models.SourceTypeRunCloudbrainTask: + return + case models.SourceTypeAdminOperate: + if operateType == models.OperateTypeDecrease { + return + } + } data := &models.UserRewardOperationRedis{ UserId: userId, Amount: amount,