Merge pull request 'feat-IRONFANS-191-Robin' (#694) from feat-IRONFANS-191-Robin into main
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/694
This commit is contained in:
commit
ac4bebbf2a
|
@ -93,3 +93,8 @@ const (
|
||||||
MerchantWeixin = 40 //商户方微信
|
MerchantWeixin = 40 //商户方微信
|
||||||
CPAccount = 51 //中金支付电子账户
|
CPAccount = 51 //中金支付电子账户
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
StreamerAuthApproval_OneOffVersion = 0
|
||||||
|
StreamerAuthApproval_SeparateVersion = 1
|
||||||
|
)
|
||||||
|
|
|
@ -109,6 +109,8 @@ var ErrCodeMsgMap = map[ErrCode]string{
|
||||||
ErrCodeStreamerAuthApprovalDetailsInviterIsNotAStreamer: "邀请人非主播",
|
ErrCodeStreamerAuthApprovalDetailsInviterIsNotAStreamer: "邀请人非主播",
|
||||||
ErrCodeStreamerAuthApprovalDetailsNotAStreamerToBe: "该主播尚未通过“网红入驻审核”,请先前往审核",
|
ErrCodeStreamerAuthApprovalDetailsNotAStreamerToBe: "该主播尚未通过“网红入驻审核”,请先前往审核",
|
||||||
ErrCodeStreamerAuthApprovalDetailsNotInApprovingStatus: "所选完善审批中有项目状态错误,请刷新后重试",
|
ErrCodeStreamerAuthApprovalDetailsNotInApprovingStatus: "所选完善审批中有项目状态错误,请刷新后重试",
|
||||||
|
ErrCodeStreamerAuthApprovalOneOffVersionExist: "请勿重复提交入驻申请,详情请联系客服",
|
||||||
|
ErrCodeStreamerAuthApprovalSeparateVersionExist: "请勿重复提交入驻申请,详情请联系客服",
|
||||||
|
|
||||||
ErrCodeStreamerSrvFail: "主播服务错误",
|
ErrCodeStreamerSrvFail: "主播服务错误",
|
||||||
ErrCodeStreamerNotExist: "主播不存在",
|
ErrCodeStreamerNotExist: "主播不存在",
|
||||||
|
@ -388,6 +390,8 @@ const (
|
||||||
ErrCodeStreamerAuthApprovalDetailsInviterIsNotAStreamer ErrCode = -12205 // 女神认证完善审批表邀请人非主播
|
ErrCodeStreamerAuthApprovalDetailsInviterIsNotAStreamer ErrCode = -12205 // 女神认证完善审批表邀请人非主播
|
||||||
ErrCodeStreamerAuthApprovalDetailsNotAStreamerToBe ErrCode = -12206 // 女神认证完善审批表申请人非准主播
|
ErrCodeStreamerAuthApprovalDetailsNotAStreamerToBe ErrCode = -12206 // 女神认证完善审批表申请人非准主播
|
||||||
ErrCodeStreamerAuthApprovalDetailsNotInApprovingStatus ErrCode = -12207 // 女神认证完善审批表非人审中状态
|
ErrCodeStreamerAuthApprovalDetailsNotInApprovingStatus ErrCode = -12207 // 女神认证完善审批表非人审中状态
|
||||||
|
ErrCodeStreamerAuthApprovalOneOffVersionExist ErrCode = -12208 // 女神认证批表已提交旧表
|
||||||
|
ErrCodeStreamerAuthApprovalSeparateVersionExist ErrCode = -12209 // 女神认证批表已提交新表
|
||||||
|
|
||||||
// Streamer: 13xxx
|
// Streamer: 13xxx
|
||||||
ErrCodeStreamerSrvOk ErrCode = ErrCodeOk
|
ErrCodeStreamerSrvOk ErrCode = ErrCodeOk
|
||||||
|
|
|
@ -144,6 +144,7 @@ const (
|
||||||
COLStreamerAuthApprovalHis = "streamer_auth_approval_his"
|
COLStreamerAuthApprovalHis = "streamer_auth_approval_his"
|
||||||
COLStreamerAuthApprovalBasicHis = "streamer_auth_approval_basic_his"
|
COLStreamerAuthApprovalBasicHis = "streamer_auth_approval_basic_his"
|
||||||
COLStreamerAuthApprovalDetailsHis = "streamer_auth_approval_details_his"
|
COLStreamerAuthApprovalDetailsHis = "streamer_auth_approval_details_his"
|
||||||
|
COLStreamerAuthApprovalVersion = "streamer_auth_approval_version"
|
||||||
|
|
||||||
DBStreamer = "streamer"
|
DBStreamer = "streamer"
|
||||||
COLStreamer = "streamer"
|
COLStreamer = "streamer"
|
||||||
|
@ -425,6 +426,11 @@ func (m *Mongo) getColStreamerAuthApprovalDetailsHis() *qmgo.Collection {
|
||||||
return m.clientMix.Database(DBStreamerAuthApproval).Collection(COLStreamerAuthApprovalDetailsHis)
|
return m.clientMix.Database(DBStreamerAuthApproval).Collection(COLStreamerAuthApprovalDetailsHis)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 女神认证审批版本表
|
||||||
|
func (m *Mongo) getColStreamerAuthApprovalVersion() *qmgo.Collection {
|
||||||
|
return m.clientMix.Database(DBStreamerAuthApproval).Collection(COLStreamerAuthApprovalVersion)
|
||||||
|
}
|
||||||
|
|
||||||
// 主播表
|
// 主播表
|
||||||
func (m *Mongo) getColStreamer() *qmgo.Collection {
|
func (m *Mongo) getColStreamer() *qmgo.Collection {
|
||||||
return m.clientMix.Database(DBStreamer).Collection(COLStreamer)
|
return m.clientMix.Database(DBStreamer).Collection(COLStreamer)
|
||||||
|
@ -2353,6 +2359,26 @@ func (m *Mongo) CreateBatchStreamerAuthApprovalHis(ctx *gin.Context, streameraut
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) CreateStreamerAuthApprovalVersion(ctx *gin.Context, streamerauthapprovalversion *dbstruct.StreamerAuthApprovalVersion) error {
|
||||||
|
col := m.getColStreamerAuthApprovalVersion()
|
||||||
|
_, err := col.InsertOne(ctx, streamerauthapprovalversion)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) GetStreamerAuthApprovalVersion(ctx *gin.Context, id int64) (*dbstruct.StreamerAuthApprovalVersion, error) {
|
||||||
|
streamerauthapprovalversion := &dbstruct.StreamerAuthApprovalVersion{}
|
||||||
|
col := m.getColStreamerAuthApprovalVersion()
|
||||||
|
query := qmgo.M{
|
||||||
|
"_id": id,
|
||||||
|
}
|
||||||
|
err := col.Find(ctx, query).One(streamerauthapprovalversion)
|
||||||
|
if err == qmgo.ErrNoSuchDocuments {
|
||||||
|
err = nil
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return streamerauthapprovalversion, err
|
||||||
|
}
|
||||||
|
|
||||||
// 女神认证入站审批表相关
|
// 女神认证入站审批表相关
|
||||||
func (m *Mongo) CreateStreamerAuthApprovalBasic(ctx *gin.Context, streamerauthapprovalbasic *dbstruct.StreamerAuthApprovalBasic) error {
|
func (m *Mongo) CreateStreamerAuthApprovalBasic(ctx *gin.Context, streamerauthapprovalbasic *dbstruct.StreamerAuthApprovalBasic) error {
|
||||||
col := m.getColStreamerAuthApprovalBasic()
|
col := m.getColStreamerAuthApprovalBasic()
|
||||||
|
|
|
@ -429,6 +429,8 @@ func (s *Service) ApiCreateStreamerAuthApprovalBusinessValidate(ctx *gin.Context
|
||||||
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApproval.Album).
|
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApproval.Album).
|
||||||
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApproval.Shorts).
|
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApproval.Shorts).
|
||||||
EnsureIsOperatingHisOwn(util.DerefInt64(req.StreamerAuthApproval.Mid)).
|
EnsureIsOperatingHisOwn(util.DerefInt64(req.StreamerAuthApproval.Mid)).
|
||||||
|
EnsureStreamerAuthApprovalIsUnique(_DefaultStreamerAuthApproval.OpCreateStreamerAuthApprovalVersion, _DefaultStreamerAuthApproval.GetStreamerAuthApprovalVersion,
|
||||||
|
consts.StreamerAuthApproval_OneOffVersion, req.BaseRequest.Mid).
|
||||||
Validate().
|
Validate().
|
||||||
Collect()
|
Collect()
|
||||||
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
||||||
|
@ -490,6 +492,8 @@ func (s *Service) ApiCreateStreamerAuthApprovalBasicBusinessValidate(ctx *gin.Co
|
||||||
EnsureIsNotThisRole(consts.Streamer).
|
EnsureIsNotThisRole(consts.Streamer).
|
||||||
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApprovalBasic.Avatar).
|
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApprovalBasic.Avatar).
|
||||||
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApprovalBasic.AccountShot).
|
EnsureMediaIsSuccessfullyUploaded(req.StreamerAuthApprovalBasic.AccountShot).
|
||||||
|
EnsureStreamerAuthApprovalIsUnique(_DefaultStreamerAuthApproval.OpCreateStreamerAuthApprovalVersion, _DefaultStreamerAuthApproval.GetStreamerAuthApprovalVersion,
|
||||||
|
consts.StreamerAuthApproval_SeparateVersion, req.BaseRequest.Mid).
|
||||||
Validate().
|
Validate().
|
||||||
Collect()
|
Collect()
|
||||||
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
||||||
|
|
|
@ -737,6 +737,41 @@ func (l *AuthBusinessValidator) EnsureStreamerAuthApprovalBasicCreated(fun func(
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *AuthBusinessValidator) EnsureStreamerAuthApprovalIsUnique(createFunc func(*gin.Context, *dbstruct.StreamerAuthApprovalVersion) error, queryFunc func(*gin.Context, int64) (*dbstruct.StreamerAuthApprovalVersion, error),
|
||||||
|
version int64, mid int64) *AuthBusinessValidator {
|
||||||
|
l.oplist = append(l.oplist, func() {
|
||||||
|
streamerauthapprovalversion, err := queryFunc(l.ctx, mid)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("StreamerAuthApprovalVersion Get fail, err: %v", err)
|
||||||
|
l.ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if streamerauthapprovalversion == nil {
|
||||||
|
err := createFunc(l.ctx, &dbstruct.StreamerAuthApprovalVersion{
|
||||||
|
Id: mid,
|
||||||
|
Version: version,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("StreamerAuthApprovalVersion Create fail, err: %v", err)
|
||||||
|
l.ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if streamerauthapprovalversion.Version != version {
|
||||||
|
if streamerauthapprovalversion.Version == consts.StreamerAuthApproval_OneOffVersion {
|
||||||
|
l.ec = errcode.ErrCodeStreamerAuthApprovalOneOffVersionExist
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if streamerauthapprovalversion.Version == consts.StreamerAuthApproval_SeparateVersion {
|
||||||
|
l.ec = errcode.ErrCodeStreamerAuthApprovalSeparateVersionExist
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
// 执行校验
|
// 执行校验
|
||||||
func (a *AuthBusinessValidator) Validate() *AuthBusinessValidator {
|
func (a *AuthBusinessValidator) Validate() *AuthBusinessValidator {
|
||||||
a.BusinessValidateStream.Validate()
|
a.BusinessValidateStream.Validate()
|
||||||
|
|
|
@ -154,3 +154,21 @@ func (p *StreamerAuthApproval) GetStreamerAuthApprovalListByIds(ctx *gin.Context
|
||||||
}
|
}
|
||||||
return list, nil
|
return list, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *StreamerAuthApproval) OpCreateStreamerAuthApprovalVersion(ctx *gin.Context, version *dbstruct.StreamerAuthApprovalVersion) error {
|
||||||
|
err := p.store.CreateStreamerAuthApprovalVersion(ctx, version)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("CreateStreamerAuthApprovalVersion fail, err: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *StreamerAuthApproval) GetStreamerAuthApprovalVersion(ctx *gin.Context, id int64) (*dbstruct.StreamerAuthApprovalVersion, error) {
|
||||||
|
version, err := p.store.GetStreamerAuthApprovalVersion(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("GetStreamerAuthApprovalVersion fail, err: %v", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return version, nil
|
||||||
|
}
|
||||||
|
|
|
@ -128,3 +128,8 @@ func (p *StreamerAuthApprovalDetails) GetApproveStatus() int64 {
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StreamerAuthApprovalVersion struct {
|
||||||
|
Id int64 `json:"id" bson:"_id"` //id,主播的mid
|
||||||
|
Version int64 `json:"version" bson:"version"` //版本号
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue