瀏覽代碼

接口api

liulingchao 4 年之前
父節點
當前提交
d25d5621c3

+ 22 - 0
dgtly-member/dgtly-member-api/src/main/java/com/dgtly/member/controller/MemberInfoController.java

@@ -2,12 +2,14 @@ package com.dgtly.member.controller;
 
 import com.auth0.jwt.JWT;
 import com.auth0.jwt.algorithms.Algorithm;
+import com.dgtly.apiframework.util.TokenUtil;
 import com.dgtly.common.annotation.ApiNoCheckSign;
 import com.dgtly.common.annotation.ApiPassToken;
 import com.dgtly.common.core.controller.ApiBaseController;
 import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.core.domain.ParameterObject;
 import com.dgtly.common.utils.DateUtils;
+import com.dgtly.common.utils.StringUtils;
 import com.dgtly.member.domain.MemberInfo;
 import com.dgtly.member.service.IMemberInfoService;
 import com.google.code.kaptcha.Constants;
@@ -104,4 +106,24 @@ public class MemberInfoController extends ApiBaseController {
        return AjaxResult.error(303,"验证码错误");
 
     }
+
+    /**
+     * @descption: 根据token获取会员信息
+     * @param: token
+     * @return:
+     * @auther: LiuLingChao
+     * @date: 2020-2-26 22:16
+     */
+    @PostMapping("/getMemberInfo")
+    public Object getMemberInfo(){
+        String userId  = TokenUtil.getTokenUserId();
+
+        if(StringUtils.isNotEmpty(userId)){
+            MemberInfo memberInfo = iMemberInfoService.selectMemberInfoById(Long.parseLong(userId));
+            return AjaxResult.success().putKV("memberInfo",memberInfo);
+        }else{
+            return AjaxResult.error(305,"根据token获取用户id出错");
+        }
+
+    }
 }