fix: Game上报数据通过角色id匹配

This commit is contained in:
lianghuanjie
2025-01-16 11:01:17 +08:00
parent a0000fd343
commit 5210d67d10
5 changed files with 65 additions and 28 deletions

View File

@@ -37,6 +37,7 @@ func (l *UnlockChapterLogic) UnlockChapter(req *types.UnlockChapterReq) *types.C
pb, err := l.svcCtx.PromoteBindModel.FindOneByInvitedUid(l.ctx, uid)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
l.Errorw("find promote bind error", logx.Field("err", err), logx.Field("email", req.Email))
return &types.CarvResult{
Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
@@ -50,25 +51,23 @@ func (l *UnlockChapterLogic) UnlockChapter(req *types.UnlockChapterReq) *types.C
}
shareId := l.svcCtx.ConfigModel.GetInviterId(l.ctx, consts.CarvIoInviterId)
if pb.ShareUid != shareId {
return &types.CarvResult{
Result: &types.Result{IsValid: false},
}
}
gp, err := l.svcCtx.GameReportModel.FindOneByUid(l.ctx, uid)
gp, err := l.svcCtx.GameReportModel.FindMaxByEmail(l.ctx, req.Email)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return &types.CarvResult{
Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
Message: "system error",
},
}
l.Errorw("find game report error", logx.Field("err", err), logx.Field("email", req.Email))
return &types.CarvResult{
Error: &types.Error{
Code: int(errs.ErrDatabaseOperate),
Message: "system error",
},
}
return &types.CarvResult{Result: &types.Result{IsValid: false}}
}
if gp.Chapter >= req.Chapter {
return &types.CarvResult{Result: &types.Result{IsValid: true}}
}

View File

@@ -68,7 +68,7 @@ func (l *Game7TaskCheckLogic) Game7TaskCheck(req *types.Game7TaskCheckReq) (*typ
return nil, errs.New(errs.ErrDatabaseOperate, err)
}
case 2, 3, 5, 6:
gp, err := l.svcCtx.GameReportModel.FindOneByUid(l.ctx, uid)
gp, err := l.svcCtx.GameReportModel.FindMaxByEmail(l.ctx, req.Email)
if err != nil {
if !errors.Is(err, model.ErrNotFound) {
return nil, errs.New(errs.ErrDatabaseOperate, err)