Initial commit

This commit is contained in:
2026-05-20 16:13:58 +08:00
commit ceffbe382e
500 changed files with 157469 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
package consumer
import (
"context"
"stat/common/log"
"stat/common/utils"
"stat/models/rechargechannelmod"
"stat/models/rechargemod"
"strconv"
)
func RechargeChannelHandle(ctx context.Context, rechageInfo *rechargemod.RechargeMod) error {
sumDate := utils.BeginWithTime(rechageInfo.SuccessAt)
rate := float64(4)
if rechageInfo.Rate != "" && rechageInfo.ChannelName != "daichong" {
rateF, err := strconv.ParseFloat(rechageInfo.Rate, 64)
if err != nil {
log.Error("RechargeChannelHandle rate is err", log.Any("rate", rechageInfo.Rate), log.Any("userid", rechageInfo.UserId), log.Any("appid", rechageInfo.AppId))
return err
}
rate = rateF
} else if rechageInfo.ChannelName == "daichong" {
rate = float64(8)
rechageInfo.CID = "daichong"
}
channelMoney := int64((rate * float64(rechageInfo.PayMoney)) / 100)
err := rechargechannelmod.UpsertOneUserRechargeStat(ctx, rechageInfo.CID, rechageInfo.AppId, sumDate, rechageInfo.BlocDeduction, rechageInfo.Money, rechageInfo.PayMoney, channelMoney)
if err != nil {
log.Error("RechargeChannelHandle UpsertOneUserRechargeStat", log.Any("rate", rechageInfo.Rate), log.Any("userid", rechageInfo.UserId), log.Any("appid", rechageInfo.AppId), log.E(err))
}
return err
}