|
@@ -1,15 +1,16 @@
|
|
package com.sf.controller;
|
|
package com.sf.controller;
|
|
|
|
|
|
|
|
+import com.sf.dto.req.UserLoginReqDto;
|
|
import com.sf.dto.req.UserRegisterReqDto;
|
|
import com.sf.dto.req.UserRegisterReqDto;
|
|
|
|
+import com.sf.dto.resp.UserLoginRespDto;
|
|
import com.sf.dto.resp.UserRegisterRespDto;
|
|
import com.sf.dto.resp.UserRegisterRespDto;
|
|
import com.sf.dto.resp.VerifyCodeRespDto;
|
|
import com.sf.dto.resp.VerifyCodeRespDto;
|
|
-import com.sf.resp.RestResp;
|
|
|
|
|
|
+import com.sf.dto.RestResp;
|
|
import com.sf.service.IUserInfoService;
|
|
import com.sf.service.IUserInfoService;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
-import org.springframework.stereotype.Controller;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -49,4 +50,18 @@ public class UserInfoController {
|
|
logger.info("方法名是:{}, 参数是:{}, 返回结果是:{}", "register", reqDto, respDto);
|
|
logger.info("方法名是:{}, 参数是:{}, 返回结果是:{}", "register", reqDto, respDto);
|
|
return RestResp.ok(respDto);
|
|
return RestResp.ok(respDto);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+
|
|
|
|
+ @PostMapping("/user/login")
|
|
|
|
+ public RestResp<UserLoginRespDto> login(@RequestBody UserLoginReqDto reqDto) {
|
|
|
|
+ logger.info("方法名是:{}, 参数是:{}", "login", reqDto);
|
|
|
|
+ UserLoginRespDto respDto = userInfoService.login(reqDto);
|
|
|
|
+ logger.info("方法名是:{}, 参数是:{}, 返回结果是:{}", "login", reqDto, respDto);
|
|
|
|
+ if (respDto.getType() == 1) {
|
|
|
|
+ return RestResp.fail("00003", "用户名不存在~", respDto);
|
|
|
|
+ }
|
|
|
|
+ if (respDto.getType() == 2) {
|
|
|
|
+ return RestResp.fail("00004", "密码错误~", respDto);
|
|
|
|
+ }
|
|
|
|
+ return RestResp.ok(respDto);
|
|
|
|
+ }
|
|
|
|
+}
|