Skip to content

Commit

Permalink
Refactor(#36): Refactor all counting services
Browse files Browse the repository at this point in the history
  • Loading branch information
shaokeyibb committed Feb 22, 2023
1 parent 0113df0 commit 31b5ffb
Show file tree
Hide file tree
Showing 12 changed files with 451 additions and 151 deletions.
3 changes: 3 additions & 0 deletions constant/biz/statuscode.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ const (
RequestIsNil
UnableToQueryFollowList
UnableToQueryFollowerList
UnableToQueryIsFollow
UnableToCreateRelation
UnableToDeleteRelation
UnableToLike
UnableToCancelLike
UnableToQueryFavorite
UnableToQueryTotalFavorited
)

// Bad Request
Expand Down
3 changes: 2 additions & 1 deletion idl/favorite.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ message UserFavoriteCountResponse {
}

message UserTotalFavoritedCountRequest {
uint32 user_id = 1; // 用户id
uint32 actor_id = 1;
uint32 user_id = 2;
}

message UserTotalFavoritedCountResponse {
Expand Down
35 changes: 32 additions & 3 deletions kitex_gen/douyin/favorite/favorite.pb.fast.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

115 changes: 62 additions & 53 deletions kitex_gen/douyin/favorite/favorite.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions service/auth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ func (s *AuthServiceImpl) Register(ctx context.Context, req *auth.RegisterReques
}

newUser := commonModel.User{
Username: req.Username,
Password: &hashedPwd,
FollowCount: 0,
FollowerCount: 0,
Name: req.Username,
Role: "0",
Username: req.Username,
Password: &hashedPwd,
}
err = user.WithContext(ctx).Save(
&newUser)
Expand All @@ -111,7 +107,6 @@ func (s *AuthServiceImpl) Register(ctx context.Context, req *auth.RegisterReques
Token: token,
Username: newUser.Username,
UserID: newUser.ID,
Role: newUser.Role,
})

if err != nil {
Expand Down Expand Up @@ -172,7 +167,6 @@ func (s *AuthServiceImpl) Login(ctx context.Context, req *auth.LoginRequest) (re
Token: token,
Username: dbUser[0].Username,
UserID: dbUser[0].ID,
Role: dbUser[0].Role,
})

if err != nil {
Expand Down
Loading

0 comments on commit 31b5ffb

Please sign in to comment.