|
@@ -2,7 +2,9 @@ package com.fdkankan.site.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.site.common.BaseController;
|
|
|
+import com.fdkankan.site.common.ResultCode;
|
|
|
import com.fdkankan.site.common.ResultData;
|
|
|
+import com.fdkankan.site.exception.BusinessException;
|
|
|
import com.fdkankan.site.httpClient.client.FdKKClient;
|
|
|
import com.fdkankan.site.httpClient.request.FdkkLoginRequest;
|
|
|
import com.fdkankan.site.httpClient.response.FdkkLoginVo;
|
|
@@ -29,11 +31,16 @@ public class LoginController extends BaseController {
|
|
|
|
|
|
@PostMapping("/fdLogin")
|
|
|
public ResultData fdLogin(@RequestBody FdkkLoginRequest request){
|
|
|
- FdkkResponse<FdkkLoginVo> fdkkLoginVo = fdKKClient.fdkkLogin(request);
|
|
|
- if(fdkkLoginVo.getCode() == 0){
|
|
|
- return ResultData.ok(fdkkLoginVo.getData());
|
|
|
+ try {
|
|
|
+ FdkkResponse<FdkkLoginVo> fdkkLoginVo = fdKKClient.fdkkLogin(request);
|
|
|
+ if(fdkkLoginVo.getCode() == 0){
|
|
|
+ return ResultData.ok(fdkkLoginVo.getData());
|
|
|
+ }
|
|
|
+ return ResultData.error(fdkkLoginVo.getCode(),fdkkLoginVo.getMsg());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- return ResultData.error(fdkkLoginVo.getCode(),fdkkLoginVo.getMsg());
|
|
|
+ throw new BusinessException(ResultCode.FD_ERROR);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/fdLogout")
|
|
@@ -48,6 +55,11 @@ public class LoginController extends BaseController {
|
|
|
*/
|
|
|
@PostMapping("/getUserInfo")
|
|
|
public ResultData getUserInfo(){
|
|
|
- return ResultData.ok(fdKKClient.getUserInfo(new JSONObject(),getToken()).getData());
|
|
|
+ try {
|
|
|
+ return ResultData.ok(fdKKClient.getUserInfo(new JSONObject(), getToken()).getData());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ throw new BusinessException(ResultCode.USER_NOT_LOGIN);
|
|
|
}
|
|
|
}
|