Merge pull request 'feat-IRONFANS-148-Robin' (#597) from feat-IRONFANS-148-Robin into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/597
This commit is contained in:
commit
adad3942a0
|
@ -272,9 +272,11 @@ const (
|
|||
|
||||
// 主播入驻人工审核
|
||||
const (
|
||||
StreamerAuthApprovalDetailsBasic_Waiting = 0 //等待复审
|
||||
StreamerAuthApprovalDetailsBasic_Passed = 1 //已复审通过
|
||||
StreamerAuthApprovalDetailsBasic_Rejected = 2 //已复审拒绝
|
||||
StreamerAuthApprovalBasicApprove_Waiting = 0 //等待复审
|
||||
StreamerAuthApprovalBasicApprove_Passed = 1 //已复审通过
|
||||
StreamerAuthApprovalBasicApprove_Rejected = 2 //已复审拒绝
|
||||
StreamerAuthApprovalBasicApprove_Approving = 3 //跟进中
|
||||
StreamerAuthApprovalBasicApprove_NotFound = 4 //未提交
|
||||
)
|
||||
|
||||
// 主播入驻完善表status
|
||||
|
@ -287,7 +289,9 @@ const (
|
|||
|
||||
// 主播入驻完善人工复审
|
||||
const (
|
||||
StreamerAuthApprovalDetailsApprove_Waiting = 0 //等待复审
|
||||
StreamerAuthApprovalDetailsApprove_Passed = 1 //已复审通过
|
||||
StreamerAuthApprovalDetailsApprove_Rejected = 2 //已复审拒绝
|
||||
StreamerAuthApprovalDetailsApprove_Waiting = 0 //等待复审
|
||||
StreamerAuthApprovalDetailsApprove_Passed = 1 //已复审通过
|
||||
StreamerAuthApprovalDetailsApprove_Rejected = 2 //已复审拒绝
|
||||
StreamerAuthApprovalDetailsApprove_Approving = 3 //跟进中
|
||||
StreamerAuthApprovalDetailsApprove_NotFound = 4 //未提交
|
||||
)
|
||||
|
|
|
@ -45,3 +45,18 @@ type ApiListResp struct {
|
|||
base.BaseResponse
|
||||
Data *ApiListData `json:"data"`
|
||||
}
|
||||
|
||||
// api 列表
|
||||
type ApiGetApproveStatusesReq struct {
|
||||
base.BaseRequest
|
||||
}
|
||||
|
||||
type ApiGetApproveStatusesData struct {
|
||||
BasicStatus int64 `json:"basic_status"`
|
||||
DetailsStatus int64 `json:"details_status"`
|
||||
}
|
||||
|
||||
type ApiGetApproveStatusesResp struct {
|
||||
base.BaseResponse
|
||||
Data *ApiGetApproveStatusesData `json:"data"`
|
||||
}
|
||||
|
|
|
@ -146,6 +146,7 @@ func Init(r *gin.Engine) {
|
|||
apiStreamerAuthApprovalGroup.POST("create_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.ApiCreateReq{}), middleware.JwtAuthenticator(), ApiCreateStreamerAuthApprovalDetails)
|
||||
apiStreamerAuthApprovalGroup.POST("delete_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.ApiDeleteReq{}), middleware.JwtAuthenticator(), ApiDeleteStreamerAuthApprovalDetails)
|
||||
apiStreamerAuthApprovalGroup.POST("list_details", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.ApiListReq{}), middleware.JwtAuthenticator(), ApiGetStreamerAuthApprovalDetailsList)
|
||||
apiStreamerAuthApprovalGroup.POST("get_statuses", middleware.JSONParamValidator(streamerauthapprovaldetailsproto.ApiGetApproveStatusesReq{}), middleware.JwtAuthenticator(), ApiGetStreamerAuthApprovalApproveStatuses)
|
||||
|
||||
// 主播
|
||||
apiStreamerGroup := r.Group("/api/streamer", PrepareToC())
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func ApiCreateStreamerAuthApprovalDetails(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiCreateReq)
|
||||
ec := service.DefaultService.ApiCreateStreamerAuthApprovalDetails(ctx, req)
|
||||
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||||
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
|
||||
logger.Error("ApiCreateStreamerAuthApproval fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
|
@ -39,7 +39,7 @@ func ApiGetStreamerAuthApprovalDetailsList(ctx *gin.Context) {
|
|||
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiListReq)
|
||||
|
||||
streamerauthapprovaldetails, ec := service.DefaultService.ApiGetStreamerAuthApprovalDetailsList(ctx, req)
|
||||
if ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||||
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
|
||||
logger.Error("ApiGetStreamerAuthApprovalList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
|
@ -58,3 +58,20 @@ func ApiGetStreamerAuthApprovalDetailsList(ctx *gin.Context) {
|
|||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
||||
func ApiGetStreamerAuthApprovalApproveStatuses(ctx *gin.Context) {
|
||||
req := ctx.MustGet("client_req").(*streamerauthapprovaldetailsproto.ApiGetApproveStatusesReq)
|
||||
|
||||
basicStatus, detailsStatus, ec := service.DefaultService.GetStreamerAuthApprovalStatuses(ctx, req)
|
||||
if ec != errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk {
|
||||
logger.Error("GetStreamerAuthApprovalStatuses fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||
ReplyErrCodeMsg(ctx, ec)
|
||||
return
|
||||
}
|
||||
|
||||
data := &streamerauthapprovaldetailsproto.ApiGetApproveStatusesData{
|
||||
BasicStatus: basicStatus,
|
||||
DetailsStatus: detailsStatus,
|
||||
}
|
||||
ReplyOk(ctx, data)
|
||||
}
|
||||
|
|
|
@ -1095,6 +1095,11 @@ func (s *Service) ApiGetStreamerAuthApprovalBasicList(ctx *gin.Context, req *str
|
|||
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvFail
|
||||
return
|
||||
}
|
||||
if streamerauthapprovalbasic == nil {
|
||||
logger.Error("No streamer auth approval basic entity was found, req: %v", util.ToJson(req))
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist
|
||||
return
|
||||
}
|
||||
|
||||
account, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: streamerauthapprovalbasic.Mid,
|
||||
|
@ -1168,6 +1173,11 @@ func (s *Service) ApiGetStreamerAuthApprovalDetailsList(ctx *gin.Context, req *s
|
|||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail
|
||||
return
|
||||
}
|
||||
if streamerauthapprovaldetails == nil {
|
||||
logger.Error("No streamer auth approval details entity was found, req: %v", util.ToJson(req))
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsNotExist
|
||||
return
|
||||
}
|
||||
|
||||
account, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: streamerauthapprovaldetails.Mid,
|
||||
|
@ -1185,6 +1195,40 @@ func (s *Service) ApiGetStreamerAuthApprovalDetailsList(ctx *gin.Context, req *s
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) GetStreamerAuthApprovalStatuses(ctx *gin.Context, req *streamerauthapprovaldetailsproto.ApiGetApproveStatusesReq) (basicStatus int64, detailsStatus int64, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvOk
|
||||
|
||||
streamerauthapprovalbasic, err := _DefaultStreamerAuthApprovalBasic.OpListByMid(ctx, &streamerauthapprovalbasicproto.OpListByMidReq{
|
||||
Uid: goproto.Int64(req.BaseRequest.Mid),
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicSrvFail
|
||||
return
|
||||
}
|
||||
if streamerauthapprovalbasic == nil {
|
||||
basicStatus = consts.StreamerAuthApprovalBasicApprove_NotFound
|
||||
} else {
|
||||
basicStatus = streamerauthapprovalbasic.GetApproveStatus()
|
||||
}
|
||||
|
||||
streamerauthapprovaldetails, err := _DefaultStreamerAuthApprovalDetails.OpListByMid(ctx, &streamerauthapprovaldetailsproto.OpListByMidReq{
|
||||
Uid: goproto.Int64(req.BaseRequest.Mid),
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalDetailsSrvFail
|
||||
return
|
||||
}
|
||||
if streamerauthapprovaldetails == nil {
|
||||
detailsStatus = consts.StreamerAuthApprovalDetailsApprove_NotFound
|
||||
} else {
|
||||
detailsStatus = streamerauthapprovaldetails.GetApproveStatus()
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Streamer
|
||||
func (s *Service) ApiUpdateStreamer(ctx *gin.Context, req *streamerproto.ApiUpdateReq) (ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeStreamerSrvOk
|
||||
|
|
|
@ -1927,7 +1927,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
Remarks: req.Remarks,
|
||||
},
|
||||
Ids: req.Ids,
|
||||
ApproveStatus: consts.StreamerAuthApprovalDetailsBasic_Waiting,
|
||||
ApproveStatus: consts.StreamerAuthApprovalBasicApprove_Waiting,
|
||||
})
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalBasicNotExist
|
||||
|
@ -1941,7 +1941,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
}
|
||||
|
||||
//2.若是审批失败,则更新之后直接删除,审批失败的信息将流转到历史表里保存
|
||||
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalDetailsBasic_Rejected {
|
||||
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)
|
||||
|
@ -1960,7 +1960,7 @@ func (s *Service) OpApproveStreamerAuthApprovalBasic(ctx *gin.Context, req *stre
|
|||
}
|
||||
|
||||
//4.若是审批通过,将审批表的信息合并进主播表创建信息,并更新account表里的角色信息为准主播
|
||||
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalDetailsBasic_Passed {
|
||||
if util.DerefInt64(req.ApproveStatus) == consts.StreamerAuthApprovalBasicApprove_Passed {
|
||||
// 构建streamer信息
|
||||
streamerList := make([]*dbstruct.Streamer, len(list))
|
||||
midList := make([]int64, len(list))
|
||||
|
|
|
@ -61,6 +61,13 @@ func (p *StreamerAuthApprovalBasic) GetMid() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (p *StreamerAuthApprovalBasic) GetApproveStatus() int64 {
|
||||
if p != nil && p.ApproveStatus != nil {
|
||||
return *p.ApproveStatus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type StreamerAuthApprovalDetails struct {
|
||||
Id *int64 `json:"id" bson:"_id"` // 女神认证审批完善表id
|
||||
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
|
||||
|
@ -114,3 +121,10 @@ func (p *StreamerAuthApprovalDetails) GetStatus() int64 {
|
|||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *StreamerAuthApprovalDetails) GetApproveStatus() int64 {
|
||||
if p != nil && p.ApproveStatus != nil {
|
||||
return *p.ApproveStatus
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue