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

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

+ 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) {
req.RewardType = models.RewardTypePoint
if req.OperateType.Name() == "" {
if req.OperateType.Name() == "" || req.Remark == "" {
ctx.JSON(http.StatusOK, "param error")
return
}


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

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


Loading…
Cancel
Save