From 81916b58bb01a89281fad69611f2c705e2724b32 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 12 Mar 2024 12:06:45 +0800 Subject: [PATCH 1/5] by Robin at 20240312; apply --- api/consts/option.go | 4 + api/consts/role.go | 4 + api/consts/status.go | 7 + api/errcode/errcode.go | 33 +++- .../proto/accountpunishment_op.go | 98 ++++++++++ .../proto/accountpunishment_vo_op.go | 11 ++ .../proto/not_null_def_op.go | 20 ++ app/mix/controller/accountpunishment_op.go | 95 ++++++++++ app/mix/controller/init.go | 16 ++ app/mix/controller/moment_api.go | 7 +- app/mix/dao/mongo.go | 119 ++++++++++++ app/mix/dao/mongo_idseq.go | 27 +++ app/mix/service/apiservice.go | 11 +- .../service/apiservice_business_validation.go | 6 +- app/mix/service/business_validator/auth.go | 83 +++++++++ app/mix/service/logic/accountpunishment.go | 103 +++++++++++ .../service/opservice_business_validation.go | 76 ++++++++ app/mix/service/service.go | 171 ++++++++++++++++++ codecreate/codecreate.go | 8 +- codecreate/consts/consts.go | 2 +- codecreate/resource/EntityDefine.xlsx | Bin 43796 -> 45070 bytes codecreate/template/mongo.txt | 17 -- dbstruct/accountpunishment.go | 25 +++ dbstruct/idSeq.go | 4 + etc/mix/mix-test.yaml | 2 +- 25 files changed, 913 insertions(+), 36 deletions(-) create mode 100644 api/proto/accountpunishment/proto/accountpunishment_op.go create mode 100644 api/proto/accountpunishment/proto/accountpunishment_vo_op.go create mode 100644 api/proto/accountpunishment/proto/not_null_def_op.go create mode 100644 app/mix/controller/accountpunishment_op.go create mode 100644 app/mix/service/logic/accountpunishment.go create mode 100644 dbstruct/accountpunishment.go diff --git a/api/consts/option.go b/api/consts/option.go index 106c1f3e..ba31b497 100644 --- a/api/consts/option.go +++ b/api/consts/option.go @@ -9,3 +9,7 @@ const ( TextAuditTaskUpdate_Pass = 0 TextAuditTaskUpdate_Rollback = 1 ) + +const ( + AccountPunishment_BlockFromCreatingMoment = 0 // 禁止发贴 +) diff --git a/api/consts/role.go b/api/consts/role.go index 6786a55f..dbe17db3 100644 --- a/api/consts/role.go +++ b/api/consts/role.go @@ -13,3 +13,7 @@ const ( Supportor = 2 //运营 Streamer = 3 //主播 ) + +var AccountPunishmentRoleMap = map[int64][]int64{ + AccountPunishment_BlockFromCreatingMoment: {Streamer}, +} diff --git a/api/consts/status.go b/api/consts/status.go index 2fb13e0e..7e73c599 100644 --- a/api/consts/status.go +++ b/api/consts/status.go @@ -117,3 +117,10 @@ const ( TextAuditIsAligned_No = 0 //否 TextAuditIsAligned_Yes = 1 //是 ) + +// 账号处罚状态 +const ( + AccountPunishment_Punishing = 0 //处罚中 + AccountPunishment_Finished = 1 //正常结束 + AccountPunishment_Interrupted = 2 //提前中止 +) diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 9bf99398..428a6908 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -63,8 +63,9 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeVasAlipayUniTransferFail: "支付宝提现失败", ErrCodeVasOverTodayWithdrawCnt: "今日提现次数到达上限", - ErrCodeMomentSrvFail: "动态服务错误", - ErrCodeMomentNotExist: "动态不存在", + ErrCodeMomentSrvFail: "动态服务错误", + ErrCodeMomentNotExist: "动态不存在", + ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v", ErrCodeFootPrintSrvFail: "足迹服务错误", ErrCodeFootPrintNotExist: "足迹不存在", @@ -150,6 +151,13 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeMomentAuditTaskSrvFail: "动态审核任务表服务错误", ErrCodeMomentAuditTaskNotExist: "动态审核任务表不存在", + + ErrCodeAccountPunishmentSrvFail: "账号处罚服务错误", + ErrCodeAccountPunishmentNotExist: "账号处罚不存在", + ErrCodeAccountPunishmentDuplicateKey: "该账号已有该类型处罚,若要更改处罚时长,请先中止当前处罚!", + ErrCodeAccountPunishmentHasFinished: "账号处罚已正常结束,无法执行该操作!", + ErrCodeAccountPunishmentHasBeenInterrupted: "账号处罚已提前中止,无法执行该操作!", + ErrCodeAccountPunishmentStreamerOnly: "该账号处罚行为仅能对主播进行!", } const ( @@ -204,8 +212,8 @@ const ( ErrCodeAccountSrvOk ErrCode = ErrCodeOk ErrCodeAccountSrvFail ErrCode = -6001 //账户服务错误 ErrCodeAccountNotExist ErrCode = -6002 //账户信息不存在 - ErrCodeAccountInviterNotExist ErrCode = -6003 //邀请人不存在, - ErrCodeAccountInviterIsNotAStreamer ErrCode = -6004 //邀请人非主播, + ErrCodeAccountInviterNotExist ErrCode = -6003 //邀请人不存在 + ErrCodeAccountInviterIsNotAStreamer ErrCode = -6004 //邀请人非主播 // Vas: 7xxx ErrCodeVasSrvOk ErrCode = ErrCodeOk @@ -233,9 +241,10 @@ const ( ErrCodeVasOverTodayWithdrawCnt ErrCode = -7022 // 今天提现次数到达上限 // Moment: 8xxx - ErrCodeMomentSrvOk ErrCode = ErrCodeOk - ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 - ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 + ErrCodeMomentSrvOk ErrCode = ErrCodeOk + ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 + ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 + ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 // FootPrint: 9xxx ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk @@ -358,6 +367,16 @@ const ( ErrCodeMomentAuditTaskSrvFail ErrCode = -29001 // 动态审核任务表服务错误 ErrCodeMomentAuditTaskNotExist ErrCode = -29002 // 动态审核任务表不存在 + // AccountPunishment: 32xxx + ErrCodeAccountPunishmentSrvOk ErrCode = ErrCodeOk + ErrCodeAccountPunishmentSrvFail ErrCode = -32001 // 账号处罚服务错误 + ErrCodeAccountPunishmentNotExist ErrCode = -32002 // 账号处罚不存在 + ErrCodeAccountPunishmentExist ErrCode = -32003 // 账号处罚存在 + ErrCodeAccountPunishmentDuplicateKey ErrCode = -32004 // 账号处罚重复创建 + ErrCodeAccountPunishmentHasFinished ErrCode = -32005 // 账号处罚已正常结束 + ErrCodeAccountPunishmentHasBeenInterrupted ErrCode = -32006 // 账号处罚已提前中止 + ErrCodeAccountPunishmentStreamerOnly ErrCode = -32007 // 该账号处罚仅能对主播进行 + // Media: 60xxx ErrCodeMediaSrvOk ErrCode = ErrCodeOk ErrCodeMediaSrvFail ErrCode = -60001 // 媒体服务错误 diff --git a/api/proto/accountpunishment/proto/accountpunishment_op.go b/api/proto/accountpunishment/proto/accountpunishment_op.go new file mode 100644 index 00000000..2fd83a0c --- /dev/null +++ b/api/proto/accountpunishment/proto/accountpunishment_op.go @@ -0,0 +1,98 @@ +package proto + +import ( + "service/api/base" + "service/dbstruct" +) + +// op 创建 +type OpCreateReq struct { + base.BaseRequest + *dbstruct.AccountPunishment +} + +type OpCreateData struct { +} + +type OpCreateResp struct { + base.BaseResponse + Data *OpCreateData `json:"data"` +} + +// op 删除 +type OpDeleteReq struct { + base.BaseRequest + Id int64 `json:"id"` +} + +type OpDeleteData struct { +} + +type OpDeleteResp struct { + base.BaseResponse + Data *OpDeleteData `json:"data"` +} + +// op 更新 +type OpUpdateReq struct { + base.BaseRequest + *dbstruct.AccountPunishment +} + +type OpUpdateData struct { +} + +type OpUpdateResp struct { + base.BaseResponse + Data *OpUpdateData `json:"data"` +} + +// op 列表 +type OpListReq struct { + base.BaseRequest + Offset int `json:"offset"` + Limit int `json:"limit"` +} + +type OpListData struct { + List []*OpAccountPunishmentVO `json:"list"` + Offset int `json:"offset"` + More int `json:"more"` +} + +type OpListResp struct { + base.BaseResponse + Data *OpListData `json:"data"` +} + +// op 解封 +type OpUnblockReq struct { + base.BaseRequest + Id *int64 `json:"id"` +} + +type OpUnblockData struct { +} + +type OpUnblockResp struct { + base.BaseResponse + Data *OpUnblockData `json:"data"` +} + +// op 查询已结束的封禁 +type OpListTerminatedReq struct { + base.BaseRequest + Offset int `json:"offset"` + Limit int `json:"limit"` +} + +type OpListTerminatedData struct { + List []*OpAccountPunishmentVO `json:"list"` + Offset int `json:"offset"` + More int `json:"more"` +} + +type OpListTerminatedResp struct { + base.BaseResponse + Data *OpListTerminatedData `json:"data"` +} diff --git a/api/proto/accountpunishment/proto/accountpunishment_vo_op.go b/api/proto/accountpunishment/proto/accountpunishment_vo_op.go new file mode 100644 index 00000000..8f3980a1 --- /dev/null +++ b/api/proto/accountpunishment/proto/accountpunishment_vo_op.go @@ -0,0 +1,11 @@ +package proto + +import ( + accountproto "service/api/proto/account/proto" + "service/dbstruct" +) + +type OpAccountPunishmentVO struct { + Account *accountproto.OpListVO `json:"account"` + List []*dbstruct.AccountPunishment `json:"account_punishments"` +} diff --git a/api/proto/accountpunishment/proto/not_null_def_op.go b/api/proto/accountpunishment/proto/not_null_def_op.go new file mode 100644 index 00000000..e7cbdda0 --- /dev/null +++ b/api/proto/accountpunishment/proto/not_null_def_op.go @@ -0,0 +1,20 @@ +package proto + +import ( + "service/library/validator" +) + +// op 创建 +func (p *OpCreateReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + params = append(params, validator.NewInt64PtrParam("请填写欲进行处罚的账号mid", p.AccountPunishment.Mid)) + params = append(params, validator.NewInt64PtrParam("请填写欲进行的处罚类型", p.AccountPunishment.Type)) + params = append(params, validator.NewInt64PtrParam("请填写处罚时长", p.AccountPunishment.Duration)) + return params +} + +func (p *OpUnblockReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + params = append(params, validator.NewInt64PtrParam("请填写欲进行解封的账号处罚表id", p.Id)) + return params +} diff --git a/app/mix/controller/accountpunishment_op.go b/app/mix/controller/accountpunishment_op.go new file mode 100644 index 00000000..b8ceccb1 --- /dev/null +++ b/app/mix/controller/accountpunishment_op.go @@ -0,0 +1,95 @@ +package controller + +import ( + "service/api/consts" + "service/api/errcode" + accountpunishmentproto "service/api/proto/accountpunishment/proto" + "service/app/mix/service" + "service/bizcommon/util" + "service/library/logger" + "service/library/mediafiller" + + "github.com/gin-gonic/gin" +) + +func OpCreateAccountPunishment(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*accountpunishmentproto.OpCreateReq) + ec := service.DefaultService.OpCreateAccountPunishment(ctx, req) + if ec != errcode.ErrCodeAccountPunishmentSrvOk { + logger.Error("OpCreateAccountPunishment fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + ReplyOk(ctx, nil) +} + +func OpGetAccountPunishmentList(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*accountpunishmentproto.OpListReq) + + //设置默认页长 + if req.Limit == 0 { + req.Limit = consts.DefaultPageSize + } + + list, ec := service.DefaultService.OpGetAccountPunishmentList(ctx, req) + if ec != errcode.ErrCodeAccountPunishmentSrvOk { + logger.Error("OpGetAccountPunishmentList fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + //填充媒体切片 + objectMediaNum := 1 // 单个账号封禁服务总共1个媒体类 + mediafillables := make([]mediafiller.MediaFillable, len(list)*objectMediaNum) + for i, vo := range list { + mediafillables[objectMediaNum*i+0] = vo.Account.Avatar + } + mediafiller.FillList(ctx, mediafillables) + + data := &accountpunishmentproto.OpListData{ + List: list, + } + ReplyOk(ctx, data) +} + +func OpUnblockAccountPunishment(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*accountpunishmentproto.OpUnblockReq) + ec := service.DefaultService.OpUnblockAccountPunishment(ctx, req) + if ec != errcode.ErrCodeAccountPunishmentSrvOk { + logger.Error("OpUnblockAccountPunishment fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + ReplyOk(ctx, nil) +} + +func OpGetTerminatedAccountPunishmentList(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*accountpunishmentproto.OpListTerminatedReq) + + //设置默认页长 + if req.Limit == 0 { + req.Limit = consts.DefaultPageSize + } + + list, ec := service.DefaultService.OpGetTerminatedAccountPunishmentList(ctx, req) + if ec != errcode.ErrCodeAccountPunishmentSrvOk { + logger.Error("OpGetTerminatedAccountPunishmentList fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsg(ctx, ec) + return + } + + //填充媒体切片 + objectMediaNum := 1 // 单个账号封禁服务总共1个媒体类 + mediafillables := make([]mediafiller.MediaFillable, len(list)*objectMediaNum) + for i, vo := range list { + mediafillables[objectMediaNum*i+0] = vo.Account.Avatar + } + mediafiller.FillList(ctx, mediafillables) + + data := &accountpunishmentproto.OpListData{ + List: list, + } + ReplyOk(ctx, data) +} diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index d6633c5d..015d6a13 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -19,6 +19,7 @@ import ( "service/api/consts" "service/api/errcode" accountproto "service/api/proto/account/proto" + accountpunishmentproto "service/api/proto/accountpunishment/proto" accountrelationproto "service/api/proto/accountrelation/proto" appconfigproto "service/api/proto/app_config/proto" callhistoryproto "service/api/proto/callhistory/proto" @@ -408,6 +409,13 @@ func Init(r *gin.Engine) { opAppConfigGroup.POST("update", middleware.JSONParamValidator(appconfigproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateAppConfig) opAppConfigGroup.POST("list_by_key", middleware.JSONParamValidator(appconfigproto.OpListByKeyReq{}), middleware.JwtAuthenticator(), OpGetAppConfigListByKey) + // 账号处罚 + opAccountPunishmentGroup := r.Group("/op/account_punishment", PrepareOp()) + opAccountPunishmentGroup.POST("create", middleware.JSONParamValidator(accountpunishmentproto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateAccountPunishment) + opAccountPunishmentGroup.POST("list", middleware.JSONParamValidator(accountpunishmentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetAccountPunishmentList) + opAccountPunishmentGroup.POST("unblock", middleware.JSONParamValidator(accountpunishmentproto.OpUnblockReq{}), middleware.JwtAuthenticator(), OpUnblockAccountPunishment) + opAccountPunishmentGroup.POST("list_terminated", middleware.JSONParamValidator(accountpunishmentproto.OpListTerminatedReq{}), middleware.JwtAuthenticator(), OpGetTerminatedAccountPunishmentList) + // 账号相关 //accountGroup := r.Group("/account") @@ -443,6 +451,14 @@ func ReplyErrCodeMsg(ctx *gin.Context, ec errcode.ErrCode) { }) } +func ReplyErrCodeMsgAndDetail(ctx *gin.Context, ec errcode.ErrCode, params ...any) { + ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ + Ret: consts.RetCodeFail, + ErrCode: ec, + Msg: fmt.Sprintf(errcode.ErrCodeMsgMap[ec], params), + }) +} + func ReplyJsonError(ctx *gin.Context, code int, msg string) { ctx.AbortWithStatusJSON(code, base.BaseResponse{ Ret: consts.RetCodeFail, diff --git a/app/mix/controller/moment_api.go b/app/mix/controller/moment_api.go index 00314360..fca17ce3 100644 --- a/app/mix/controller/moment_api.go +++ b/app/mix/controller/moment_api.go @@ -14,7 +14,12 @@ import ( func ApiCreateMoment(ctx *gin.Context) { req := ctx.MustGet("client_req").(*momentproto.ApiCreateReq) - ec := service.DefaultService.ApiCreateMoment(ctx, req) + ec, acctPunEndTime := service.DefaultService.ApiCreateMoment(ctx, req) + if ec == errcode.ErrCodMomentBlockedFromCreatingMoment { + logger.Error("ApiCreateMoment fail, req: %v, ec: %v", util.ToJson(req), ec) + ReplyErrCodeMsgAndDetail(ctx, ec, acctPunEndTime) + return + } if ec != errcode.ErrCodeMomentSrvOk { logger.Error("ApiCreateMoment fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 7ff1516f..346a42fc 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -15,6 +15,7 @@ import ( "go.mongodb.org/mongo-driver/bson" accountproto "service/api/proto/account/proto" + accountpunishmentproto "service/api/proto/accountpunishment/proto" accountrelationproto "service/api/proto/accountrelation/proto" appconfigproto "service/api/proto/app_config/proto" callhistoryproto "service/api/proto/callhistory/proto" @@ -154,6 +155,9 @@ const ( DBMomentAuditTask = "moment_audit_task" COLMomentAuditTask = "moment_audit_task" + + DBAccountPunishment = "account_punishment" + COLAccountPunishment = "account_punishment" ) // 商品表 @@ -360,6 +364,11 @@ func (m *Mongo) getColMomentAuditTask() *qmgo.Collection { return m.clientMix.Database(DBMomentAuditTask).Collection(COLMomentAuditTask) } +// 账号处罚表 +func (m *Mongo) getColAccountPunishment() *qmgo.Collection { + return m.clientMix.Database(DBAccountPunishment).Collection(COLAccountPunishment) +} + // 商品相关 func (m *Mongo) CreateProduct(ctx *gin.Context, product *dbstruct.Product) error { col := m.getColProduct() @@ -3297,3 +3306,113 @@ func (m *Mongo) GetAppConfigListByKey(ctx *gin.Context, req *appconfigproto.OpLi } return appconfig, err } + +// 账号处罚相关 +func (m *Mongo) CreateAccountPunishment(ctx *gin.Context, accountpunishment *dbstruct.AccountPunishment) error { + col := m.getColAccountPunishment() + _, err := col.InsertOne(ctx, accountpunishment) + return err +} + +func (m *Mongo) UpdateAccountPunishment(ctx *gin.Context, accountpunishment *dbstruct.AccountPunishment) error { + col := m.getColAccountPunishment() + set := util.EntityToM(accountpunishment) + set["ut"] = time.Now().Unix() + up := qmgo.M{ + "$set": set, + } + err := col.UpdateId(ctx, accountpunishment.Id, up) + return err +} + +func (m *Mongo) DeleteAccountPunishment(ctx *gin.Context, id int64) error { + col := m.getColAccountPunishment() + update := qmgo.M{ + "$set": qmgo.M{ + "del_flag": 1, + }, + } + err := col.UpdateId(ctx, id, update) + return err +} + +func (m *Mongo) GetAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListReq) ([]*dbstruct.AccountPunishment, error) { + list := make([]*dbstruct.AccountPunishment, 0) + col := m.getColAccountPunishment() + query := qmgo.M{ + "status": qmgo.M{ + "$ne": consts.AccountPunishment_Interrupted, + }, + "end_time": qmgo.M{ + "$gt": time.Now().Unix(), + }, + "del_flag": 0, + } + err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return list, err + } + return list, err +} + +func (m *Mongo) GetAccountPunishmentListById(ctx *gin.Context, id int64) (*dbstruct.AccountPunishment, error) { + accountpunishment := &dbstruct.AccountPunishment{} + col := m.getColAccountPunishment() + query := qmgo.M{ + "_id": id, + "del_flag": 0, + } + err := col.Find(ctx, query).One(&accountpunishment) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return nil, err + } + return accountpunishment, err +} + +func (m *Mongo) GetAccountPunishmentListByMidAndType(ctx *gin.Context, mid int64, typ int64) (*dbstruct.AccountPunishment, error) { + accountpunishment := &dbstruct.AccountPunishment{} + col := m.getColAccountPunishment() + query := qmgo.M{ + "mid": mid, + "type": typ, + "status": qmgo.M{ + "$ne": consts.AccountPunishment_Interrupted, + }, + "end_time": qmgo.M{ + "$gt": time.Now().Unix(), + }, + "del_flag": 0, + } + err := col.Find(ctx, query).One(&accountpunishment) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return nil, err + } + return accountpunishment, err +} + +func (m *Mongo) GetTerminatedAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListTerminatedReq) ([]*dbstruct.AccountPunishment, error) { + list := make([]*dbstruct.AccountPunishment, 0) + col := m.getColAccountPunishment() + query := qmgo.M{ + "$or": []qmgo.M{ + { + "status": consts.AccountPunishment_Interrupted, + }, + { + "end_time": qmgo.M{ + "$lte": time.Now().Unix(), + }, + }, + }, + "del_flag": 0, + } + err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) + if err == qmgo.ErrNoSuchDocuments { + err = nil + return list, err + } + return list, err +} diff --git a/app/mix/dao/mongo_idseq.go b/app/mix/dao/mongo_idseq.go index 372f962f..2919d232 100644 --- a/app/mix/dao/mongo_idseq.go +++ b/app/mix/dao/mongo_idseq.go @@ -45,6 +45,9 @@ const ( DBFeedbackIdSeq = "feedback_id_seq" COLFeedbackIdSeq = "feedback_id_seq" + + DBAccountPunishmentIdSeq = "account_punishment_id_seq" + COLAccountPunishmentIdSeq = "account_punishment_id_seq" ) // UserIdSeq序列表 @@ -107,6 +110,11 @@ func (m *Mongo) getColFeedbackIdSeq() *qmgo.Collection { return m.clientMix.Database(DBFeedbackIdSeq).Collection(COLFeedbackIdSeq) } +// AccountPunishmentIdSeq序列表 +func (m *Mongo) getColAccountPunishmentIdSeq() *qmgo.Collection { + return m.clientMix.Database(DBAccountPunishmentIdSeq).Collection(COLAccountPunishmentIdSeq) +} + // account_id发号器 func (m *Mongo) GetAndUpdateAccountIdSeq(ctx *gin.Context) (accountIdSeq *dbstruct.AccountIdSeq, err error) { col := m.getColAccountIdSeq() @@ -345,3 +353,22 @@ func (m *Mongo) GetAndUpdateMediaSeq(ctx *gin.Context) (mediaIdSeq *dbstruct.Med return &mediaIdSeqInstance, err } + +// accountpunishment_id发号器 +func (m *Mongo) GetAndUpdateAccountPunishmentIdSeq(ctx *gin.Context) (accountpunishmentIdSeq *dbstruct.AccountPunishmentIdSeq, err error) { + col := m.getColAccountPunishmentIdSeq() + + change := qmgo.Change{ + Update: qmgo.M{"$inc": qmgo.M{"seq": 1}}, + Upsert: true, + ReturnNew: false, + } + + accountpunishmentIdSeqInstance := dbstruct.AccountPunishmentIdSeq{} + if err = col.Find(ctx, qmgo.M{"_id": "account_punishment_id_seq_id"}).Apply(change, &accountpunishmentIdSeqInstance); err != nil { + logger.Error("change error : %v", err) + return + } + + return &accountpunishmentIdSeqInstance, err +} diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index cfafedb5..b9f66af3 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1574,12 +1574,17 @@ func (s *Service) ApiGetContactCustomerServiceSessionListByMid(ctx *gin.Context, } // Moment -func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateReq) (ec errcode.ErrCode) { +func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateReq) (ec errcode.ErrCode, acctPunEndTime string) { ec = errcode.ErrCodeMomentSrvOk req.Moment.Mid = goproto.Int64(req.BaseRequest.Mid) - - if ec = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { + var accountpunishment *dbstruct.AccountPunishment + if ec, accountpunishment = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { + if ec == errcode.ErrCodeAccountPunishmentExist { + ec = errcode.ErrCodMomentBlockedFromCreatingMoment + acctPunEndTime = accountpunishment.GetEndTimeFormatString() + return + } return } diff --git a/app/mix/service/apiservice_business_validation.go b/app/mix/service/apiservice_business_validation.go index a4a698a0..c7419c52 100644 --- a/app/mix/service/apiservice_business_validation.go +++ b/app/mix/service/apiservice_business_validation.go @@ -524,16 +524,18 @@ func (s *Service) ApiGetStreamerWxIdBusinessValidate(ctx *gin.Context, req *stre return } -func (s *Service) ApiCreateMomentBusinessValidate(ctx *gin.Context, req *momentproto.ApiCreateReq) (ec errcode.ErrCode) { +func (s *Service) ApiCreateMomentBusinessValidate(ctx *gin.Context, req *momentproto.ApiCreateReq) (ec errcode.ErrCode, accountpunishment *dbstruct.AccountPunishment) { ec = errcode.ErrCodeMomentSrvOk resultList := businessvalidator.NewAuthBusinessValidator(ctx, req). + EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, consts.AccountPunishment_BlockFromCreatingMoment, _DefaultAccountPunishment.OpListByMidAndType). QueryMomentCreateTimes(_DefaultMomentCreateTimes.OpGetAndUpdate, req.GetBaseRequest().Mid). EnsureMomentCreateTimesNotReachedDailyUpperbound(). Validate(). Collect() ec, _ = resultList[0].(errcode.ErrCode) - if ec != errcode.ErrCodeLoginSrvOk { + accountpunishment, _ = resultList[3].(*dbstruct.AccountPunishment) + if ec != errcode.ErrCodeOk { logger.Error("ApiCreateMomentBusinessValidate business validation failed!") return } diff --git a/app/mix/service/business_validator/auth.go b/app/mix/service/business_validator/auth.go index 194d5364..ad49d5a5 100644 --- a/app/mix/service/business_validator/auth.go +++ b/app/mix/service/business_validator/auth.go @@ -10,6 +10,7 @@ import ( "service/dbstruct" "service/library/apollo" "service/library/logger" + "time" "github.com/gin-gonic/gin" goproto "google.golang.org/protobuf/proto" @@ -25,6 +26,7 @@ type AuthBusinessValidator struct { account *dbstruct.Account accountrelation *dbstruct.AccountRelation momentCreateTimes *dbstruct.MomentCreateTimes + accountpunishment *dbstruct.AccountPunishment } func NewAuthBusinessValidator(ctx *gin.Context, req any) *AuthBusinessValidator { @@ -297,6 +299,86 @@ func (l *AuthBusinessValidator) EnsureMomentCreateTimesNotReachedDailyUpperbound return l } +func (l *AuthBusinessValidator) EnsureAccountPunishmentHasNotTerminated(id int64, QueryFunc func(ctx *gin.Context, id int64) (*dbstruct.AccountPunishment, error)) *AuthBusinessValidator { + l.oplist = append(l.oplist, func() { + accountpunishment, err := QueryFunc(l.ctx, id) + if err != nil { + logger.Error("Query account punishment failed, err: %v", err) + l.ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + if accountpunishment == nil { + logger.Error("No account punishment was found") + l.ec = errcode.ErrCodeAccountPunishmentNotExist + return + } + if util.DerefInt64(accountpunishment.Status) == consts.AccountPunishment_Interrupted { + l.ec = errcode.ErrCodeAccountPunishmentHasBeenInterrupted + return + } + if util.DerefInt64(accountpunishment.EndTime) <= time.Now().Unix() { + l.ec = errcode.ErrCodeAccountPunishmentHasFinished + return + } + }) + return l +} + +func (l *AuthBusinessValidator) EnsureAccountPunishmentMatchesRoleOfTarget(uid int64, typ int64, QueryFunc func(ctx *gin.Context, req *accountproto.OpListByMidReq) (*dbstruct.Account, error)) *AuthBusinessValidator { + l.oplist = append(l.oplist, func() { + acct, err := QueryFunc(l.ctx, &accountproto.OpListByMidReq{ + Mid: goproto.Int64(uid), + }) + if err != nil { + logger.Error("Query account failed, err: %v", err) + l.ec = errcode.ErrCodeAccountSrvFail + return + } + if acct == nil { + logger.Error("No account entity was found") + l.ec = errcode.ErrCodeAccountNotExist + return + } + acctRole := util.DerefInt64(acct.Role) + pass := false + for _, role := range consts.AccountPunishmentRoleMap[typ] { + if acctRole == role { + pass = true + break + } + } + if !pass { + switch typ { + case consts.AccountPunishment_BlockFromCreatingMoment: + l.ec = errcode.ErrCodeAccountPunishmentStreamerOnly + default: + l.ec = errcode.ErrCodeAccountPunishmentSrvFail + } + } + + }) + return l +} + +func (l *AuthBusinessValidator) EnsureSuchAccountPunishmentNotExist(uid int64, typ int64, QueryFunc func(ctx *gin.Context, mid int64, typ int64) (*dbstruct.AccountPunishment, error)) *AuthBusinessValidator { + l.oplist = append(l.oplist, func() { + accountpunishment, err := QueryFunc(l.ctx, uid, typ) + if err != nil { + logger.Error("Query account punishment failed, err: %v", err) + l.ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + + if accountpunishment != nil { + l.ec = errcode.ErrCodeAccountPunishmentExist + l.accountpunishment = accountpunishment + return + } + + }) + return l +} + // 执行校验 func (a *AuthBusinessValidator) Validate() *AuthBusinessValidator { a.BusinessValidateStream.Validate() @@ -308,5 +390,6 @@ func (a *AuthBusinessValidator) Collect() []any { resultList[0] = a.ec resultList[1] = a.account resultList[2] = a.accountrelation + resultList[3] = a.accountpunishment return resultList } diff --git a/app/mix/service/logic/accountpunishment.go b/app/mix/service/logic/accountpunishment.go new file mode 100644 index 00000000..45403e9f --- /dev/null +++ b/app/mix/service/logic/accountpunishment.go @@ -0,0 +1,103 @@ +package logic + +import ( + "service/api/consts" + accountpunishmentproto "service/api/proto/accountpunishment/proto" + "service/app/mix/dao" + "service/bizcommon/util" + "service/dbstruct" + "service/library/logger" + "time" + + "github.com/gin-gonic/gin" + goproto "google.golang.org/protobuf/proto" +) + +type AccountPunishment struct { + store *dao.Store +} + +func NewAccountPunishment(store *dao.Store) (a *AccountPunishment) { + a = &AccountPunishment{ + store: store, + } + return +} + +func (p *AccountPunishment) OpCreate(ctx *gin.Context, req *accountpunishmentproto.OpCreateReq) error { + + //产生id + accountpunishmentIdSeq, err := p.store.GetAndUpdateAccountPunishmentIdSeq(ctx) + if err != nil { + logger.Error("GetAndUpdateAccountPunishmentIdSeq failed : %v", err) + return err + } + + nowTime := time.Now().Unix() + req.AccountPunishment.Id = goproto.Int64(accountpunishmentIdSeq.Seq) + req.AccountPunishment.Status = goproto.Int64(consts.AccountPunishment_Punishing) + req.AccountPunishment.EndTime = goproto.Int64(nowTime + util.DerefInt64(req.Duration)) + req.AccountPunishment.Ct = goproto.Int64(nowTime) + req.AccountPunishment.Ut = goproto.Int64(nowTime) + req.AccountPunishment.DelFlag = goproto.Int64(consts.Exist) + err = p.store.CreateAccountPunishment(ctx, req.AccountPunishment) + if err != nil { + logger.Error("CreateAccountPunishment fail, err: %v", err) + return err + } + return nil +} + +func (p *AccountPunishment) OpUpdate(ctx *gin.Context, req *accountpunishmentproto.OpUpdateReq) error { + err := p.store.UpdateAccountPunishment(ctx, req.AccountPunishment) + if err != nil { + logger.Error("UpdateAccountPunishment fail, err: %v", err) + return err + } + return nil +} + +func (p *AccountPunishment) OpDelete(ctx *gin.Context, id int64) error { + err := p.store.DeleteAccountPunishment(ctx, id) + if err != nil { + logger.Error("DeleteAccountPunishment fail, err: %v", err) + return err + } + return nil +} + +func (p *AccountPunishment) OpList(ctx *gin.Context, req *accountpunishmentproto.OpListReq) ([]*dbstruct.AccountPunishment, error) { + list, err := p.store.GetAccountPunishmentList(ctx, req) + if err != nil { + logger.Error("GetAccountPunishmentList fail, err: %v", err) + return make([]*dbstruct.AccountPunishment, 0), err + } + return list, nil +} + +func (p *AccountPunishment) OpListTerminated(ctx *gin.Context, req *accountpunishmentproto.OpListTerminatedReq) ([]*dbstruct.AccountPunishment, error) { + list, err := p.store.GetTerminatedAccountPunishmentList(ctx, req) + if err != nil { + logger.Error("GetTerminatedAccountPunishmentList fail, err: %v", err) + return make([]*dbstruct.AccountPunishment, 0), err + } + return list, nil +} + +func (p *AccountPunishment) OpListById(ctx *gin.Context, id int64) (*dbstruct.AccountPunishment, error) { + accountpunishment, err := p.store.GetAccountPunishmentListById(ctx, id) + if err != nil { + logger.Error("GetAccountPunishmentListById fail, err: %v", err) + return nil, err + } + return accountpunishment, nil +} + +func (p *AccountPunishment) OpListByMidAndType(ctx *gin.Context, mid int64, typ int64) (*dbstruct.AccountPunishment, error) { + accountpunishment, err := p.store.GetAccountPunishmentListByMidAndType(ctx, mid, typ) + if err != nil { + logger.Error("GetAccountPunishmentListByMid fail, err: %v", err) + return nil, err + } + return accountpunishment, nil +} diff --git a/app/mix/service/opservice_business_validation.go b/app/mix/service/opservice_business_validation.go index 2b15ca81..670abb84 100644 --- a/app/mix/service/opservice_business_validation.go +++ b/app/mix/service/opservice_business_validation.go @@ -3,6 +3,7 @@ package service import ( "service/api/errcode" accountproto "service/api/proto/account/proto" + accountpunishmentproto "service/api/proto/accountpunishment/proto" accountrelationproto "service/api/proto/accountrelation/proto" appconfigproto "service/api/proto/app_config/proto" callhistoryproto "service/api/proto/callhistory/proto" @@ -22,6 +23,7 @@ import ( userwxaddcheckproto "service/api/proto/userwxaddcheck/proto" vericodeproto "service/api/proto/vericode/proto" businessvalidator "service/app/mix/service/business_validator" + "service/bizcommon/util" "service/dbstruct" "service/library/logger" "service/library/mycrypto" @@ -1334,3 +1336,77 @@ func (s *Service) OpGetAppConfigListByKeyBusinessValidate(ctx *gin.Context, req } return } + +func (s *Service) OpCreateAccountPunishmentBusinessValidate(ctx *gin.Context, req *accountpunishmentproto.OpCreateReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + uid := util.DerefInt64(req.AccountPunishment.Mid) + typ := util.DerefInt64(req.AccountPunishment.Type) + + // 1.业务校验 + result := businessvalidator.NewAuthBusinessValidator(ctx, req). + QueryAccount(_DefaultAccount.OpListByMid). + EnsureAccountExist(). + EnsureIsOpRole(). + EnsureAccountPunishmentMatchesRoleOfTarget(uid, typ, _DefaultAccount.OpListByMid). + EnsureSuchAccountPunishmentNotExist(uid, typ, _DefaultAccountPunishment.OpListByMidAndType). + Validate(). + Collect() + if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk { + logger.Error("OpCreateAccountPunishment business validation failed") + return + } + return +} + +func (s *Service) OpUnblockAccountPunishmentBusinessValidate(ctx *gin.Context, req *accountpunishmentproto.OpUnblockReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + // 1.业务校验 + result := businessvalidator.NewAuthBusinessValidator(ctx, req). + QueryAccount(_DefaultAccount.OpListByMid). + EnsureAccountExist(). + EnsureIsOpRole(). + EnsureAccountPunishmentHasNotTerminated(util.DerefInt64(req.Id), _DefaultAccountPunishment.OpListById). + Validate(). + Collect() + if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk { + logger.Error("OpUnblockAccountPunishment business validation failed") + return + } + return +} + +func (s *Service) OpGetAccountPunishmentListBusinessValidate(ctx *gin.Context, req *accountpunishmentproto.OpListReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + // 1.业务校验 + result := businessvalidator.NewAuthBusinessValidator(ctx, req). + QueryAccount(_DefaultAccount.OpListByMid). + EnsureAccountExist(). + EnsureIsOpRole(). + Validate(). + Collect() + if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk { + logger.Error("OpGetAccountPunishmentList business validation failed") + return + } + return +} + +func (s *Service) OpGetTerminatedAccountPunishmentListBusinessValidate(ctx *gin.Context, req *accountpunishmentproto.OpListTerminatedReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + // 1.业务校验 + result := businessvalidator.NewAuthBusinessValidator(ctx, req). + QueryAccount(_DefaultAccount.OpListByMid). + EnsureAccountExist(). + EnsureIsOpRole(). + Validate(). + Collect() + if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk { + logger.Error("OpGetAccountPunishmentList business validation failed") + return + } + return +} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index be24447f..96039331 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -52,6 +52,8 @@ import ( "service/library/payclients/wxpaycli" "service/library/redis" + accountpunishmentproto "service/api/proto/accountpunishment/proto" + "go.mongodb.org/mongo-driver/mongo" goproto "google.golang.org/protobuf/proto" @@ -100,6 +102,7 @@ var ( _DefaultXxlJob *logic.XxlJob _DefaultAppConfig *logic.AppConfig _DefaultMomentAuditTask *logic.MomentAuditTask + _DefaultAccountPunishment *logic.AccountPunishment ) type Service struct { @@ -176,6 +179,7 @@ func (s *Service) Init(c any) (err error) { _DefaultXxlJob = logic.NewXxlJob(store, cfg.XxlJob) _DefaultAppConfig = logic.NewAppConfig(store) _DefaultMomentAuditTask = logic.NewMomentAuditTask(store) + _DefaultAccountPunishment = logic.NewAccountPunishment(store) return } @@ -2883,3 +2887,170 @@ func (s *Service) OpGetAppConfigListByKey(ctx *gin.Context, req *appconfigproto. } return } + +// AccountPunishment +func (s *Service) OpCreateAccountPunishment(ctx *gin.Context, req *accountpunishmentproto.OpCreateReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + if ec = s.OpCreateAccountPunishmentBusinessValidate(ctx, req); ec != errcode.ErrCodeAccountPunishmentSrvOk { + if ec == errcode.ErrCodeAccountPunishmentExist { + ec = errcode.ErrCodeAccountPunishmentDuplicateKey + return + } + return + } + + err := _DefaultAccountPunishment.OpCreate(ctx, req) + if err != nil { + logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + return +} + +func (s *Service) OpUnblockAccountPunishment(ctx *gin.Context, req *accountpunishmentproto.OpUnblockReq) (ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + if ec = s.OpUnblockAccountPunishmentBusinessValidate(ctx, req); ec != errcode.ErrCodeAccountPunishmentSrvOk { + return + } + + err := _DefaultAccountPunishment.OpUpdate(ctx, &accountpunishmentproto.OpUpdateReq{ + AccountPunishment: &dbstruct.AccountPunishment{ + Id: req.Id, + Status: goproto.Int64(consts.AccountPunishment_Interrupted), + }, + }) + if err == qmgo.ErrNoSuchDocuments { + ec = errcode.ErrCodeAccountPunishmentNotExist + err = nil + return + } + if err != nil { + logger.Error("OpUpdate fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + return +} + +func (s *Service) OpGetAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListReq) (volist []*accountpunishmentproto.OpAccountPunishmentVO, ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + if ec = s.OpGetAccountPunishmentListBusinessValidate(ctx, req); ec != errcode.ErrCodeAccountPunishmentSrvOk { + return + } + + list, err := _DefaultAccountPunishment.OpList(ctx, req) + if err != nil { + logger.Error("OpGetAccountPunishmentList fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + + // 获取mid的set + midMap := make(map[int64]*dbstruct.Account) + midSet := make([]int64, 0) + for _, v := range list { + mid := util.DerefInt64(v.Mid) + if midMap[mid] != nil { + continue + } else { + midSet = append(midSet, mid) + midMap[mid] = &dbstruct.Account{} + } + } + + // 查询mid的map + acctMap, err := _DefaultAccount.GetAccountMapByMids(ctx, midSet) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + + // 组装vo + volist = make([]*accountpunishmentproto.OpAccountPunishmentVO, 0) + voMap := make(map[int64]*accountpunishmentproto.OpAccountPunishmentVO) + for _, accountpunishment := range list { + mid := util.DerefInt64(accountpunishment.Mid) + if voMap[mid] != nil { + voMap[mid].List = append(voMap[mid].List, accountpunishment) + } else { + vo := &accountpunishmentproto.OpAccountPunishmentVO{ + Account: &accountproto.OpListVO{}, + List: make([]*dbstruct.AccountPunishment, 0), + } + vo.Account.CopyAccount(acctMap[mid]) + vo.List = append(vo.List, accountpunishment) + volist = append(volist, vo) + voMap[mid] = vo + } + } + + return +} + +func (s *Service) OpGetTerminatedAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListTerminatedReq) (volist []*accountpunishmentproto.OpAccountPunishmentVO, ec errcode.ErrCode) { + ec = errcode.ErrCodeAccountPunishmentSrvOk + + if ec = s.OpGetTerminatedAccountPunishmentListBusinessValidate(ctx, req); ec != errcode.ErrCodeAccountPunishmentSrvOk { + return + } + + list, err := _DefaultAccountPunishment.OpListTerminated(ctx, req) + if err != nil { + logger.Error("OpGetAccountPunishmentList fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountPunishmentSrvFail + return + } + + // 获取mid的set + midMap := make(map[int64]*dbstruct.Account) + midSet := make([]int64, 0) + for _, v := range list { + mid := util.DerefInt64(v.Mid) + if midMap[mid] != nil { + continue + } else { + midSet = append(midSet, mid) + midMap[mid] = &dbstruct.Account{} + } + } + + // 查询mid的map + acctMap, err := _DefaultAccount.GetAccountMapByMids(ctx, midSet) + if err != nil { + logger.Error("GetAccountMapByMids fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + + // 组装vo + volist = make([]*accountpunishmentproto.OpAccountPunishmentVO, 0) + voMap := make(map[int64]*accountpunishmentproto.OpAccountPunishmentVO) + for _, accountpunishment := range list { + mid := util.DerefInt64(accountpunishment.Mid) + + // 填充状态,不为提前中止,则为正常结束 + if util.DerefInt64(accountpunishment.Status) != consts.AccountPunishment_Interrupted { + accountpunishment.Status = goproto.Int64(consts.AccountPunishment_Finished) + } + + if voMap[mid] != nil { + voMap[mid].List = append(voMap[mid].List, accountpunishment) + } else { + vo := &accountpunishmentproto.OpAccountPunishmentVO{ + Account: &accountproto.OpListVO{}, + List: make([]*dbstruct.AccountPunishment, 0), + } + vo.Account.CopyAccount(acctMap[mid]) + vo.List = append(vo.List, accountpunishment) + volist = append(volist, vo) + voMap[mid] = vo + } + } + + return +} diff --git a/codecreate/codecreate.go b/codecreate/codecreate.go index 9967cceb..52c5b8bc 100644 --- a/codecreate/codecreate.go +++ b/codecreate/codecreate.go @@ -9,10 +9,10 @@ import ( func main() { genSource := &generator.GenSource{ - EntityName: "MomentAuditTask", - ModuleName: "moment_audit_task", - EntityCNName: "动态审核任务表", - ErrCodeSeq: "28", + EntityName: "AccountPunishment", + ModuleName: "accountpunishment", + EntityCNName: "账号处罚", + ErrCodeSeq: "32", } generator.CreateFileDirectory(genSource) diff --git a/codecreate/consts/consts.go b/codecreate/consts/consts.go index 39e71ce4..77b1ceaf 100644 --- a/codecreate/consts/consts.go +++ b/codecreate/consts/consts.go @@ -1,7 +1,7 @@ package consts // root -const RootPath = "/Users/PC/Desktop/wishpal_ironfan_service/service/" +const RootPath = "/Users/PC/Desktop/service/" const ExcelPath = "codecreate/resource/EntityDefine.xlsx" diff --git a/codecreate/resource/EntityDefine.xlsx b/codecreate/resource/EntityDefine.xlsx index 8161387ded7ca34d605a7ad78114aa6a49587f66..2f9190324c0026772131d419835897632b37c2ff 100644 GIT binary patch delta 9778 zcmZ9SbzB@x^6;0%9fHH+79==9gS!VOIKkbWEbb6sakt=_#ezFQg9LYX4{k4)d+(m# z=jNaJc6Ck9OxILRcULFQ0AtsHWGeEoaJT>j01^NIpaeKK@aqo4008pX000gE2?&A7 z#i?Z%0s=QBAWlFTm=s7ekPM|UNA{!wr>|po7qS7A1ACKB5WlT*?L}QyJ9VBPlqM(e zSYaI+m2A*YZh_OD;oOjy#9`lkq-2rz>AUU2;x}hHR*O53Em7w z9w4U!S&zU6M-?!#B$qXLmTj1nMMjk~vNV)6-M$toBBP+1dYSbmm(@dkI!r8MpPmw- zRFWEMad)>*)zm3>RE;!xZgK8eE6x+uiMpg+dek9ncVjRsvn#!#gO7~&ac>``=f2<> zK(5(*a7(Zx>dunuXU%4KBp3K@ufO-ya2t14OeA|Tncl-eMBm^-G2m!n!4qLiYQ}H? zz#=LDfce@-p0=zW4$d|v4h}Xfo_4ksn)(g}{8)Y+lh25~0`NFuZ+^QbC8+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#?KWu9?$(S**ciHv;NgM`2Kr|x{Z;(R_Tu%Z3#+rDqXtRQj^)lh9@Lbrrs zzmA2YC3H8jjrm#1NjX`3N0WykZkeW85f!%n{;=2*<}{Tzi7^bblcpJqW>4!V2_e{%h7UgAguHrV9I$NseeNVMW44Y?R0X&G`_a zLc|EMQZAs8&=aIU#FVlEMMVFOjy{bdN&JNbWn91u>A%q63BFSN3-imkkX|7s%jAHu zT7L&P%ZU&U(Rf(@-Vdq%-`vwHi75Z=sQ>_E|9U(j8l%5XZRJFi|Elx<>ojTl&$qbG8YtB_s zAgG?si;VpnRjrZ;5noLXbbO1Ls9{9-RC58NlK;Z7Cs>gB7t+-bvHjf$p8ha^Jyk9I zf3tr=ZSMd8D;G<3cNbR=E=w18YeZcMgz~=?4ix~v`+xotS%~BsQQ%DOQ*3UW=YZz` Nwx>sIChs4o{{u{G$}<1} diff --git a/codecreate/template/mongo.txt b/codecreate/template/mongo.txt index 3401bf68..1969c3d9 100644 --- a/codecreate/template/mongo.txt +++ b/codecreate/template/mongo.txt @@ -49,20 +49,3 @@ func (m *Mongo) Get#{EntityName}List(ctx *gin.Context, req *#{moduleName}proto.O } return list, err } - -func (m *Mongo) Get#{EntityName}ListByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.#{EntityName}, error) { - list := make([]*dbstruct.#{EntityName}, 0) - col := m.getCol#{EntityName}() - query := qmgo.M{ - "_id": bson.M{ - "$in": ids, - }, - "del_flag": 0, - } - err := col.Find(ctx, query).All(&list) - if err == qmgo.ErrNoSuchDocuments { - err = nil - return list, err - } - return list, err -} \ No newline at end of file diff --git a/dbstruct/accountpunishment.go b/dbstruct/accountpunishment.go new file mode 100644 index 00000000..d00030e6 --- /dev/null +++ b/dbstruct/accountpunishment.go @@ -0,0 +1,25 @@ +package dbstruct + +import ( + "service/bizcommon/util" + "time" +) + +type AccountPunishment struct { + Id *int64 `json:"id" bson:"_id"` // 账号处罚表id + Mid *int64 `json:"mid" bson:"mid"` // 用户表id + Type *int64 `json:"type" bson:"type"` // 处罚类型 + Duration *int64 `json:"duration" bson:"duration"` // 处罚时长 + EndTime *int64 `json:"end_time" bson:"end_time"` // 处罚结束时间 + Status *int64 `json:"status" bson:"status"` // 处罚结果 + Ct *int64 `json:"ct" bson:"ct"` // 创建时间 + Ut *int64 `json:"ut" bson:"ut"` // 更新时间 + DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 +} + +func (p *AccountPunishment) GetEndTimeFormatString() string { + if p == nil || p.EndTime == nil { + return "" + } + return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("2006年1月2日 15时04分05秒") +} diff --git a/dbstruct/idSeq.go b/dbstruct/idSeq.go index 07a0ab78..fa3cf2c8 100644 --- a/dbstruct/idSeq.go +++ b/dbstruct/idSeq.go @@ -52,3 +52,7 @@ type FeedbackIdSeq struct { type MediaIdSeq struct { Seq int64 `json:"seq" bson:"seq"` } + +type AccountPunishmentIdSeq struct { + Seq int64 //用户Id序列号 +} diff --git a/etc/mix/mix-test.yaml b/etc/mix/mix-test.yaml index 5efaa1bb..cd30bb7f 100644 --- a/etc/mix/mix-test.yaml +++ b/etc/mix/mix-test.yaml @@ -22,7 +22,7 @@ mix_mongo: mix_mysql: uri: "127.0.0.1:3306" username: "root" - password: "Xbz@114514" + password: "Wishpal@2023" timeout: 3 read_timeout_s: 5 write_timeout_s: 3 -- 2.41.0 From 3d0dbb6ca242458f5f6e08865bbfb3c38c08c827 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 13 Mar 2024 16:31:51 +0800 Subject: [PATCH 2/5] by Robin at 20240313; alter msg for permanent block --- api/errcode/errcode.go | 16 +++++++++------- app/mix/service/apiservice.go | 12 +++++++++--- dbstruct/accountpunishment.go | 9 +++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 428a6908..86e405b9 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -63,9 +63,10 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeVasAlipayUniTransferFail: "支付宝提现失败", ErrCodeVasOverTodayWithdrawCnt: "今日提现次数到达上限", - ErrCodeMomentSrvFail: "动态服务错误", - ErrCodeMomentNotExist: "动态不存在", - ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v", + ErrCodeMomentSrvFail: "动态服务错误", + ErrCodeMomentNotExist: "动态不存在", + ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v", + ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁", ErrCodeFootPrintSrvFail: "足迹服务错误", ErrCodeFootPrintNotExist: "足迹不存在", @@ -241,10 +242,11 @@ const ( ErrCodeVasOverTodayWithdrawCnt ErrCode = -7022 // 今天提现次数到达上限 // Moment: 8xxx - ErrCodeMomentSrvOk ErrCode = ErrCodeOk - ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 - ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 - ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 + ErrCodeMomentSrvOk ErrCode = ErrCodeOk + ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 + ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 + ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 + ErrCodMomentBlockedFromCreatingMomentPermanently ErrCode = -8004 // 动态创建已被永久封禁 // FootPrint: 9xxx ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index b9f66af3..01e88544 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1581,9 +1581,15 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe var accountpunishment *dbstruct.AccountPunishment if ec, accountpunishment = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { if ec == errcode.ErrCodeAccountPunishmentExist { - ec = errcode.ErrCodMomentBlockedFromCreatingMoment - acctPunEndTime = accountpunishment.GetEndTimeFormatString() - return + if accountpunishment.IsPermanent() { + ec = errcode.ErrCodMomentBlockedFromCreatingMomentPermanently + return + } else { + ec = errcode.ErrCodMomentBlockedFromCreatingMoment + acctPunEndTime = accountpunishment.GetEndTimeFormatString() + return + } + } return } diff --git a/dbstruct/accountpunishment.go b/dbstruct/accountpunishment.go index d00030e6..03e15930 100644 --- a/dbstruct/accountpunishment.go +++ b/dbstruct/accountpunishment.go @@ -5,6 +5,8 @@ import ( "time" ) +const PermanentDuration int64 = 3155760000 + type AccountPunishment struct { Id *int64 `json:"id" bson:"_id"` // 账号处罚表id Mid *int64 `json:"mid" bson:"mid"` // 用户表id @@ -23,3 +25,10 @@ func (p *AccountPunishment) GetEndTimeFormatString() string { } return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("2006年1月2日 15时04分05秒") } + +func (p *AccountPunishment) IsPermanent() bool { + if p == nil || p.Duration == nil { + return false + } + return util.DerefInt64(p.Duration) == PermanentDuration +} -- 2.41.0 From 2b5396d96b42fcfea56c48de638ae6419e22c5fc Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 18 Mar 2024 23:34:49 +0800 Subject: [PATCH 3/5] by robin at 20240318; alter text for punishing --- dbstruct/accountpunishment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbstruct/accountpunishment.go b/dbstruct/accountpunishment.go index 03e15930..9588743a 100644 --- a/dbstruct/accountpunishment.go +++ b/dbstruct/accountpunishment.go @@ -23,7 +23,7 @@ func (p *AccountPunishment) GetEndTimeFormatString() string { if p == nil || p.EndTime == nil { return "" } - return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("2006年1月2日 15时04分05秒") + return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("1/2 15:04") } func (p *AccountPunishment) IsPermanent() bool { -- 2.41.0 From ec2bad2abf8ef31734c4a1c12af8416d41c1dfeb Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 18 Mar 2024 23:36:53 +0800 Subject: [PATCH 4/5] by --- api/errcode/errcode.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 86e405b9..f3222664 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -65,7 +65,7 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeMomentSrvFail: "动态服务错误", ErrCodeMomentNotExist: "动态不存在", - ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v", + ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%s", ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁", ErrCodeFootPrintSrvFail: "足迹服务错误", -- 2.41.0 From d2f961a2d4e2839f184ed0813221a9e80a3b4290 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 18 Mar 2024 23:51:31 +0800 Subject: [PATCH 5/5] 1 --- app/mix/controller/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 015d6a13..12e0b4ac 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -455,7 +455,7 @@ func ReplyErrCodeMsgAndDetail(ctx *gin.Context, ec errcode.ErrCode, params ...an ctx.AbortWithStatusJSON(http.StatusOK, base.BaseResponse{ Ret: consts.RetCodeFail, ErrCode: ec, - Msg: fmt.Sprintf(errcode.ErrCodeMsgMap[ec], params), + Msg: fmt.Sprintf(errcode.ErrCodeMsgMap[ec], params...), }) } -- 2.41.0