by Robin at 20240710
This commit is contained in:
parent
883db65ea4
commit
739b47f032
|
@ -292,6 +292,5 @@ const (
|
|||
StreamerAuthApprovalDetailsApprove_Waiting = 0 //等待复审
|
||||
StreamerAuthApprovalDetailsApprove_Passed = 1 //已复审通过
|
||||
StreamerAuthApprovalDetailsApprove_Rejected = 2 //已复审拒绝
|
||||
StreamerAuthApprovalDetailsApprove_Approving = 3 //跟进中
|
||||
StreamerAuthApprovalDetailsApprove_NotFound = 4 //未提交
|
||||
)
|
||||
|
|
|
@ -100,6 +100,7 @@ var ErrCodeMsgMap = map[ErrCode]string{
|
|||
ErrCodeStreamerAuthApprovalBasicSrvFail: "女神认证入站审批服务错误",
|
||||
ErrCodeStreamerAuthApprovalBasicNotExist: "请先填写入驻申请!",
|
||||
ErrCodeStreamerAuthApprovalBasicDuplicateKey: "请勿重复提交认证",
|
||||
ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus: "女神入站审批不存在或审批状态已更新,请刷新后重试!",
|
||||
ErrCodeStreamerAuthApprovalDetailsSrvFail: "女神认证完善审批服务错误",
|
||||
ErrCodeStreamerAuthApprovalDetailsNotExist: "女神认证完善审批不存在",
|
||||
ErrCodeStreamerAuthApprovalDetailsDuplicateKey: "请勿重复提交认证",
|
||||
|
@ -365,6 +366,7 @@ const (
|
|||
ErrCodeStreamerAuthApprovalBasicSrvFail ErrCode = -12101 // 女神认证入站审批表服务错误
|
||||
ErrCodeStreamerAuthApprovalBasicNotExist ErrCode = -12102 // 女神认证入站审批表不存在
|
||||
ErrCodeStreamerAuthApprovalBasicDuplicateKey ErrCode = -12103 // 女神认证入站审批重复提交
|
||||
ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus ErrCode = -12104 // 女神认证入站审批不存在或状态已更新
|
||||
ErrCodeStreamerAuthApprovalDetailsSrvFail ErrCode = -12201 // 女神认证完善审批表服务错误
|
||||
ErrCodeStreamerAuthApprovalDetailsNotExist ErrCode = -12202 // 女神认证完善审批表不存在
|
||||
ErrCodeStreamerAuthApprovalDetailsDuplicateKey ErrCode = -12203 // 女神认证完善审批重复提交
|
||||
|
|
|
@ -2581,6 +2581,23 @@ func (m *Mongo) GetStreamerAuthApprovalDetailsListByMid(ctx *gin.Context, req *s
|
|||
return streamerauthapprovaldetails, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetStreamerAuthApprovalDetailsListByMids(ctx *gin.Context, mids []int64) ([]*dbstruct.StreamerAuthApprovalDetails, error) {
|
||||
list := make([]*dbstruct.StreamerAuthApprovalDetails, 0)
|
||||
col := m.getColStreamerAuthApprovalDetails()
|
||||
query := qmgo.M{
|
||||
"mid": qmgo.M{
|
||||
"$in": mids,
|
||||
},
|
||||
"del_flag": 0,
|
||||
}
|
||||
err := col.Find(ctx, query).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return make([]*dbstruct.StreamerAuthApprovalDetails, 0), err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetStreamerAuthApprovalDetailsListById(ctx *gin.Context, id int64) (*dbstruct.StreamerAuthApprovalDetails, error) {
|
||||
streamerauthapprovaldetails := &dbstruct.StreamerAuthApprovalDetails{}
|
||||
col := m.getColStreamerAuthApprovalDetails()
|
||||
|
|
|
@ -119,6 +119,41 @@ func (p *StreamerAuthApprovalDetails) OpDeleteBatch(ctx *gin.Context, ids []int6
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *StreamerAuthApprovalDetails) OpDeleteBatchByMids(ctx *gin.Context, mids []int64) error {
|
||||
|
||||
//1.查出原有审核申请
|
||||
list, err := p.store.GetStreamerAuthApprovalDetailsListByMids(ctx, mids)
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
logger.Error("GetStreamerAuthApprovalDetailsListByIds fail, err: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
//2.原有审核申请标记删除后转存到历史表
|
||||
for _, streamerauthapprovaldetails := range list {
|
||||
streamerauthapprovaldetails.DelFlag = goproto.Int64(consts.Deleted)
|
||||
}
|
||||
err = p.store.CreateBatchStreamerAuthApprovalDetailsHis(ctx, list)
|
||||
if err != nil {
|
||||
logger.Error("CreateBatchStreamerAuthApprovalDetailsHis fail, err: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
//3.真删除原有审核申请
|
||||
ids := make([]int64, 0)
|
||||
for _, details := range list {
|
||||
ids = append(ids, details.GetId())
|
||||
}
|
||||
err = p.store.DeleteStreamerAuthApprovalDetailsByIds(ctx, ids)
|
||||
if err != nil {
|
||||
logger.Error("DeleteStreamerAuthApprovalDetailsByIds fail, err: %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *StreamerAuthApprovalDetails) OpList(ctx *gin.Context, req *streamerauthapprovaldetailsproto.OpListReq) ([]*dbstruct.StreamerAuthApprovalDetails, error) {
|
||||
list, err := p.store.GetStreamerAuthApprovalDetailsList(ctx, req)
|
||||
if err != nil {
|
||||
|
|
|
@ -1957,7 +1957,16 @@ func (s *Service) OpGetStreamerAuthApprovalBasicHisList(ctx *gin.Context, req *s
|
|||
func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *streamerauthapprovalbasicproto.OpApproveReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvOk
|
||||
|
||||
//1.更新状态
|
||||
//状态流转:0-等待复审 → 3-跟进中,3-跟进中 → 1-通过/2-拒绝
|
||||
destApproveStatus := util.DerefInt64(req.ApproveStatus)
|
||||
currentApproveStatus := int64(-1)
|
||||
if destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Approving {
|
||||
currentApproveStatus = consts.StreamerAuthApprovalBasicApprove_Waiting
|
||||
} else if destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Passed || destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Rejected {
|
||||
currentApproveStatus = consts.StreamerAuthApprovalBasicApprove_Approving
|
||||
}
|
||||
|
||||
// 1.更新状态
|
||||
err := _DefaultStreamerAuthApprovalBasic.OpUpdateStreamerAuthApprovalBasicByIdsAndApproveStatus(ctx, &streamerauthapprovalbasicproto.OpUpdateByIdsReq{
|
||||
BaseRequest: req.BaseRequest,
|
||||
StreamerAuthApprovalBasic: &dbstruct.StreamerAuthApprovalBasic{
|
||||
|
@ -1965,9 +1974,10 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
Remarks: req.Remarks,
|
||||
},
|
||||
Ids: req.Ids,
|
||||
ApproveStatus: currentApproveStatus,
|
||||
})
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus
|
||||
err = nil
|
||||
return
|
||||
}
|
||||
|
@ -1977,18 +1987,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
return
|
||||
}
|
||||
|
||||
//2.若是审批失败,则更新之后直接删除,审批失败的信息将流转到历史表里保存
|
||||
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalBasicApprove_Rejected {
|
||||
err := _DefaultStreamerAuthApprovalBasic.OpDeleteBatch(ctx, req.Ids)
|
||||
if err != nil {
|
||||
logger.Error("OpDeleteBatch fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvFail
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//3.查询获取这些认证申请
|
||||
// 2.查询获取这些认证申请
|
||||
list, err := _DefaultStreamerAuthApprovalBasic.GetStreamerAuthApprovalBasicListByIds(ctx, req.Ids)
|
||||
if err != nil {
|
||||
logger.Error("GetStreamerAuthApprovalBasicListByIds fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
|
@ -1996,8 +1995,30 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
return
|
||||
}
|
||||
|
||||
// 3.若是审批失败,则更新之后直接删除,审批失败的信息将流转到历史表里保存,若该申请人同时有完善资料申请,则一并删除
|
||||
if destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Rejected {
|
||||
err := _DefaultStreamerAuthApprovalBasic.OpDeleteBatch(ctx, req.Ids)
|
||||
if err != nil {
|
||||
logger.Error("OpDeleteBatch fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
mids := make([]int64, 0)
|
||||
for _, basic := range list {
|
||||
mids = append(mids, basic.GetMid())
|
||||
}
|
||||
err = _DefaultStreamerAuthApprovalDetails.OpDeleteBatchByMids(ctx, mids)
|
||||
if err != nil {
|
||||
logger.Error("_DefaultStreamerAuthApprovalDetails OpDeleteBatchByMids fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//4.若是审批通过,将审批表的信息合并进主播表创建信息,并更新account表里的角色信息为准主播
|
||||
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalBasicApprove_Passed {
|
||||
if destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Passed {
|
||||
// 构建streamer信息
|
||||
streamerList := make([]*dbstruct.Streamer, len(list))
|
||||
midList := make([]int64, len(list))
|
||||
|
@ -2165,6 +2186,7 @@ func (s *Service) OpApproveStreamerAuthApprovalDetails(ctx *gin.Context, req *st
|
|||
Remarks: req.Remarks,
|
||||
},
|
||||
Ids: req.Ids,
|
||||
ApproveStatus: consts.StreamerAuthApprovalDetailsApprove_Waiting,
|
||||
})
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist
|
||||
|
|
Loading…
Reference in New Issue