Merge branch 'dev-lwl/add_withdraw_log' into test
This commit is contained in:
commit
8a13ba05de
|
@ -87,6 +87,7 @@ const (
|
|||
COLZoneMomentPrice = "zone_moment_price"
|
||||
COLZoneMomentStat = "zone_moment_stat"
|
||||
COLUserIncome = "user_income"
|
||||
COLWithdrawHis = "withdraw_his"
|
||||
|
||||
DBCatalog = "catalog"
|
||||
COLCatalog = "catalog"
|
||||
|
@ -277,6 +278,11 @@ func (m *Mongo) getColOplogCoinOrder(orderId string) *qmgo.Collection {
|
|||
return m.clientMix.Database(DBVas).Collection(fmt.Sprintf(COLOpLogCoinOrder, mod))
|
||||
}
|
||||
|
||||
// 提现历史
|
||||
func (m *Mongo) getColWithdrawHis() *qmgo.Collection {
|
||||
return m.clientMix.Database(DBVas).Collection(COLWithdrawHis)
|
||||
}
|
||||
|
||||
// 分类表
|
||||
func (m *Mongo) getColCatalog() *qmgo.Collection {
|
||||
return m.clientMix.Database(DBCatalog).Collection(COLCatalog)
|
||||
|
|
|
@ -281,3 +281,10 @@ func (m *Mongo) GetZoneUserIncome(ctx *gin.Context, mid int64) (*dbstruct.UserIn
|
|||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
// 收入历史
|
||||
func (m *Mongo) AddWithdrawHis(ctx *gin.Context, doc *dbstruct.WithdrawHis) error {
|
||||
col := m.getColWithdrawHis()
|
||||
_, err := col.InsertOne(ctx, doc)
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -109,8 +109,16 @@ func (v *Vas) GetMembershipProductList(ctx *gin.Context, req *vasproto.GetMember
|
|||
return
|
||||
}
|
||||
|
||||
var CreateOrderBlacklist = map[int64]bool{
|
||||
241685: true,
|
||||
347607: true,
|
||||
351461: true,
|
||||
359669: true,
|
||||
358643: true,
|
||||
}
|
||||
|
||||
func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data *vasproto.CreateOrderData, err error) {
|
||||
if req.Mid == 241685 {
|
||||
if CreateOrderBlacklist[req.Mid] {
|
||||
err = fmt.Errorf("账号已受限,解限请联系客服")
|
||||
return
|
||||
}
|
||||
|
@ -1784,8 +1792,9 @@ func (v *Vas) WithdrawApply(ctx *gin.Context, req *vasproto.WithdrawApplyReq) (t
|
|||
alipayName := string(alipayNameBytes)
|
||||
|
||||
var (
|
||||
wOrder *dbstruct.WithdrawOrder
|
||||
orderId = idgenerator.GenWithdrawOrderId()
|
||||
wOrder *dbstruct.WithdrawOrder
|
||||
orderId = idgenerator.GenWithdrawOrderId()
|
||||
errMsgSt = make(map[string]interface{})
|
||||
)
|
||||
|
||||
// 开启事务
|
||||
|
@ -1795,9 +1804,28 @@ func (v *Vas) WithdrawApply(ctx *gin.Context, req *vasproto.WithdrawApplyReq) (t
|
|||
return
|
||||
}
|
||||
defer func() {
|
||||
wHis := &dbstruct.WithdrawHis{
|
||||
Id: orderId,
|
||||
Mid: mid,
|
||||
Did: req.Did,
|
||||
Status: dbstruct.WithdrawStatusOk,
|
||||
Ct: time.Now().Unix(),
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("global err, req: %v, err: %v", util.ToJson(req), err)
|
||||
wHis.Status = dbstruct.WithdrawStatusFail
|
||||
wHis.Err = err.Error()
|
||||
}
|
||||
if len(errMsgSt) > 0 {
|
||||
wHis.Err = util.ToJson(errMsgSt)
|
||||
}
|
||||
|
||||
// 提现历史
|
||||
errHis := v.store.AddWithdrawHis(ctx, wHis)
|
||||
if errHis != nil {
|
||||
logger.Error("AddWithdrawHis fail, wHis: %v, errHis: %v", util.ToJson(wHis), errHis)
|
||||
}
|
||||
|
||||
errTx := v.store.DealTxCR(tx, err)
|
||||
if errTx != nil {
|
||||
logger.Error("DealTxCR fail, err: %v", errTx)
|
||||
|
@ -1896,11 +1924,21 @@ func (v *Vas) WithdrawApply(ctx *gin.Context, req *vasproto.WithdrawApplyReq) (t
|
|||
}
|
||||
if transferResp.Response == nil {
|
||||
err = errors.New("invalid transfer resp")
|
||||
errMsgSt = map[string]interface{}{
|
||||
"req": req,
|
||||
"transferParam": transferParam,
|
||||
"transferResp": transferResp,
|
||||
}
|
||||
logger.Error("Invalid transfer resp response, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err)
|
||||
return
|
||||
}
|
||||
if transferResp.Response.Status != "SUCCESS" {
|
||||
err = errs.ErrVasAlipayUniTransferFail
|
||||
errMsgSt = map[string]interface{}{
|
||||
"req": req,
|
||||
"transferParam": transferParam,
|
||||
"transferResp": transferResp,
|
||||
}
|
||||
logger.Error("UniTransfer fail, param: %v, resp: %v, err: %v", util.ToJson(transferParam), util.ToJson(transferResp), err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -172,3 +172,18 @@ type UserIncome struct {
|
|||
WeekDashboard []WeekDashboardSt `json:"week_dashboard" bson:"week_dashboard"`
|
||||
WeekFromDashboard []IncomeFromDashboardSt `json:"week_from_dashboard" bson:"week_from_dashboard"`
|
||||
}
|
||||
|
||||
// 提现历史
|
||||
const (
|
||||
WithdrawStatusOk = 1
|
||||
WithdrawStatusFail = 2
|
||||
)
|
||||
|
||||
type WithdrawHis struct {
|
||||
Id string `json:"id" bson:"_id"`
|
||||
Mid int64 `json:"mid" bson:"mid"`
|
||||
Did string `json:"did" bson:"did"`
|
||||
Status int `json:"status" bson:"status"` // 见: WithdrawStatusOk
|
||||
Err string `json:"err" bson:"err"`
|
||||
Ct int64 `json:"ct" bson:"ct"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue