From 4f015b8c624484e0c3b2d88b944163ce43a48d1f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 27 十一月 2021 17:15:28 +0800
Subject: [PATCH] 功能完善

---
 app/src/main/java/com/yeshi/location/app/controller/client/api/UserController.java |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/app/src/main/java/com/yeshi/location/app/controller/client/api/UserController.java b/app/src/main/java/com/yeshi/location/app/controller/client/api/UserController.java
index 84e8852..8f946d5 100644
--- a/app/src/main/java/com/yeshi/location/app/controller/client/api/UserController.java
+++ b/app/src/main/java/com/yeshi/location/app/controller/client/api/UserController.java
@@ -3,9 +3,16 @@
 import com.yeshi.location.app.dto.user.LoginInfoDTO;
 import com.yeshi.location.app.entity.user.UserInfo;
 import com.yeshi.location.app.entity.user.UserLoginRecord;
+import com.yeshi.location.app.entity.vip.UserVIPInfo;
 import com.yeshi.location.app.exception.user.LoginException;
 import com.yeshi.location.app.service.inter.user.UserAccountService;
+import com.yeshi.location.app.service.inter.user.UserInfoService;
+import com.yeshi.location.app.service.inter.vip.VIPService;
+import com.yeshi.location.app.utils.ApiCodeConstant;
+import com.yeshi.location.app.utils.annotation.UserLogin;
 import com.yeshi.location.app.vo.AcceptData;
+import com.yeshi.location.app.vo.user.UserInfoVO;
+import net.sf.json.util.JSONUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
@@ -27,6 +34,12 @@
     @Resource
     private UserAccountService userAccountService;
 
+    @Resource
+    private UserInfoService userInfoService;
+
+    @Resource
+    private VIPService vipService;
+
     @ResponseBody
     @RequestMapping("loginPhone")
     public String loginPhone(AcceptData acceptData, String phone, String vcode, String token) {
@@ -40,7 +53,7 @@
             loginInfo.setPhone(phone);
             loginInfo.setVcode(vcode);
 
-        } else if (StringUtil.isNullOrEmpty(token)) {
+        } else if (!StringUtil.isNullOrEmpty(token)) {
             loginInfo.setPhoneAuthInfo(token);
         } else {
             return JsonUtil.loadFalseResult("淇℃伅涓嶅畬鏁�");
@@ -55,5 +68,43 @@
 
     }
 
+    @UserLogin(uid = "#uid")
+    @ResponseBody
+    @RequestMapping("logout")
+    public String logout(AcceptData acceptData, Long uid) {
+        return JsonUtil.loadTrueResult("");
+    }
+
+
+    @UserLogin(uid = "#uid")
+    @ResponseBody
+    @RequestMapping("getUserInfo")
+    public String getUserInfo(AcceptData acceptData, Long uid) {
+
+        UserInfo user = userInfoService.get(uid);
+
+        if (user == null) {
+            return JsonUtil.loadFalseResult("鐢ㄦ埛涓嶅瓨鍦�");
+        }
+        if (user.getStatus() == UserInfo.STATUS_FORBIDDEN) {
+            return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_FORBIDDEN, "璐﹀彿琚皝绂�");
+        }
+
+        if (user.getStatus() == UserInfo.STATUS_OWN_DELETE) {
+            return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_DELETE, "鐢ㄦ埛宸茶鍒犻櫎");
+        }
+
+        UserInfoVO vo = new UserInfoVO();
+        vo.setId(user.getId() + "");
+        vo.setNickName(user.getNickName());
+        vo.setPortrait(user.getPortrait());
+
+        UserVIPInfo userVIPInfo = vipService.getVIPInfo(user.getId());
+        if (userVIPInfo != null) {
+            vo.setVipExpireTime(userVIPInfo.getExpireDate().getTime());
+        }
+        return JsonUtil.loadTrueResult(vo);
+    }
+
 
 }

--
Gitblit v1.8.0