Compare commits

...

18 Commits

Author SHA1 Message Date
wangxinyu 38af424c26 fix:op主播昵称审核 2024-12-25 11:39:44 +08:00
wangxinyu c5a9102063 fix:op主播昵称审核 2024-12-25 10:41:45 +08:00
wangxinyu 47fbda1240 feat:主播修改昵称审核-op 列表 2024-12-24 15:37:23 +08:00
wangxinyu a2319ffad1 fix: 普通用户修改昵称 2024-12-18 16:54:22 +08:00
wangxinyu 44969d364a fix:昵称审核,修改头像覆盖昵称问题修复3 2024-12-17 16:30:43 +08:00
wangxinyu 8f9af23b90 fix:昵称审核,修改头像覆盖昵称问题修复3 2024-12-17 16:21:41 +08:00
wangxinyu 016ed42dca fix:昵称审核,修改头像覆盖昵称问题修复2 2024-12-17 16:17:37 +08:00
wangxinyu ee33214034 fix:昵称审核,修改头像覆盖昵称问题修复 2024-12-17 15:58:17 +08:00
wangxinyu baa10d86a2 fix: 主播修改昵称审核 名字展示 2024-12-12 11:57:20 +08:00
wangxinyu f695b1132d fix: 主播修改昵称审核 mongodb newName 2024-12-12 11:39:16 +08:00
wangxinyu 4e002b9d44 fix: 主播修改昵称审核 mongodb newName 2024-12-12 11:32:45 +08:00
wangxinyu c1be559678 fix: 主播修改昵称审核 mongodb UpdateOne 2024-12-12 11:06:59 +08:00
wangxinyu 2ec8444167 fix: 主播修改昵称审核 mongodb UpsertOne 2024-12-12 10:56:28 +08:00
wangxinyu 83cd231f76 fix: 主播修改昵称审核 upsert 2024-12-11 18:22:19 +08:00
wangxinyu 523b277364 test: 测试日志增加 2024-12-11 17:59:40 +08:00
wangxinyu 0628cc53d3 fix: 主播修改昵称 自测 数据写入失败修改 2024-12-11 17:33:40 +08:00
wangxinyu 9c4394fb34 feat: 主播昵称过人审 2024-12-11 16:44:38 +08:00
wangxinyu 1fb5625ec0 feat: 主播修改微信昵称通过人审 2024-12-10 15:56:36 +08:00
11 changed files with 156 additions and 41 deletions

View File

@ -99,6 +99,26 @@ const (
RedisMomentPrefix = "moment:" //moment服务前缀
)
// 用户表信息审核状态,按位判断
// 状态大致如下:
//
// 00昵称正常
// 01昵称违规
// 10昵称审核中
const (
AuditPass = 0 // 审核通过
StreamerNikeNameAuditReject = 1 // 主播昵称违规
StreamerNikeNameAuditing = 2 // 主播昵称审核状态
//StreamerAvatarReject = 4 // 主播头像违规
//StreamerAvatarAuditing = 8 // 主播头像审核状态
)
// 审核的维度
const (
StreamNikeAudit = 1 // 主播昵称审核
//StreamerAvatar = 2 // 主播头像审核
)
//const PackageRootPath = "C:/Users/PC/Desktop/service"
const PackageRootPath = "/app/wishpal-ironfan"

View File

