提交 | 用户 | 时间
|
722af2
|
1 |
package com.dl.web.controller.system; |
X |
2 |
|
|
3 |
import cn.dev33.satoken.annotation.SaIgnore; |
|
4 |
import com.dl.common.core.controller.BaseController; |
|
5 |
import com.dl.common.core.domain.R; |
|
6 |
import com.dl.common.core.domain.model.RegisterBody; |
|
7 |
import com.dl.system.service.ISysConfigService; |
|
8 |
import com.dl.system.service.SysRegisterService; |
|
9 |
import lombok.RequiredArgsConstructor; |
|
10 |
import org.springframework.validation.annotation.Validated; |
|
11 |
import org.springframework.web.bind.annotation.PostMapping; |
|
12 |
import org.springframework.web.bind.annotation.RequestBody; |
|
13 |
import org.springframework.web.bind.annotation.RestController; |
|
14 |
|
|
15 |
/** |
|
16 |
* 注册验证 |
|
17 |
* |
|
18 |
* @author Lion Li |
|
19 |
*/ |
|
20 |
@Validated |
|
21 |
@RequiredArgsConstructor |
|
22 |
@RestController |
|
23 |
public class SysRegisterController extends BaseController { |
|
24 |
|
|
25 |
private final SysRegisterService registerService; |
|
26 |
private final ISysConfigService configService; |
|
27 |
|
|
28 |
/** |
|
29 |
* 用户注册 |
|
30 |
*/ |
|
31 |
@SaIgnore |
|
32 |
@PostMapping("/register") |
|
33 |
public R<Void> register(@Validated @RequestBody RegisterBody user) { |
|
34 |
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { |
|
35 |
return R.fail("当前系统没有开启注册功能!"); |
|
36 |
} |
|
37 |
registerService.register(user); |
|
38 |
return R.ok(); |
|
39 |
} |
|
40 |
} |