list_by mid
This commit is contained in:
parent
9f62b24fff
commit
2634ad7c17
|
@ -99,9 +99,6 @@ func (s *Service) ApiLoginByPswd(ctx *gin.Context, req *loginproto.ApiLoginByPsw
|
|||
accountVO = &accountproto.ApiListVO{}
|
||||
accountVO.CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
accountVO.CopyWallet(wallet)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -174,10 +171,6 @@ func (s *Service) ApiLoginByVeriCode(ctx *gin.Context, req *loginproto.ApiLoginB
|
|||
isEnabled = util.DerefInt64(login.IsEnabled)
|
||||
accountVO = &accountproto.ApiListVO{}
|
||||
accountVO.CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
accountVO.CopyWallet(wallet)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -401,9 +394,6 @@ func (s *Service) ApiGetAccountListByMids(ctx *gin.Context, req *accountproto.Ap
|
|||
for i, account := range list {
|
||||
volist[i] = &accountproto.ApiListVO{}
|
||||
volist[i].CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
volist[i].CopyWallet(wallet)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -422,9 +412,6 @@ func (s *Service) ApiGetAccountListByUserId(ctx *gin.Context, req *accountproto.
|
|||
vo = &accountproto.ApiListVO{}
|
||||
vo.CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
vo.CopyWallet(wallet)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -447,9 +434,6 @@ func (s *Service) ApiGetAccountListFuzzilyByUserId(ctx *gin.Context, req *accoun
|
|||
for i, account := range list {
|
||||
volist[i] = &accountproto.ApiListVO{}
|
||||
volist[i].CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
volist[i].CopyWallet(wallet)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -473,9 +457,6 @@ func (s *Service) ApiGetAccountListFuzzilyByName(ctx *gin.Context, req *accountp
|
|||
for i, account := range list {
|
||||
volist[i] = &accountproto.ApiListVO{}
|
||||
volist[i].CopyAccount(account)
|
||||
|
||||
wallet, _ := _DefaultVas.CheckWalletExist(ctx, util.DerefInt64(account.Mid))
|
||||
volist[i].CopyWallet(wallet)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -656,6 +656,11 @@ func (v *Vas) OneStepUnlockContact(ctx *gin.Context, req *vasproto.OneStepUnlock
|
|||
return
|
||||
}
|
||||
|
||||
v.CheckWalletExist(ctx, common.OfficialMid)
|
||||
if req.InviterMid > 0 {
|
||||
v.CheckWalletExist(ctx, req.InviterMid)
|
||||
}
|
||||
|
||||
// 是否已经解锁过
|
||||
unlockInfo, _ := v.store.GetUserVasUnlock(ctx, nil, mid, uid, contactProductId)
|
||||
if unlockInfo != nil {
|
||||
|
@ -830,16 +835,34 @@ func (v *Vas) OneStepUnlockContact(ctx *gin.Context, req *vasproto.OneStepUnlock
|
|||
}
|
||||
|
||||
// 给主播加钻石
|
||||
//var (
|
||||
// TotalDias = coinPrice
|
||||
// StreamerDias = int64(float64(coinPrice) * 0.8)
|
||||
// InviterDias = int64(0)
|
||||
// OfficialDias = int64(0)
|
||||
//)
|
||||
//if {
|
||||
//
|
||||
//}
|
||||
//v.store.IncDiamonds(ctx, tx, req.Uid)
|
||||
var (
|
||||
TotalDias = coinPrice
|
||||
StreamerDias = int64(float64(TotalDias) * 0.8)
|
||||
InviterDias = int64(0)
|
||||
OfficialDias = int64(0)
|
||||
)
|
||||
if req.InviterMid > 0 {
|
||||
InviterDias = int64(float64(TotalDias) * 0.05)
|
||||
}
|
||||
OfficialDias = TotalDias - StreamerDias - InviterDias
|
||||
|
||||
err = v.store.IncDiamonds(ctx, tx, req.Uid, StreamerDias)
|
||||
if err != nil {
|
||||
logger.Error("IncDiamonds fail, streamer, mid: %v, dias: %v, err: %v", req.Uid, StreamerDias, err)
|
||||
return
|
||||
}
|
||||
err = v.store.IncDiamonds(ctx, tx, common.OfficialMid, OfficialDias)
|
||||
if err != nil {
|
||||
logger.Error("IncDiamonds fail, official, mid: %v, dias: %v, err: %v", common.OfficialMid, OfficialDias, err)
|
||||
return
|
||||
}
|
||||
if InviterDias > 0 {
|
||||
err = v.store.IncDiamonds(ctx, tx, req.InviterMid, InviterDias)
|
||||
if err != nil {
|
||||
logger.Error("IncDiamonds fail, inviter, mid: %v, dias: %v, err: %v", req.InviterMid, InviterDias, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ import (
|
|||
|
||||
// 一键解锁
|
||||
func (s *Service) OneStepUnlockContact(ctx *gin.Context, req *vasproto.OneStepUnlockContactReq) (data *vasproto.OneStepUnlockContactData, ec errcode.ErrCode) {
|
||||
// 获取邀请人mid
|
||||
|
||||
lockType, orderId, contact, err := _DefaultVas.OneStepUnlockContact(ctx, req)
|
||||
ec, err = errs.DealVasErr(err)
|
||||
if err != nil {
|
||||
|
@ -222,6 +224,9 @@ func (s *Service) chListCost(ctx *gin.Context, chList []*dbstruct.ConsumeHistory
|
|||
case dbstruct.CHSTypeCostContact:
|
||||
item.Desc = fmt.Sprintf("购买\"%s\"微信", util.DerefString(acnt.Name))
|
||||
item.Change = changeMark + fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
if chDB.GetChange() < 0 {
|
||||
item.Change = fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
}
|
||||
case dbstruct.CHSTypeCostRefund:
|
||||
item.Desc = fmt.Sprintf("购买\"%s\"微信退款", util.DerefString(acnt.Name))
|
||||
item.Change = changeMark + fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
|
@ -247,7 +252,7 @@ func (s *Service) chListCharge(ctx *gin.Context, chList []*dbstruct.ConsumeHisto
|
|||
item.Desc = "充值"
|
||||
item.Change = changeMark + fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
case dbstruct.CHSTypeChargeOp:
|
||||
item.Desc = "后台充值"
|
||||
item.Desc = "运营充值"
|
||||
item.Change = changeMark + fmt.Sprintf("%d金币", chDB.GetChange())
|
||||
case dbstruct.CHSTypeChargeRefund:
|
||||
item.Desc = "退款"
|
||||
|
|
|
@ -7,5 +7,5 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
OfficialMid = 10
|
||||
OfficialMid = -1
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue