fix: game7 user not exist role bug
This commit is contained in:
@@ -59,6 +59,7 @@ func (l *UnlockChapterLogic) UnlockChapter(req *types.UnlockChapterReq) *types.C
|
||||
|
||||
gp, err := l.svcCtx.GameReportModel.FindMaxByEmail(l.ctx, req.Email)
|
||||
if err != nil {
|
||||
if !errors.Is(err, model.ErrNotFound) {
|
||||
l.Errorw("find game report error", logx.Field("err", err), logx.Field("email", req.Email))
|
||||
return &types.CarvResult{
|
||||
Error: &types.Error{
|
||||
@@ -67,6 +68,8 @@ func (l *UnlockChapterLogic) UnlockChapter(req *types.UnlockChapterReq) *types.C
|
||||
},
|
||||
}
|
||||
}
|
||||
return &types.CarvResult{Result: &types.Result{IsValid: false}}
|
||||
}
|
||||
|
||||
if gp.Chapter >= req.Chapter {
|
||||
return &types.CarvResult{Result: &types.Result{IsValid: true}}
|
||||
|
||||
@@ -48,10 +48,14 @@ GROUP BY
|
||||
`
|
||||
var resp GameReport
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, email)
|
||||
if err != nil && !errors.Is(err, sqlx.ErrNotFound) {
|
||||
switch {
|
||||
case err == nil:
|
||||
return &resp, nil
|
||||
case errors.Is(err, sqlx.ErrNotFound):
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
// NewNhGameReportModel returns a model for the database table.
|
||||
|
||||
Reference in New Issue
Block a user