| @@ -1,6 +1,7 @@ | |||||
| package context | package context | ||||
| import ( | import ( | ||||
| "code.gitea.io/gitea/modules/setting" | |||||
| "code.gitea.io/gitea/services/reward/point/account" | "code.gitea.io/gitea/services/reward/point/account" | ||||
| "gitea.com/macaron/macaron" | "gitea.com/macaron/macaron" | ||||
| ) | ) | ||||
| @@ -14,6 +15,7 @@ func PointAccount() macaron.Handler { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Data["PointAccount"] = a | ctx.Data["PointAccount"] = a | ||||
| ctx.Data["CloudBrainPaySwitch"] = setting.CloudBrainPaySwitch | |||||
| ctx.Next() | ctx.Next() | ||||
| } | } | ||||
| } | } | ||||
| @@ -71,7 +71,7 @@ func GetPointRecordList(ctx *context.Context) { | |||||
| func OperatePointAccountBalance(ctx *context.Context, req models.AdminRewardOperateReq) { | func OperatePointAccountBalance(ctx *context.Context, req models.AdminRewardOperateReq) { | ||||
| req.RewardType = models.RewardTypePoint | req.RewardType = models.RewardTypePoint | ||||
| if req.OperateType.Name() == "" { | |||||
| if req.OperateType.Name() == "" || req.Remark == "" { | |||||
| ctx.JSON(http.StatusOK, "param error") | ctx.JSON(http.StatusOK, "param error") | ||||
| return | return | ||||
| } | } | ||||
| @@ -11,7 +11,15 @@ import ( | |||||
| "time" | "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{ | data := &models.UserRewardOperationRedis{ | ||||
| UserId: userId, | UserId: userId, | ||||
| Amount: amount, | Amount: amount, | ||||