by Robin at 20240710

This commit is contained in:
Leufolium 2024-07-10 05:18:02 +08:00
parent 883db65ea4
commit 739b47f032
5 changed files with 97 additions and 22 deletions

View File

@ -289,9 +289,8 @@ const (
// 主播入驻完善人工复审 // 主播入驻完善人工复审
const ( const (
StreamerAuthApprovalDetailsApprove_Waiting = 0 //等待复审 StreamerAuthApprovalDetailsApprove_Waiting = 0 //等待复审
StreamerAuthApprovalDetailsApprove_Passed = 1 //已复审通过 StreamerAuthApprovalDetailsApprove_Passed = 1 //已复审通过
StreamerAuthApprovalDetailsApprove_Rejected = 2 //已复审拒绝 StreamerAuthApprovalDetailsApprove_Rejected = 2 //已复审拒绝
StreamerAuthApprovalDetailsApprove_Approving = 3 //跟进中 StreamerAuthApprovalDetailsApprove_NotFound = 4 //未提交
StreamerAuthApprovalDetailsApprove_NotFound = 4 //未提交
) )

View File

@ -100,6 +100,7 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeStreamerAuthApprovalBasicSrvFail: "女神认证入站审批服务错误", ErrCodeStreamerAuthApprovalBasicSrvFail: "女神认证入站审批服务错误",
ErrCodeStreamerAuthApprovalBasicNotExist: "请先填写入驻申请!", ErrCodeStreamerAuthApprovalBasicNotExist: "请先填写入驻申请!",
ErrCodeStreamerAuthApprovalBasicDuplicateKey: "请勿重复提交认证", ErrCodeStreamerAuthApprovalBasicDuplicateKey: "请勿重复提交认证",
ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus: "女神入站审批不存在或审批状态已更新,请刷新后重试!",
ErrCodeStreamerAuthApprovalDetailsSrvFail: "女神认证完善审批服务错误", ErrCodeStreamerAuthApprovalDetailsSrvFail: "女神认证完善审批服务错误",
ErrCodeStreamerAuthApprovalDetailsNotExist: "女神认证完善审批不存在", ErrCodeStreamerAuthApprovalDetailsNotExist: "女神认证完善审批不存在",
ErrCodeStreamerAuthApprovalDetailsDuplicateKey: "请勿重复提交认证", ErrCodeStreamerAuthApprovalDetailsDuplicateKey: "请勿重复提交认证",
@ -365,6 +366,7 @@ const (
ErrCodeStreamerAuthApprovalBasicSrvFail ErrCode = -12101 // 女神认证入站审批表服务错误 ErrCodeStreamerAuthApprovalBasicSrvFail ErrCode = -12101 // 女神认证入站审批表服务错误
ErrCodeStreamerAuthApprovalBasicNotExist ErrCode = -12102 // 女神认证入站审批表不存在 ErrCodeStreamerAuthApprovalBasicNotExist ErrCode = -12102 // 女神认证入站审批表不存在
ErrCodeStreamerAuthApprovalBasicDuplicateKey ErrCode = -12103 // 女神认证入站审批重复提交 ErrCodeStreamerAuthApprovalBasicDuplicateKey ErrCode = -12103 // 女神认证入站审批重复提交
ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus ErrCode = -12104 // 女神认证入站审批不存在或状态已更新
ErrCodeStreamerAuthApprovalDetailsSrvFail ErrCode = -12201 // 女神认证完善审批表服务错误 ErrCodeStreamerAuthApprovalDetailsSrvFail ErrCode = -12201 // 女神认证完善审批表服务错误
ErrCodeStreamerAuthApprovalDetailsNotExist ErrCode = -12202 // 女神认证完善审批表不存在 ErrCodeStreamerAuthApprovalDetailsNotExist ErrCode = -12202 // 女神认证完善审批表不存在
ErrCodeStreamerAuthApprovalDetailsDuplicateKey ErrCode = -12203 // 女神认证完善审批重复提交 ErrCodeStreamerAuthApprovalDetailsDuplicateKey ErrCode = -12203 // 女神认证完善审批重复提交

View File

@ -2581,6 +2581,23 @@ func (m *Mongo) GetStreamerAuthApprovalDetailsListByMid(ctx *gin.Context, req *s
return streamerauthapprovaldetails, err 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) { func (m *Mongo) GetStreamerAuthApprovalDetailsListById(ctx *gin.Context, id int64) (*dbstruct.StreamerAuthApprovalDetails, error) {
streamerauthapprovaldetails := &dbstruct.StreamerAuthApprovalDetails{} streamerauthapprovaldetails := &dbstruct.StreamerAuthApprovalDetails{}
col := m.getColStreamerAuthApprovalDetails() col := m.getColStreamerAuthApprovalDetails()

View File

@ -119,6 +119,41 @@ func (p *StreamerAuthApprovalDetails) OpDeleteBatch(ctx *gin.Context, ids []int6
return nil 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) { func (p *StreamerAuthApprovalDetails) OpList(ctx *gin.Context, req *streamerauthapprovaldetailsproto.OpListReq) ([]*dbstruct.StreamerAuthApprovalDetails, error) {
list, err := p.store.GetStreamerAuthApprovalDetailsList(ctx, req) list, err := p.store.GetStreamerAuthApprovalDetailsList(ctx, req)
if err != nil { if err != nil {

View File

@ -1957,17 +1957,27 @@ func (s *Service) OpGetStreamerAuthApprovalBasicHisList(ctx *gin.Context, req *s
func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *streamerauthapprovalbasicproto.OpApproveReq) (ec errcode.ErrCode) { func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *streamerauthapprovalbasicproto.OpApproveReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvOk 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{ err := _DefaultStreamerAuthApprovalBasic.OpUpdateStreamerAuthApprovalBasicByIdsAndApproveStatus(ctx, &streamerauthapprovalbasicproto.OpUpdateByIdsReq{
BaseRequest: req.BaseRequest, BaseRequest: req.BaseRequest,
StreamerAuthApprovalBasic: &dbstruct.StreamerAuthApprovalBasic{ StreamerAuthApprovalBasic: &dbstruct.StreamerAuthApprovalBasic{
ApproveStatus: req.ApproveStatus, ApproveStatus: req.ApproveStatus,
Remarks: req.Remarks, Remarks: req.Remarks,
}, },
Ids: req.Ids, Ids: req.Ids,
ApproveStatus: currentApproveStatus,
}) })
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExistOrWrongStatus
err = nil err = nil
return return
} }
@ -1977,18 +1987,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
return return
} }
//2.若是审批失败,则更新之后直接删除,审批失败的信息将流转到历史表里保存 // 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.查询获取这些认证申请
list, err := _DefaultStreamerAuthApprovalBasic.GetStreamerAuthApprovalBasicListByIds(ctx, req.Ids) list, err := _DefaultStreamerAuthApprovalBasic.GetStreamerAuthApprovalBasicListByIds(ctx, req.Ids)
if err != nil { if err != nil {
logger.Error("GetStreamerAuthApprovalBasicListByIds fail, req: %v, err: %v", util.ToJson(req), err) 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 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表里的角色信息为准主播 //4.若是审批通过将审批表的信息合并进主播表创建信息并更新account表里的角色信息为准主播
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalBasicApprove_Passed { if destApproveStatus == consts.StreamerAuthApprovalBasicApprove_Passed {
// 构建streamer信息 // 构建streamer信息
streamerList := make([]*dbstruct.Streamer, len(list)) streamerList := make([]*dbstruct.Streamer, len(list))
midList := make([]int64, len(list)) midList := make([]int64, len(list))
@ -2164,7 +2185,8 @@ func (s *Service) OpApproveStreamerAuthApprovalDetails(ctx *gin.Context, req *st
ApproveStatus: req.ApproveStatus, ApproveStatus: req.ApproveStatus,
Remarks: req.Remarks, Remarks: req.Remarks,
}, },
Ids: req.Ids, Ids: req.Ids,
ApproveStatus: consts.StreamerAuthApprovalDetailsApprove_Waiting,
}) })
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist