33 lines
800 B
Go
33 lines
800 B
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"tianyuan-api/apps/gateway/internal/svc"
|
|
"tianyuan-api/apps/gateway/internal/types"
|
|
"tianyuan-api/apps/user/user"
|
|
)
|
|
|
|
type RegisterUserLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewRegisterUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RegisterUserLogic {
|
|
return &RegisterUserLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *RegisterUserLogic) RegisterUser(req *types.RegisterReq) error {
|
|
_, err := l.svcCtx.AuthRpc.RegisterUser(l.ctx, &user.RegisterReq{Username: req.Username, Password: req.Password, ConfirmPassword: req.ConfirmPassword, Phone: req.Phone, Code: req.Code})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|