fix streamer id
This commit is contained in:
parent
371cf04c5f
commit
7b4954bbf8
|
@ -2580,29 +2580,29 @@ func (v *Vas) refundMembership(ctx *gin.Context, order *dbstruct.Order, req *vas
|
||||||
// 有分成的情况
|
// 有分成的情况
|
||||||
if len(incomeChList) > 0 {
|
if len(incomeChList) > 0 {
|
||||||
ch := incomeChList[0]
|
ch := incomeChList[0]
|
||||||
uid := ch.GetUid()
|
streamerMid := ch.GetMid()
|
||||||
if uid <= 0 {
|
if streamerMid <= 0 {
|
||||||
err = errors.New("收入uid错误")
|
err = errors.New("收入streamerMid错误")
|
||||||
logger.Error("invalid uid: %v", uid)
|
logger.Error("invalid streamerMid: %v", streamerMid)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主播钱包
|
// 主播钱包
|
||||||
wallet, err := v.store.GetWalletForUpdate(ctx, tx, uid)
|
wallet, err := v.store.GetWalletForUpdate(ctx, tx, streamerMid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 扣主播金币
|
// 扣主播金币
|
||||||
change := ch.GetChange()
|
change := ch.GetChange()
|
||||||
err = v.store.DecDiamonds(ctx, tx, uid, change)
|
err = v.store.DecDiamonds(ctx, tx, streamerMid, change)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 扣金币的收入记录
|
// 扣金币的收入记录
|
||||||
chNew := &dbstruct.ConsumeHistory{
|
chNew := &dbstruct.ConsumeHistory{
|
||||||
Mid: goproto.Int64(uid),
|
Mid: goproto.Int64(streamerMid),
|
||||||
Uid: goproto.Int64(ch.GetMid()),
|
Uid: goproto.Int64(ch.GetMid()),
|
||||||
Did: goproto.String(ch.GetDid()),
|
Did: goproto.String(ch.GetDid()),
|
||||||
Type: goproto.Int32(dbstruct.CHTypeIncome),
|
Type: goproto.Int32(dbstruct.CHTypeIncome),
|
||||||
|
@ -2623,15 +2623,15 @@ func (v *Vas) refundMembership(ctx *gin.Context, order *dbstruct.Order, req *vas
|
||||||
// 如果已结算,扣提现钻石
|
// 如果已结算,扣提现钻石
|
||||||
if isFinish {
|
if isFinish {
|
||||||
// 扣提现钻石
|
// 扣提现钻石
|
||||||
err = v.store.DecWithdrawDiamonds(ctx, tx, uid, change)
|
err = v.store.DecWithdrawDiamonds(ctx, tx, streamerMid, change)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("DecWithdrawDiamonds fail, uid: %v, change: %v, err: %v", uid, change, err)
|
logger.Error("DecWithdrawDiamonds fail, streamerMid: %v, change: %v, err: %v", streamerMid, change, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提现钻石记录
|
// 提现钻石记录
|
||||||
wh := &dbstruct.WithdrawDiamondsHis{
|
wh := &dbstruct.WithdrawDiamondsHis{
|
||||||
Mid: goproto.Int64(uid),
|
Mid: goproto.Int64(streamerMid),
|
||||||
IncomeChId: goproto.Int64(ch.GetId()),
|
IncomeChId: goproto.Int64(ch.GetId()),
|
||||||
OrderId: goproto.String(ch.GetOrderId()),
|
OrderId: goproto.String(ch.GetOrderId()),
|
||||||
Ct: goproto.Int64(time.Now().Unix()),
|
Ct: goproto.Int64(time.Now().Unix()),
|
||||||
|
|
Loading…
Reference in New Issue