Browse Source

#2225

update
tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
24afb0065c
3 changed files with 12 additions and 2 deletions
  1. +2
    -0
      modules/context/point.go
  2. +1
    -1
      routers/reward/point/point.go
  3. +9
    -1
      services/reward/notify.go

+ 2
- 0
modules/context/point.go View File

@@ -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()
} }
} }

+ 1
- 1
routers/reward/point/point.go View File

@@ -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
} }


+ 9
- 1
services/reward/notify.go View File

@@ -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,


Loading…
Cancel
Save