32 lines
755 B
Go
32 lines
755 B
Go
package user
|
|
|
|
import (
|
|
"context"
|
|
|
|
"sundynix-micro-go/app/system/api/internal/svc"
|
|
"sundynix-micro-go/app/system/api/internal/types"
|
|
"sundynix-micro-go/app/system/rpc/system"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type CreateUserLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewCreateUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateUserLogic {
|
|
return &CreateUserLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *CreateUserLogic) CreateUser(req *types.UserCreateReq) error {
|
|
_, err := l.svcCtx.SystemRpc.CreateUser(l.ctx, &system.CreateUserReq{
|
|
Name: req.Name,
|
|
Account: req.Account,
|
|
Password: req.Password,
|
|
Phone: req.Phone,
|
|
})
|
|
return err
|
|
}
|