Browse Source

update

master
dengbiao 5 months ago
parent
commit
2c2f19941e
1 changed files with 17 additions and 16 deletions
  1. +17
    -16
      rule/user_amount.go

+ 17
- 16
rule/user_amount.go View File

@@ -55,26 +55,27 @@ func DealUserCoin(session *xorm.Session, req md.DealUserCoinReq) (err error) {
} else if req.Kind == "sub" { } else if req.Kind == "sub" {
userVirtualCoinFlow.Direction = 2 userVirtualCoinFlow.Direction = 2
userVirtualCoinFlow.AfterAmout = coinAmountValue.Sub(amountValue).RoundFloor(4).String() userVirtualCoinFlow.AfterAmout = coinAmountValue.Sub(amountValue).RoundFloor(4).String()
if zhios_order_relate_utils.StrToFloat64(userVirtualCoinFlow.AfterAmout) < 0 {
var coin model.VirtualCoin
_, err = session.Where("id = ?", req.CoinId).Get(&coin)
if err != nil {
return err
}
zhios_order_relate_utils.FilePutContents("virtual_coin_not", zhios_order_relate_utils.SerializeStr(map[string]interface{}{
"uid": userVirtualCoinFlow.Uid,
"amount": userVirtualCoinFlow.Amout,
"before_amount": userVirtualCoinFlow.BeforeAmout,
"after_amount": userVirtualCoinFlow.AfterAmout,
"coin_id": userVirtualCoinFlow.CoinId,
}))
return errors.New("用户" + zhios_order_relate_utils.IntToStr(userVirtualCoinFlow.Uid) + "的" + coin.Name + "不足")
//userVirtualCoinFlow.AfterAmout = "0"
}
} else { } else {
err = errors.New("错误的kind类型") err = errors.New("错误的kind类型")
return err return err
} }
if zhios_order_relate_utils.StrToFloat64(userVirtualCoinFlow.AfterAmout) < 0 {
var coin model.VirtualCoin
_, err = session.Where("id = ?", req.CoinId).Get(&coin)
if err != nil {
return err
}
zhios_order_relate_utils.FilePutContents("virtual_coin_not", zhios_order_relate_utils.SerializeStr(map[string]interface{}{
"uid": userVirtualCoinFlow.Uid,
"amount": userVirtualCoinFlow.Amout,
"before_amount": userVirtualCoinFlow.BeforeAmout,
"after_amount": userVirtualCoinFlow.AfterAmout,
"coin_id": userVirtualCoinFlow.CoinId,
}))
return errors.New("用户" + zhios_order_relate_utils.IntToStr(userVirtualCoinFlow.Uid) + "的" + coin.Name + "不足")
//userVirtualCoinFlow.AfterAmout = "0"
}

//3、插入 `user_virtual_coin_flow` 记录 //3、插入 `user_virtual_coin_flow` 记录
_, err = db.UserVirtualCoinFlowInsert(session, &userVirtualCoinFlow) _, err = db.UserVirtualCoinFlowInsert(session, &userVirtualCoinFlow)
if err != nil { if err != nil {


Loading…
Cancel
Save