SysRegisterController.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.ruoyi.web.controller.system;
  2. import org.springframework.beans.factory.annotation.Autowired;
  3. import org.springframework.web.bind.annotation.PostMapping;
  4. import org.springframework.web.bind.annotation.RequestBody;
  5. import org.springframework.web.bind.annotation.RestController;
  6. import com.ruoyi.common.core.controller.BaseController;
  7. import com.ruoyi.common.core.domain.AjaxResult;
  8. import com.ruoyi.common.core.domain.model.RegisterBody;
  9. import com.ruoyi.common.utils.StringUtils;
  10. import com.ruoyi.framework.web.service.SysRegisterService;
  11. import com.ruoyi.system.service.ISysConfigService;
  12. /**
  13. * 注册验证
  14. *
  15. * @author ruoyi
  16. */
  17. @RestController
  18. public class SysRegisterController extends BaseController
  19. {
  20. @Autowired
  21. private SysRegisterService registerService;
  22. @Autowired
  23. private ISysConfigService configService;
  24. @PostMapping("/register")
  25. public AjaxResult register(@RequestBody RegisterBody user)
  26. {
  27. if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
  28. {
  29. return error("当前系统没有开启注册功能!");
  30. }
  31. String msg = registerService.register(user);
  32. return StringUtils.isEmpty(msg) ? success() : error(msg);
  33. }
  34. }