2023-01-16 11:16:37 +08:00
|
|
|
package com.ruoyi.web.controller;
|
2021-08-02 12:15:14 +08:00
|
|
|
|
2022-09-19 12:30:46 +00:00
|
|
|
import cn.dev33.satoken.annotation.SaIgnore;
|
2023-01-18 17:09:43 +08:00
|
|
|
import com.ruoyi.common.core.web.controller.BaseController;
|
2022-01-29 11:48:41 +08:00
|
|
|
import com.ruoyi.common.core.domain.R;
|
2021-08-02 12:15:14 +08:00
|
|
|
import com.ruoyi.common.core.domain.model.RegisterBody;
|
|
|
|
import com.ruoyi.system.service.ISysConfigService;
|
2021-10-15 15:19:42 +08:00
|
|
|
import com.ruoyi.system.service.SysRegisterService;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
2021-08-02 12:15:14 +08:00
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 注册验证
|
|
|
|
*
|
2021-10-15 15:19:42 +08:00
|
|
|
* @author Lion Li
|
2021-08-02 12:15:14 +08:00
|
|
|
*/
|
2021-10-15 15:19:42 +08:00
|
|
|
@Validated
|
2022-01-16 16:51:23 +08:00
|
|
|
@RequiredArgsConstructor
|
2021-08-02 12:15:14 +08:00
|
|
|
@RestController
|
2021-10-15 15:19:42 +08:00
|
|
|
public class SysRegisterController extends BaseController {
|
2021-08-02 12:15:14 +08:00
|
|
|
|
2021-10-15 15:19:42 +08:00
|
|
|
private final SysRegisterService registerService;
|
|
|
|
private final ISysConfigService configService;
|
2021-08-02 12:15:14 +08:00
|
|
|
|
2022-07-08 15:49:15 +08:00
|
|
|
/**
|
|
|
|
* 用户注册
|
|
|
|
*/
|
2022-09-19 12:30:46 +00:00
|
|
|
@SaIgnore
|
2021-08-02 12:15:14 +08:00
|
|
|
@PostMapping("/register")
|
2022-01-29 11:48:41 +08:00
|
|
|
public R<Void> register(@Validated @RequestBody RegisterBody user) {
|
2021-10-15 15:19:42 +08:00
|
|
|
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) {
|
2022-02-11 17:46:36 +08:00
|
|
|
return R.fail("当前系统没有开启注册功能!");
|
2021-08-02 12:15:14 +08:00
|
|
|
}
|
2022-01-25 17:17:06 +08:00
|
|
|
registerService.register(user);
|
2022-02-11 17:46:36 +08:00
|
|
|
return R.ok();
|
2021-08-02 12:15:14 +08:00
|
|
|
}
|
|
|
|
}
|