feat:用户注册
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.xiang.xservice.auth.server.controller;
|
||||
|
||||
import com.xiang.xservice.auth.api.dto.req.RegisterRequest;
|
||||
import com.xiang.xservice.auth.api.dto.resp.RegisterResp;
|
||||
import com.xiang.xservice.auth.service.service.XUserService;
|
||||
import com.xiang.xservice.basic.common.resp.Result;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class UserController {
|
||||
|
||||
private final XUserService userService;
|
||||
|
||||
@PostMapping("/public/user/userRegister")
|
||||
public Result<RegisterResp> register(RegisterRequest request) {
|
||||
|
||||
try {
|
||||
RegisterResp registerResp = userService.userRegister(request);
|
||||
if (Objects.nonNull(registerResp)) {
|
||||
return Result.success("操作成功", registerResp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("【用户注册】用户注册失败:{}", e.getMessage(), e);
|
||||
}
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user