Skip to content

Commit

Permalink
Merge pull request #12 from go-cinch/piupuer/dev
Browse files Browse the repository at this point in the history
[fix]bug
  • Loading branch information
piupuer authored Oct 10, 2024
2 parents a95b59f + 27b8c05 commit 16b824d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion internal/data/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (ro actionRepo) CodeExists(ctx context.Context, code string) (err error) {
if m.ID == constant.UI0 {
err = biz.ErrRecordNotFound(ctx)
log.
WithContext(ctx).
WithError(err).
Error("invalid code: %s", code)
return
Expand All @@ -171,7 +172,9 @@ func (ro actionRepo) WordExists(ctx context.Context, word string) (ok bool) {
for _, item := range arr {
m := db.GetByCol("word", item)
if m.ID == constant.UI0 {
log.Error("invalid word: %s", item)
log.
WithContext(ctx).
Error("invalid word: %s", item)
return
}
}
Expand Down
4 changes: 3 additions & 1 deletion internal/data/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ func (ro roleRepo) WordExists(ctx context.Context, word string) (ok bool) {
for _, item := range arr {
m := db.GetByCol("word", item)
if m.ID == constant.UI0 {
log.Error("invalid word: %s", item)
log.
WithContext(ctx).
Error("invalid word: %s", item)
return
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/data/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (ro userRepo) GetByUsername(ctx context.Context, username string) (item *bi
if err != nil || m.ID == constant.UI0 {
err = biz.ErrRecordNotFound(ctx)
log.
WithContext(ctx).
WithError(err).
Error("invalid username: %s", username)
return
Expand Down Expand Up @@ -197,6 +198,7 @@ func (ro userRepo) Update(ctx context.Context, item *biz.UpdateUser) (err error)
if mRole.ID == constant.UI0 {
err = biz.ErrRecordNotFound(ctx)
log.
WithContext(ctx).
WithError(err).
Error("invalid roleId: %s", v)
return
Expand Down Expand Up @@ -311,6 +313,7 @@ func (ro userRepo) GetByCode(ctx context.Context, code string) (item *biz.User,
if err != nil || m.ID == constant.UI0 {
err = biz.ErrRecordNotFound(ctx)
log.
WithContext(ctx).
WithError(err).
Error("invalid code: %s", code)
return
Expand Down
4 changes: 3 additions & 1 deletion internal/data/user_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ func (ro userGroupRepo) WordExists(ctx context.Context, word string) (ok bool) {
for _, item := range arr {
m := db.GetByCol("word", item)
if m.ID == constant.UI0 {
log.Error("invalid word: %s", item)
log.
WithContext(ctx).
Error("invalid word: %s", item)
return
}
}
Expand Down

0 comments on commit 16b824d

Please sign in to comment.