feat(user): 初始化用户服务

- 新增用户登录和注册功能
- 实现基本的用户信息验证
- 集成数据库连接和查询
This commit is contained in:
2025-01-20 13:04:55 +08:00
parent 2024d1793c
commit a53f8f8a5a
3 changed files with 12 additions and 0 deletions
+1
View File
@@ -16,5 +16,6 @@ func NewLoginService(ctx context.Context) *LoginService {
func (s *LoginService) Run(req *user.LoginReq) (resp *user.LoginResp, err error) {
// Finish your business logic.
resp = &user.LoginResp{UserId: 111}
return
}
+6
View File
@@ -2,6 +2,8 @@ package service
import (
"context"
"errors"
"github.com/suyiiyii/hertz101/app/user/biz/dal/query"
user "github.com/suyiiyii/hertz101/rpc_gen/kitex_gen/user"
)
@@ -15,6 +17,10 @@ func NewRegisterService(ctx context.Context) *RegisterService {
// Run create note info
func (s *RegisterService) Run(req *user.RegisterReq) (resp *user.RegisterResp, err error) {
// Finish your business logic.
if req.Password == "" || req.Email == "" {
return nil, errors.New("password or email is empty")
}
query.Q.User
return
}