@ -158,6 +158,7 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeTextAuditTaskSrvFail: "文字审核任务服务错误",
ErrCodeTextAuditTaskNotExist: "文字审核任务不存在",
ErrCodeTextAuditTaskManuallyPassFail: "文字审核人工通过失败",
ErrCodeTextAuditTaskNikeNameWait: "昵称审核中,请耐心等待",
ErrCodeContactCustomerServiceSessionSrvFail: "联系客服对话表服务错误",
ErrCodeContactCustomerServiceSessionNotExist: "联系客服对话表不存在",
@ -467,6 +468,7 @@ const (
ErrCodeTextAuditTaskSrvFail ErrCode = -23001 // 文字审核任务服务错误
ErrCodeTextAuditTaskNotExist ErrCode = -23002 // 文字审核任务不存在
ErrCodeTextAuditTaskManuallyPassFail ErrCode = -23003 // 文字审核人工通过失败
ErrCodeTextAuditTaskNikeNameWait ErrCode = -23004 // 文字审核,人工审核昵称等待
// ContactCustomerServiceSession: 24xxx
ErrCodeContactCustomerServiceSessionSrvOk ErrCode = ErrCodeOk

View File

@ -57,6 +57,7 @@ type OpListReq struct {
AssociativeTableColumn *string `json:"associative_table_column"`
BatchId *string `json:"batch_id"`
Status *int64 `json:"status"`
Role *int64 `json:"role"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Sort string

View File

@ -3886,7 +3886,7 @@ func (m *Mongo) GetTextAuditTaskList(ctx *gin.Context, req *textaudittaskproto.O
return list, err
}
func (m *Mongo) GetTextAuditTaskListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
func (m *Mongo) GetTextAuditTaskListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, role *int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
list := make([]*dbstruct.TextAuditTask, 0)
if len(databases) != len(tableNames) {

View File

@ -55,7 +55,6 @@ import (
"service/library/redis"
interceptor "service/library/taginterceptor"
"strconv"
"strings"
"time"
Raven_IQ_testproto "service/api/proto/Raven_IQ_test/proto"
@ -64,7 +63,6 @@ import (
goproto "google.golang.org/protobuf/proto"
"github.com/gin-gonic/gin"
"github.com/mozillazg/go-pinyin"
"github.com/qiniu/qmgo"
"github.com/ulule/deepcopier"
)
@ -363,30 +361,41 @@ func (s *Service) ApiUpdateAccount(ctx *gin.Context, req *accountproto.ApiUpdate
s.CreateUpdateAccountImageAudit(ctx, oldAccount, req.Account)
s.CreateUpdateAccountTextAudit(ctx, oldAccount, req.Account)
// 用户只允许修改昵称和头像
if err := _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
opUpdateReq := &accountproto.OpUpdateReq{
Account: &dbstruct.Account{
Mid: req.Account.Mid,
Name: req.Account.Name,
Avatar: req.Account.Avatar,
},
}); err != nil {
logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
}
// 主播昵称需要先过审核
if oldAccount.GetRole() == consts.Streamer && req.Account.GetName() != "" && (oldAccount.GetName() != req.Account.GetName() || oldAccount.GetNewName() != req.Account.GetNewName()) {
opUpdateReq.NewName = goproto.String(req.Account.GetName())
auditStatus := s.SetAuditStatusBitMap(oldAccount.GetAuditStatus(), consts.StreamNikeAudit, consts.StreamerNikeNameAuditing)
opUpdateReq.AuditStatus = goproto.Int64(auditStatus)
} else if oldAccount.GetName() != req.Account.GetName() && req.Account.GetName() != "" {
opUpdateReq.Name = goproto.String(req.Account.GetName())
}
// 用户只允许修改昵称和头像
if err := _DefaultAccount.OpUpdate(ctx, opUpdateReq); err != nil {
logger.Error("OpUpdateOne fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return
}
if oldAccount.GetRole() == consts.Streamer && req.Account.Name != nil {
if err := _DefaultStreamerAcct.OpUpdate(ctx, &dbstruct.EsStreamerAcct{
Mid: req.Account.GetMid(),
Name: req.Account.GetName(),
PinYin: strings.Join(pinyin.LazyConvert(req.Account.GetName(), nil), ""),
}); err != nil {
logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeAccountSrvFail
return
}
}
// 主播需要审核,暂时不需要更新 es
//if oldAccount.GetRole() == consts.Streamer && req.Account.Name != nil {
// if err := _DefaultStreamerAcct.OpUpdate(ctx, &dbstruct.EsStreamerAcct{
// Mid: req.Account.GetMid(),
// Name: req.Account.GetName(),
// PinYin: strings.Join(pinyin.LazyConvert(req.Account.GetName(), nil), ""),
// }); err != nil {
// logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err)
// ec = errcode.ErrCodeAccountSrvFail
// return
// }
//}
return
}
@ -408,6 +417,12 @@ func (s *Service) ApiGetAccountListByMid(ctx *gin.Context, req *accountproto.Api
return
}
// 主播查看的是更新之后的名字(审核失败后回退),其他用户看不到
nameFlag := s.GetAuditStatusBitMap(account.GetAuditStatus(), consts.StreamNikeAudit)
if account.GetRole() == consts.Streamer && nameFlag == consts.StreamerNikeNameAuditing && req.GetBaseRequest().Mid == account.GetMid() {
account.Name = goproto.String(account.GetNewName())
}
vo = &accountproto.ApiListVO{}
vo.CopyAccount(account)

View File

@ -87,7 +87,7 @@ func (p *TextAuditTaskDecorator) OpList(ctx *gin.Context, req *textaudittaskprot
databases = append(databases, collectionInfo.Database)
tableNames = append(tableNames, collectionInfo.TableName)
}
return p.TextAuditTask.OpListByCollectionInfos(ctx, databases, tableNames, util.DerefInt64(req.Status), req.Offset, req.Limit)
return p.TextAuditTask.OpListByCollectionInfos(ctx, databases, tableNames, util.DerefInt64(req.Status), req.Role, req.Offset, req.Limit)
}
}
return queryFunc(ctx, req)

View File

@ -65,8 +65,8 @@ func (p *TextAuditTask) OpList(ctx *gin.Context, req *textaudittaskproto.OpListR
return list, nil
}
func (p *TextAuditTask) OpListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
list, err := p.store.GetTextAuditTaskListByCollectionInfos(ctx, databases, tableNames, status, offset, limit)
func (p *TextAuditTask) OpListByCollectionInfos(ctx *gin.Context, databases []string, tableNames []string, status int64, role *int64, offset, limit int) ([]*dbstruct.TextAuditTask, error) {
list, err := p.store.GetTextAuditTaskListByCollectionInfos(ctx, databases, tableNames, status, role, offset, limit)
if err != nil {
logger.Error("GetTextAuditTaskListByCollectionInfos fail, err: %v", err)
return make([]*dbstruct.TextAuditTask, 0), err

View File

@ -3337,6 +3337,18 @@ func (s *Service) OpGetTextAuditTaskVOList(ctx *gin.Context, req *textaudittaskp
return
}
// 主播昵称审核
if req.Role != nil && *req.Role == consts.Streamer {
filterVoList := make([]*textaudittaskproto.TextAuditTaskVO, 0)
for _, vo := range volist {
account := acctMp[vo.GetMid()]
if account != nil && account.GetRole() == consts.Streamer {
filterVoList = append(filterVoList, vo)
}
}
volist = filterVoList
}
for _, vo := range volist {
vo.Account = &accountproto.OpListVO{}
vo.Account.CopyAccount(acctMp[vo.GetMid()])

View File

@ -244,3 +244,35 @@ func addTextAuditTask(ctx *gin.Context, task *dbstruct.TextAuditTask, options ..
}
return nil
}
// 获取用户主播的审核信息
func (s *Service) GetAuditStatusBitMap(auditStatus int64, auditType int) int {
switch auditType {
case consts.StreamNikeAudit:
return int(auditStatus & consts.StreamerNikeNameAuditing)
}
return -1
}
// 设置用户主播的审核信息
func (s *Service) SetAuditStatusBitMap(auditStatus int64, auditType int, flag int) int64 {
if auditType < 0 {
return auditStatus
}
switch auditType {
case consts.StreamNikeAudit:
if flag == consts.StreamerNikeNameAuditing {
auditStatus |= consts.StreamerNikeNameAuditing
} else if flag == consts.StreamerNikeNameAuditReject {
auditStatus |= consts.StreamerNikeNameAuditReject
auditStatus &^= consts.StreamerNikeNameAuditing
} else {
auditStatus &^= consts.StreamerNikeNameAuditReject
auditStatus &^= consts.StreamerNikeNameAuditing
}
}
return auditStatus
}

View File

@ -19,6 +19,7 @@ import (
)
var DefaultTextAuditTaskResultHandler *TextAuditTaskResultHandler
var s *Service
type TextAuditTaskResultHandler struct {
// 图像审核任务通过及回退方法生成器map
@ -72,24 +73,6 @@ func (handler *TextAuditTaskResultHandler) generateAccountNameUpdateFunc() {
}
mid := task.AssociativeTableId
var name *string
if option == consts.TextAuditTaskUpdate_Pass {
name = task.AuditedText
} else {
name = task.OldText
}
err := _DefaultAccount.OpUpdate(ctx, &accountproto.OpUpdateReq{
Account: &dbstruct.Account{
Mid: mid,
Name: name,
},
})
if err != nil {
return err
}
acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{
Mid: mid,
})
@ -97,7 +80,41 @@ func (handler *TextAuditTaskResultHandler) generateAccountNameUpdateFunc() {
return err
}
if acct.GetRole() == consts.Streamer {
// TODO:wxy, 待优化
var name *string
var auditStatus = int64(-1)
if acct.GetRole() == consts.Streamer && option == consts.TextAuditTaskUpdate_Pass {
// 主播昵称人审通过
name = task.AuditedText
auditStatus = s.SetAuditStatusBitMap(acct.GetAuditStatus(), consts.StreamNikeAudit, consts.AuditPass)
} else if acct.GetRole() == consts.Streamer && option == consts.TextAuditTaskUpdate_Reject {
// 主播昵称人审拒绝
name = task.OldText
auditStatus = s.SetAuditStatusBitMap(acct.GetAuditStatus(), consts.StreamNikeAudit, consts.StreamerNikeNameAuditReject)
} else if acct.GetRole() != consts.Streamer && option == consts.TextAuditTaskUpdate_Pass {
name = task.AuditedText
} else {
name = task.OldText
}
opUpdateReq := &accountproto.OpUpdateReq{
Account: &dbstruct.Account{
Mid: mid,
Name: name,
},
}
if auditStatus != -1 {
opUpdateReq.AuditStatus = goproto.Int64(auditStatus)
}
err = _DefaultAccount.OpUpdate(ctx, opUpdateReq)
if err != nil {
return err
}
// 更新 es
if acct.GetRole() == consts.Streamer && option == consts.TextAuditTaskUpdate_Pass {
return _DefaultStreamerAcct.OpUpdate(ctx, &dbstruct.EsStreamerAcct{
Mid: util.DerefInt64(mid),
Name: util.DerefString(name),

View File

@ -8,6 +8,7 @@ const (
type Account struct {
Mid *int64 `json:"mid" bson:"_id"` // 用户表Id
Name *string `json:"name" bson:"name"` // 用户名
NewName *string `json:"new_name" bson:"new_name"` // 用户修改后的名字(主播昵称需要审核,用来更新)
UserId *int64 `json:"user_id" bson:"user_id"` // 业务Id
Avatar *MediaComponent `json:"avatar" bson:"avatar"` // 头像
MobilePhone *string `json:"mobile_phone" bson:"mobile_phone" jcrypto:"rsa" bcrypto:"aes_cbc|1|0"` // 手机号,数据库加密,查询不解密
@ -24,6 +25,7 @@ type Account struct {
IsAMember *int64 `json:"is_a_member" bson:"is_a_member"` // 是否是会员0-否1-是
Status *int64 `json:"status" bson:"status"` // 账户状态0-正常1-账户注销中2-账户已注销
DevType *int32 `bson:"dev_type"` // 注册来源
AuditStatus *int64 `json:"audit_status" bson:"audit_status"` // 审核状态
Latitude *float64 `bson:"latitude"` // 纬度
Longitude *float64 `bson:"longitude"` // 经度
UserIdString *string `json:"user_id_string" bson:"user_id_string"` // string型user_id为模糊匹配设置
@ -46,6 +48,13 @@ func (p *Account) GetName() string {
return *p.Name
}
func (p *Account) GetNewName() string {
if p == nil || p.NewName == nil {
return ""
}
return *p.NewName
}
func (p *Account) GetUserId() int64 {
if p == nil || p.UserId == nil {
return 0
@ -88,6 +97,13 @@ func (p *Account) GetRole() int64 {
return *p.Role
}
func (p *Account) GetAuditStatus() int64 {
if p == nil || p.AuditStatus == nil {
return 0
}
return *p.AuditStatus
}
// StreamerAcct 用户结构
type StreamerAcct struct {
Mid *int64 `json:"mid" bson:"_id"` // 用户表Id