fix GeneralUserToken

This commit is contained in:
2025-06-18 17:58:40 +08:00
parent f2921c91a1
commit 184d61a5c7
3 changed files with 8 additions and 5 deletions

View File

@@ -86,10 +86,14 @@ func (s *UserService) GeneralUserToken(ctx context.Context, userID int64) (strin
var isAgent int64
var agentID int64
var userType int64
user, err := s.userModel.FindOne(ctx, userID)
var user *model.User
users, err := s.userModel.FindAll(ctx, s.userModel.SelectBuilder().Where("id = ?", userID), "")
if err != nil && !errors.Is(err, model.ErrNotFound) {
return "", err
}
if len(users) > 0 {
user = users[0]
}
if user != nil {
userID = user.Id
userType = model.UserTypeNormal