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