by Robin at 20231224; userId
This commit is contained in:
parent
be71d1b97e
commit
4faacbd342
|
@ -40,7 +40,7 @@ type ApiListReq struct {
|
|||
}
|
||||
|
||||
type ApiListData struct {
|
||||
StreamerAuthApproval *dbstruct.StreamerAuthApproval `json:"streamer_auth_approval"`
|
||||
StreamerAuthApproval *StreamerAuthApprovalApiVO `json:"streamer_auth_approval"`
|
||||
}
|
||||
|
||||
type ApiListResp struct {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package proto
|
||||
|
||||
import "service/dbstruct"
|
||||
|
||||
type StreamerAuthApprovalApiVO struct {
|
||||
*dbstruct.StreamerAuthApproval
|
||||
UserId *int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
func (vo *StreamerAuthApprovalApiVO) CopyStreamerAuthApproval(streamerauthapproval *dbstruct.StreamerAuthApproval) *StreamerAuthApprovalApiVO {
|
||||
vo.StreamerAuthApproval = streamerauthapproval
|
||||
return vo
|
||||
}
|
||||
|
||||
func (vo *StreamerAuthApprovalApiVO) CopyAccount(account *dbstruct.Account) *StreamerAuthApprovalApiVO {
|
||||
vo.UserId = account.UserId
|
||||
return vo
|
||||
}
|
|
@ -56,9 +56,9 @@ type OpListReq struct {
|
|||
}
|
||||
|
||||
type OpListData struct {
|
||||
List []*dbstruct.StreamerAuthApproval `json:"list"`
|
||||
Offset int `json:"offset"`
|
||||
More int `json:"more"`
|
||||
List []*StreamerAuthApprovalOpVO `json:"list"`
|
||||
Offset int `json:"offset"`
|
||||
More int `json:"more"`
|
||||
}
|
||||
|
||||
type OpListResp struct {
|
||||
|
@ -75,9 +75,9 @@ type OpListByMidReq struct {
|
|||
}
|
||||
|
||||
type OpListByMidData struct {
|
||||
StreamerAuthApproval *dbstruct.StreamerAuthApproval `json:"streamer_auth_approval"`
|
||||
Offset int `json:"offset"`
|
||||
More int `json:"more"`
|
||||
StreamerAuthApproval *StreamerAuthApprovalOpVO `json:"streamer_auth_approval"`
|
||||
Offset int `json:"offset"`
|
||||
More int `json:"more"`
|
||||
}
|
||||
|
||||
type OpListByMidResp struct {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package proto
|
||||
|
||||
import "service/dbstruct"
|
||||
|
||||
type StreamerAuthApprovalOpVO struct {
|
||||
*dbstruct.StreamerAuthApproval
|
||||
UserId *int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
func (vo *StreamerAuthApprovalOpVO) CopyStreamerAuthApproval(streamerauthapproval *dbstruct.StreamerAuthApproval) *StreamerAuthApprovalOpVO {
|
||||
vo.StreamerAuthApproval = streamerauthapproval
|
||||
return vo
|
||||
}
|
||||
|
||||
func (vo *StreamerAuthApprovalOpVO) CopyAccount(account *dbstruct.Account) *StreamerAuthApprovalOpVO {
|
||||
vo.UserId = account.UserId
|
||||
return vo
|
||||
}
|
|
@ -834,7 +834,7 @@ func (s *Service) ApiDeleteStreamerAuthApproval(ctx *gin.Context, req *streamera
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Service) ApiGetStreamerAuthApprovalList(ctx *gin.Context, req *streamerauthapprovalproto.ApiListReq) (streamerauthapproval *dbstruct.StreamerAuthApproval, ec errcode.ErrCode) {
|
||||
func (s *Service) ApiGetStreamerAuthApprovalList(ctx *gin.Context, req *streamerauthapprovalproto.ApiListReq) (vo *streamerauthapprovalproto.StreamerAuthApprovalApiVO, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalSrvOk
|
||||
|
||||
if ec = s.ApiGetStreamerAuthApprovalListBusinessValidate(ctx, req); ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||||
|
@ -849,6 +849,20 @@ func (s *Service) ApiGetStreamerAuthApprovalList(ctx *gin.Context, req *streamer
|
|||
ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
account, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
|
||||
Mid: streamerauthapproval.Mid,
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeAccountSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
vo = &streamerauthapprovalproto.StreamerAuthApprovalApiVO{}
|
||||
vo.CopyStreamerAuthApproval(streamerauthapproval)
|
||||
vo.CopyAccount(account)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1232,52 +1232,7 @@ func (s *Service) OpGetAccountRelationBySentence(ctx *gin.Context, req *accountr
|
|||
return
|
||||
}
|
||||
|
||||
// StreamerAuthApproval
|
||||
// func (s *Service) OpCreateStreamerAuthApproval(ctx *gin.Context, req *streamerauthapprovalproto.OpCreateReq) (ec errcode.ErrCode) {
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvOk
|
||||
// err := _DefaultStreamerAuthApproval.OpCreate(ctx, req)
|
||||
|
||||
// if mongo.IsDuplicateKeyError(err) {
|
||||
// logger.Error("OpCreate duplicate key found, req: %v, err: %v", util.ToJson(req), err)
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalDuplicateKey
|
||||
// return
|
||||
// }
|
||||
// if err != nil {
|
||||
// logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// func (s *Service) OpUpdateStreamerAuthApproval(ctx *gin.Context, req *streamerauthapprovalproto.OpUpdateReq) (ec errcode.ErrCode) {
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvOk
|
||||
// err := _DefaultStreamerAuthApproval.OpUpdate(ctx, req)
|
||||
// if err == qmgo.ErrNoSuchDocuments {
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalNotExist
|
||||
// err = nil
|
||||
// return
|
||||
// }
|
||||
// if err != nil {
|
||||
// logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
// func (s *Service) OpDeleteBatchStreamerAuthApproval(ctx *gin.Context, ids []int64) (ec errcode.ErrCode) {
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvOk
|
||||
// err := _DefaultStreamerAuthApproval.OpDeleteBatch(ctx, ids)
|
||||
// if err != nil {
|
||||
// logger.Error("OpDeleteBatch fail, ids: %v, err: %v", ids, err)
|
||||
// ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
func (s *Service) OpGetStreamerAuthApprovalList(ctx *gin.Context, req *streamerauthapprovalproto.OpListReq) (list []*dbstruct.StreamerAuthApproval, ec errcode.ErrCode) {
|
||||
func (s *Service) OpGetStreamerAuthApprovalList(ctx *gin.Context, req *streamerauthapprovalproto.OpListReq) (volist []*streamerauthapprovalproto.StreamerAuthApprovalOpVO, ec errcode.ErrCode) {
|
||||
ec = errcode.ErrCodeStreamerAuthApprovalSrvOk
|
||||
|
||||
if ec = s.OpGetStreamerAuthApprovalListBusinessValidate(ctx, req); ec != errcode.ErrCodeStreamerAuthApprovalSrvOk {
|
||||
|
@ -1290,6 +1245,26 @@ func (s *Service) OpGetStreamerAuthApprovalList(ctx *gin.Context, req *streamera
|
|||
ec = errcode.ErrCodeStreamerAuthApprovalSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
//查询获得userId
|
||||
midList := make([]int64, len(list))
|
||||
for i, v := range list {
|
||||
midList[i] = util.DerefInt64(v.Mid)
|
||||
}
|
||||
_map, err := _DefaultAccount.GetAccountMapByMids(ctx, midList)
|
||||
if err != nil {
|
||||
logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err)
|
||||
ec = errcode.ErrCodeAccountSrvFail
|
||||
return
|
||||
}
|
||||
|
||||
volist = make([]*streamerauthapprovalproto.StreamerAuthApprovalOpVO, len(list))
|
||||
for i, streamerauthapproval := range list {
|
||||
volist[i] = &streamerauthapprovalproto.StreamerAuthApprovalOpVO{}
|
||||
volist[i].CopyStreamerAuthApproval(streamerauthapproval)
|
||||
volist[i].CopyAccount(_map[util.DerefInt64(volist[i].Mid)])
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue