conf #608
|
@ -26,6 +26,7 @@ const (
|
||||||
AccountPunishment_BlockFromBeingSearched = 4 // 禁止被搜索到
|
AccountPunishment_BlockFromBeingSearched = 4 // 禁止被搜索到
|
||||||
AccountPunishment_BlockFromBeingDiscovered = 5 // 禁止在推荐被发现
|
AccountPunishment_BlockFromBeingDiscovered = 5 // 禁止在推荐被发现
|
||||||
AccountPunishment_BlockFromBeingSeenAtMoment = 6 // 禁止在广场被发现
|
AccountPunishment_BlockFromBeingSeenAtMoment = 6 // 禁止在广场被发现
|
||||||
|
AccountPunishment_BlockFromPaying = 7 // 禁止付款
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"service/api/consts"
|
"service/api/consts"
|
||||||
"service/api/errcode"
|
"service/api/errcode"
|
||||||
accountproto "service/api/proto/account/proto"
|
accountproto "service/api/proto/account/proto"
|
||||||
|
@ -11,6 +12,7 @@ import (
|
||||||
streamerauthapprovalproto "service/api/proto/streamerauthapproval/proto"
|
streamerauthapprovalproto "service/api/proto/streamerauthapproval/proto"
|
||||||
streamerauthapprovalbasicproto "service/api/proto/streamerauthapprovalbasic/proto"
|
streamerauthapprovalbasicproto "service/api/proto/streamerauthapprovalbasic/proto"
|
||||||
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
|
streamerauthapprovaldetailsproto "service/api/proto/streamerauthapprovaldetails/proto"
|
||||||
|
vasproto "service/api/proto/vas/proto"
|
||||||
vericodeproto "service/api/proto/vericode/proto"
|
vericodeproto "service/api/proto/vericode/proto"
|
||||||
zone_collaborator_proto "service/api/proto/zone_collaborator/proto"
|
zone_collaborator_proto "service/api/proto/zone_collaborator/proto"
|
||||||
zone_third_partner_proto "service/api/proto/zone_third_partner/proto"
|
zone_third_partner_proto "service/api/proto/zone_third_partner/proto"
|
||||||
|
@ -771,3 +773,16 @@ func (s *Service) ApiUpdateZoneCollaboratorBusinessValidate(ctx *gin.Context, re
|
||||||
|
|
||||||
return
|
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
|
zone *Zone
|
||||||
zonetp *ZoneThirdPartner
|
zonetp *ZoneThirdPartner
|
||||||
zoneclr *ZoneCollaborator
|
zoneclr *ZoneCollaborator
|
||||||
|
|
||||||
|
createOrderProxy *CreateOrderProxy
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewVas(store *dao.Store, streamer *Streamer, account *Account, zone *Zone, zonetp *ZoneThirdPartner, zoneclr *ZoneCollaborator) (v *Vas) {
|
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) {
|
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)
|
list, err := v.store.GetProductByDtType(ctx, req.DevType, dbstruct.ProductTypeCoins)
|
||||||
|
@ -115,9 +121,20 @@ var CreateOrderBlacklist = map[int64]bool{
|
||||||
351461: true,
|
351461: true,
|
||||||
359669: true,
|
359669: true,
|
||||||
358643: true,
|
358643: true,
|
||||||
|
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) {
|
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] {
|
if CreateOrderBlacklist[req.Mid] {
|
||||||
err = fmt.Errorf("账号已受限,解限请联系客服")
|
err = fmt.Errorf("账号已受限,解限请联系客服")
|
||||||
return
|
return
|
||||||
|
@ -2560,14 +2577,14 @@ func (v *Vas) refundMembership(ctx *gin.Context, order *dbstruct.Order, req *vas
|
||||||
}
|
}
|
||||||
incomeChList = append(incomeChList, ch)
|
incomeChList = append(incomeChList, ch)
|
||||||
}
|
}
|
||||||
if len(incomeChList) > 1 {
|
//if len(incomeChList) > 1 {
|
||||||
err = errors.New("收入记录错误,请找开发同学排查")
|
// err = errors.New("收入记录错误,请找开发同学排查")
|
||||||
return err
|
// return err
|
||||||
}
|
//}
|
||||||
|
|
||||||
// 有分成的情况
|
// 有分成的情况
|
||||||
if len(incomeChList) > 0 {
|
for _, ch := range incomeChList {
|
||||||
ch := incomeChList[0]
|
//ch := incomeChList[0]
|
||||||
streamerMid := ch.GetMid()
|
streamerMid := ch.GetMid()
|
||||||
if streamerMid <= 0 {
|
if streamerMid <= 0 {
|
||||||
err = errors.New("收入streamerMid错误")
|
err = errors.New("收入streamerMid错误")
|
||||||
|
|
|
@ -250,6 +250,13 @@ func (s *Service) Init(c any) (err error) {
|
||||||
|
|
||||||
_DefaultVas = logic.NewVas(store, _DefaultStreamer, _DefaultAccount, _DefaultZone, _DefaultZoneThirdPartner, _DefaultZoneCollaborator)
|
_DefaultVas = logic.NewVas(store, _DefaultStreamer, _DefaultAccount, _DefaultZone, _DefaultZoneThirdPartner, _DefaultZoneCollaborator)
|
||||||
_DefaultStreamerAcct = logic.NewStreamerAcct(store)
|
_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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue