by Robin at 20240710
This commit is contained in:
parent
bfc5c9f810
commit
e47ed25ed0
|
@ -26,6 +26,7 @@ const (
|
|||
AccountPunishment_BlockFromBeingSearched = 4 // 禁止被搜索到
|
||||
AccountPunishment_BlockFromBeingDiscovered = 5 // 禁止在推荐被发现
|
||||
AccountPunishment_BlockFromBeingSeenAtMoment = 6 // 禁止在广场被发现
|
||||
AccountPunishment_BlockFromPaying = 7 // 禁止付款
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"service/api/consts"
|
||||
"service/api/errcode"
|
||||
accountproto "service/api/proto/account/proto"
|
||||
|
@ -9,6 +10,7 @@ import (
|
|||
momentproto "service/api/proto/moment/proto"
|
||||
streamerproto "service/api/proto/streamer/proto"
|
||||
streamerauthapprovalproto "service/api/proto/streamerauthapproval/proto"
|
||||
vasproto "service/api/proto/vas/proto"
|
||||
vericodeproto "service/api/proto/vericode/proto"
|
||||
zone_collaborator_proto "service/api/proto/zone_collaborator/proto"
|
||||
zone_third_partner_proto "service/api/proto/zone_third_partner/proto"
|
||||
|
@ -730,3 +732,16 @@ func (s *Service) ApiUpdateZoneCollaboratorBusinessValidate(ctx *gin.Context, re
|
|||
|
||||
return
|
||||
}
|
||||
|
||||
func (s *Service) ApiCreateOrderBusinessValidate(ctx *gin.Context, req *vasproto.CreateOrderReq) (err error) {
|
||||
|
||||
result := businessvalidator.NewAuthBusinessValidator(ctx, req).
|
||||
EnsureSuchAccountPunishmentNotExist(req.BaseRequest.Mid, consts.AccountPunishment_BlockFromPaying, _DefaultAccountPunishment.OpListByMidAndType).
|
||||
Validate().
|
||||
Collect()
|
||||
ec := result[0].(errcode.ErrCode)
|
||||
if ec == errcode.ErrCodeAccountPunishmentExist {
|
||||
return fmt.Errorf("账号已受限,解限请联系客服")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ type Vas struct {
|
|||
zone *Zone
|
||||
zonetp *ZoneThirdPartner
|
||||
zoneclr *ZoneCollaborator
|
||||
|
||||
createOrderProxy *CreateOrderProxy
|
||||
}
|
||||
|
||||
func NewVas(store *dao.Store, streamer *Streamer, account *Account, zone *Zone, zonetp *ZoneThirdPartner, zoneclr *ZoneCollaborator) (v *Vas) {
|
||||
|
@ -54,6 +56,10 @@ func NewVas(store *dao.Store, streamer *Streamer, account *Account, zone *Zone,
|
|||
}
|
||||
}
|
||||
|
||||
func (v *Vas) RegisterProxyForCreateOrder(proxy *CreateOrderProxy) {
|
||||
v.createOrderProxy = proxy
|
||||
}
|
||||
|
||||
func (v *Vas) GetCoinsProductList(ctx *gin.Context, req *vasproto.GetCoinsProductListReq) (listAlipayH5 []*dbstruct.Product, err error) {
|
||||
// 获取所有金币商品
|
||||
list, err := v.store.GetProductByDtType(ctx, req.DevType, dbstruct.ProductTypeCoins)
|
||||
|
@ -118,7 +124,17 @@ var CreateOrderBlacklist = map[int64]bool{
|
|||
359498: true,
|
||||
}
|
||||
|
||||
type CreateOrderProxy struct {
|
||||
PreProc func(ctx *gin.Context, req *vasproto.CreateOrderReq) (data any, err error)
|
||||
}
|
||||
|
||||
func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data *vasproto.CreateOrderData, err error) {
|
||||
|
||||
_, err = v.createOrderProxy.PreProc(ctx, req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if CreateOrderBlacklist[req.Mid] {
|
||||
err = fmt.Errorf("账号已受限,解限请联系客服")
|
||||
return
|
||||
|
|
|
@ -238,6 +238,13 @@ func (s *Service) Init(c any) (err error) {
|
|||
|
||||
_DefaultVas = logic.NewVas(store, _DefaultStreamer, _DefaultAccount, _DefaultZone, _DefaultZoneThirdPartner, _DefaultZoneCollaborator)
|
||||
_DefaultStreamerAcct = logic.NewStreamerAcct(store)
|
||||
|
||||
_DefaultVas.RegisterProxyForCreateOrder(&logic.CreateOrderProxy{
|
||||
PreProc: func(ctx *gin.Context, req *vasproto.CreateOrderReq) (data any, err error) {
|
||||
err = s.ApiCreateOrderBusinessValidate(ctx, req)
|
||||
return nil, err
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue