|
@@ -0,0 +1,56 @@
|
|
|
+package com.pj.project.app_user;
|
|
|
+
|
|
|
+import com.pj.project.app_user.dto.ForgetPasswordDto;
|
|
|
+import com.pj.project.app_user.dto.RegisterDto;
|
|
|
+import com.pj.utils.sg.AjaxJson;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * Controller: app_user -- 移动端账号
|
|
|
+ * @author qzy
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/AppUser/")
|
|
|
+public class AppUserApiController {
|
|
|
+
|
|
|
+ /** 底层 Service 对象 */
|
|
|
+ @Autowired
|
|
|
+ AppUserService appUserService;
|
|
|
+
|
|
|
+
|
|
|
+ /** 用户注册 */
|
|
|
+ @RequestMapping("register")
|
|
|
+ public AjaxJson register(@Validated @RequestBody RegisterDto registerDto) {
|
|
|
+ boolean register = appUserService.register(registerDto);
|
|
|
+ if(!register)return AjaxJson.getError("注册失败!");
|
|
|
+ return AjaxJson.getSuccess( "注册完成!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 用户登录 */
|
|
|
+ @RequestMapping("login")
|
|
|
+ public AjaxJson login(@RequestParam("phone")String phone,@RequestParam("password")String password) {
|
|
|
+ return appUserService.login(phone,password);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 忘记密码 */
|
|
|
+ @RequestMapping("forgetPassword")
|
|
|
+ public AjaxJson forgetPassword(@Validated ForgetPasswordDto forgetPasswordDto) {
|
|
|
+ return appUserService.forgetPassword(forgetPasswordDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 获取短信验证码 */
|
|
|
+ @RequestMapping("getPhoneSmsCode")
|
|
|
+ public AjaxJson getPhoneSmsCode(String phone) {
|
|
|
+ boolean phoneSmsCode = appUserService.getPhoneSmsCode(phone);
|
|
|
+ if(phoneSmsCode)return AjaxJson.getSuccess(phoneSmsCode + "");
|
|
|
+ return AjaxJson.getError();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|