🐛 修复分成金额错误计算bug

This commit is contained in:
2025-09-17 12:08:45 +08:00
parent 7f066800a8
commit 914513b5da
2 changed files with 27 additions and 8 deletions

View File

@@ -219,7 +219,7 @@ func NotifyHandle(ctx *gin.Context) error {
return err
}
// 计算分成金额
amount := float64(order.Price) * float64(teacher.ExpectRate) / 100.0
amount := float64(order.Price/100) * float64(teacher.ExpectRate) / 100.0
teacher.Balance = teacher.Balance + amount
err = global.GVA_DB.Save(&teacher).Error
if err != nil {
@@ -256,6 +256,15 @@ func NotifyHandle(ctx *gin.Context) error {
// 如果没有会员时间,则从当前时间开始计算
userInfo.VipExpireTime = time.Now().AddDate(0, 0, int(vipInfo.Expiration)).Format("2006-01-02")
}
if vipInfo.Level == 1 {
userInfo.UserLabel = 2 // SVIP
}
if vipInfo.Level == 2 {
userInfo.UserLabel = 3 // SVIP
}
err = global.GVA_DB.Save(&userInfo).Error
if err != nil {
global.GVA_LOG.Error("更新用户会员状态失败", zap.Error(err))
@@ -287,7 +296,7 @@ func NotifyHandle(ctx *gin.Context) error {
return err
}
// 计算分成金额
amount := float64(order.Price) * float64(teacher.ExpectRate) / 100.0
amount := float64(order.Price/100) * float64(teacher.ExpectRate) / 100.0
teacher.Balance = teacher.Balance + amount
err = global.GVA_DB.Save(&teacher).Error
if err != nil {