🐛 修复分成金额错误计算bug
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user