Merge pull request 'by Robin at 20240501' (#400) from feat-IRONFANS-70 into test
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/400
This commit is contained in:
commit
e3ae837488
|
@ -2,6 +2,7 @@ package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
imageaudittaskproto "service/api/proto/imageaudittask/proto"
|
imageaudittaskproto "service/api/proto/imageaudittask/proto"
|
||||||
|
streamerproto "service/api/proto/streamer/proto"
|
||||||
textaudittaskproto "service/api/proto/textaudittask/proto"
|
textaudittaskproto "service/api/proto/textaudittask/proto"
|
||||||
"service/dbstruct"
|
"service/dbstruct"
|
||||||
)
|
)
|
||||||
|
@ -10,4 +11,5 @@ type MomentAuditTaskVO struct {
|
||||||
MomentAuditTask *dbstruct.MomentAuditTask `json:"moment_audit_task"`
|
MomentAuditTask *dbstruct.MomentAuditTask `json:"moment_audit_task"`
|
||||||
ImageAuditTaskVO *imageaudittaskproto.ImageAuditTaskVO `json:"image_audit_task_vo"`
|
ImageAuditTaskVO *imageaudittaskproto.ImageAuditTaskVO `json:"image_audit_task_vo"`
|
||||||
TextAuditTaskVO *textaudittaskproto.TextAuditTaskVO `json:"text_audit_task_vo"`
|
TextAuditTaskVO *textaudittaskproto.TextAuditTaskVO `json:"text_audit_task_vo"`
|
||||||
|
StreamerExt *streamerproto.OpListExtVO `json:"streamer_ext"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1542,7 +1542,7 @@ func (m *Mongo) GetDeletedMomentList(ctx *gin.Context, req *momentproto.OpListRe
|
||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mongo) GetMomentListByIds(ctx *gin.Context, req *momentproto.OpListByIdsReq) ([]*dbstruct.Moment, error) {
|
func (m *Mongo) GetPublicMomentListByIds(ctx *gin.Context, req *momentproto.OpListByIdsReq) ([]*dbstruct.Moment, error) {
|
||||||
list := make([]*dbstruct.Moment, 0)
|
list := make([]*dbstruct.Moment, 0)
|
||||||
col := m.getColMoment()
|
col := m.getColMoment()
|
||||||
query := qmgo.M{
|
query := qmgo.M{
|
||||||
|
@ -1560,6 +1560,23 @@ func (m *Mongo) GetMomentListByIds(ctx *gin.Context, req *momentproto.OpListById
|
||||||
return list, err
|
return list, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mongo) GetMomentListByIds(ctx *gin.Context, momentIds []int64) ([]*dbstruct.Moment, error) {
|
||||||
|
list := make([]*dbstruct.Moment, 0)
|
||||||
|
col := m.getColMoment()
|
||||||
|
query := qmgo.M{
|
||||||
|
"_id": qmgo.M{
|
||||||
|
"$in": momentIds,
|
||||||
|
},
|
||||||
|
"del_flag": 0,
|
||||||
|
}
|
||||||
|
err := col.Find(ctx, query).Sort("_id").All(&list)
|
||||||
|
if err == qmgo.ErrNoSuchDocuments {
|
||||||
|
err = nil
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
return list, err
|
||||||
|
}
|
||||||
|
|
||||||
// 查私有动态接口
|
// 查私有动态接口
|
||||||
func (m *Mongo) GetMomentListByMid(ctx *gin.Context, req *momentproto.OpListByMidReq) ([]*dbstruct.Moment, error) {
|
func (m *Mongo) GetMomentListByMid(ctx *gin.Context, req *momentproto.OpListByMidReq) ([]*dbstruct.Moment, error) {
|
||||||
list := make([]*dbstruct.Moment, 0)
|
list := make([]*dbstruct.Moment, 0)
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"service/api/consts"
|
"service/api/consts"
|
||||||
momentproto "service/api/proto/moment/proto"
|
momentproto "service/api/proto/moment/proto"
|
||||||
"service/app/mix/dao"
|
"service/app/mix/dao"
|
||||||
"service/dbstruct"
|
"service/dbstruct"
|
||||||
"service/library/logger"
|
"service/library/logger"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
@ -83,9 +85,9 @@ func (p *Moment) OpListDeleted(ctx *gin.Context, req *momentproto.OpListReq) ([]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Moment) OpListByIds(ctx *gin.Context, req *momentproto.OpListByIdsReq) ([]*dbstruct.Moment, error) {
|
func (p *Moment) OpListByIds(ctx *gin.Context, req *momentproto.OpListByIdsReq) ([]*dbstruct.Moment, error) {
|
||||||
list, err := p.store.GetMomentListByIds(ctx, req)
|
list, err := p.store.GetPublicMomentListByIds(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("GetMomentListByIds fail, err: %v", err)
|
logger.Error("GetPublicMomentListByIds fail, err: %v", err)
|
||||||
return make([]*dbstruct.Moment, 0), err
|
return make([]*dbstruct.Moment, 0), err
|
||||||
}
|
}
|
||||||
return list, nil
|
return list, nil
|
||||||
|
@ -138,3 +140,29 @@ func (p *Moment) OpUpdateByIdsAndStatus(ctx *gin.Context, req *momentproto.OpUpd
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Moment) GetMomentStringIdMapByIds(ctx *gin.Context, momentIdStrs []string) (map[string]*dbstruct.Moment, error) {
|
||||||
|
|
||||||
|
momentIds := make([]int64, 0)
|
||||||
|
for _, momentIdStr := range momentIdStrs {
|
||||||
|
momentId, err := strconv.Atoi(momentIdStr)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("Assert fail, err: %v", err)
|
||||||
|
return make(map[string]*dbstruct.Moment), err
|
||||||
|
}
|
||||||
|
momentIds = append(momentIds, int64(momentId))
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := p.store.GetMomentListByIds(ctx, momentIds)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("GetMomentListByIds fail, err: %v", err)
|
||||||
|
return make(map[string]*dbstruct.Moment), err
|
||||||
|
}
|
||||||
|
|
||||||
|
mp := make(map[string]*dbstruct.Moment)
|
||||||
|
for _, moment := range list {
|
||||||
|
mp[fmt.Sprint(moment.GetId())] = moment
|
||||||
|
}
|
||||||
|
|
||||||
|
return mp, nil
|
||||||
|
}
|
||||||
|
|
|
@ -2813,9 +2813,16 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t
|
||||||
// 收集图像和文字审核的id,分别查询出图像和文字审核的任务
|
// 收集图像和文字审核的id,分别查询出图像和文字审核的任务
|
||||||
imageAuditTaskIds := make([]string, 0)
|
imageAuditTaskIds := make([]string, 0)
|
||||||
textAuditTaskIds := make([]string, 0)
|
textAuditTaskIds := make([]string, 0)
|
||||||
|
momentIdSet := make(map[string]*dbstruct.Moment)
|
||||||
|
momentIds := make([]string, 0)
|
||||||
for _, task := range list {
|
for _, task := range list {
|
||||||
imageAuditTaskIds = append(imageAuditTaskIds, util.DerefString(task.ImageAuditTaskId))
|
imageAuditTaskIds = append(imageAuditTaskIds, util.DerefString(task.ImageAuditTaskId))
|
||||||
textAuditTaskIds = append(textAuditTaskIds, util.DerefString(task.TextAuditTaskId))
|
textAuditTaskIds = append(textAuditTaskIds, util.DerefString(task.TextAuditTaskId))
|
||||||
|
momentId := task.GetAssociativeTableId()
|
||||||
|
if momentIdSet[momentId] == nil {
|
||||||
|
momentIdSet[momentId] = &dbstruct.Moment{}
|
||||||
|
momentIds = append(momentIds, momentId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
imageAuditTaskMap, err := _DefaultImageAuditTask.OpGetImageAuditTaskMapByIds(ctx, imageAuditTaskIds)
|
imageAuditTaskMap, err := _DefaultImageAuditTask.OpGetImageAuditTaskMapByIds(ctx, imageAuditTaskIds)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2829,6 +2836,27 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t
|
||||||
ec = errcode.ErrCodeTextAuditTaskSrvFail
|
ec = errcode.ErrCodeTextAuditTaskSrvFail
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
momentMp, err := _DefaultMoment.GetMomentStringIdMapByIds(ctx, momentIds)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("GetMomentStringIdMapByIds fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
|
ec = errcode.ErrCodeMomentSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
midSet := make(map[int64]*dbstruct.Moment)
|
||||||
|
mids := make([]int64, 0)
|
||||||
|
for _, v := range momentMp {
|
||||||
|
mid := v.GetMid()
|
||||||
|
if midSet[mid] == nil {
|
||||||
|
midSet[mid] = &dbstruct.Moment{}
|
||||||
|
mids = append(mids, mid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
streamerMp, err := s.utilGetStreamerExtMapByMids(ctx, mids, consts.InterfaceType_Op)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("utilGetStreamerExtMapByMids fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
|
ec = errcode.ErrCodeAccountSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for i, task := range list {
|
for i, task := range list {
|
||||||
imageAuditTaskId := imageAuditTaskIds[i]
|
imageAuditTaskId := imageAuditTaskIds[i]
|
||||||
|
@ -2849,10 +2877,13 @@ func (s *Service) OpGetMomentAuditTaskList(ctx *gin.Context, req *moment_audit_t
|
||||||
ec = errcode.ErrCodeTextAuditSrvFail
|
ec = errcode.ErrCodeTextAuditSrvFail
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
streamerExt := streamerMp[momentMp[task.GetAssociativeTableId()].GetMid()].(*streamerproto.OpListExtVO)
|
||||||
volist[i] = &moment_audit_taskproto.MomentAuditTaskVO{
|
volist[i] = &moment_audit_taskproto.MomentAuditTaskVO{
|
||||||
MomentAuditTask: task,
|
MomentAuditTask: task,
|
||||||
ImageAuditTaskVO: imageAuditTaskVO,
|
ImageAuditTaskVO: imageAuditTaskVO,
|
||||||
TextAuditTaskVO: textAuditTaskVO,
|
TextAuditTaskVO: textAuditTaskVO,
|
||||||
|
StreamerExt: streamerExt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,10 @@ func (p *Moment) GetMid() int64 {
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Moment) GetId() int64 {
|
||||||
|
if p != nil && p.Id != nil {
|
||||||
|
return util.DerefInt64(p.Id)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
|
@ -20,3 +20,10 @@ type MomentAuditTask struct {
|
||||||
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *MomentAuditTask) GetAssociativeTableId() string {
|
||||||
|
if p == nil || p.AssociativeTableId == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return *p.AssociativeTableId
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue