Commit 01a81e991bb786096a6dbf27f863ec65cea43378

Authored by landong2015
1 parent d129c54f93
Exists in master

修改获取token方式

Showing 1 changed file with 5 additions and 2 deletions

webApi/src/main/java/com/lyms/yimiao/web/controller/v1/FeedbackController.java View file @ 01a81e9
... ... @@ -12,6 +12,7 @@
12 12 import com.lymsh.yimiao.main.data.service.YmFeedBacksService;
13 13 import com.lymsh.yimiao.main.data.service.YmUsersService;
14 14 import com.lymsh.yimiao.main.data.util.JsonUtil;
  15 +import com.lymsh.yimiao.main.data.util.LoginContext;
15 16 import org.springframework.beans.factory.annotation.Autowired;
16 17 import org.springframework.stereotype.Controller;
17 18 import org.springframework.util.StringUtils;
... ... @@ -19,6 +20,7 @@
19 20 import org.springframework.web.bind.annotation.RequestMethod;
20 21 import org.springframework.web.bind.annotation.RequestParam;
21 22  
  23 +import javax.servlet.http.HttpServletRequest;
22 24 import javax.servlet.http.HttpServletResponse;
23 25 import java.util.Date;
24 26 import java.util.HashMap;
... ... @@ -46,6 +48,7 @@
46 48 @RequestMapping(value = "/feedBacks", method = RequestMethod.POST)
47 49 @TokenRequired
48 50 public void submitFeedBack(@RequestParam("content") String content,
  51 + HttpServletRequest request,
49 52 HttpServletResponse httpServletResponse) {
50 53  
51 54 if (StringUtils.isEmpty(content)) {
... ... @@ -53,8 +56,8 @@
53 56 return;
54 57 }
55 58  
56   - MommyBobyContext mommyBobyContext = ContextHolder.getContext();
57   - Integer userId = mommyBobyContext.getUserId();
  59 + LoginContext loginContext = (LoginContext) request.getAttribute("loginContext");
  60 + Integer userId = loginContext.getId();
58 61 if (null != userId) {
59 62  
60 63 YmFeedBacks feedBacks = new YmFeedBacks();