소스 검색

http://192.168.0.21/index.php?m=bug&f=view&bugID=25913
添加token

tianboguang 3 년 전
부모
커밋
98cbd16a3e

+ 1 - 1
platform-api/src/main/java/com/platform/api/ApiBrandController.java

@@ -111,7 +111,7 @@ public class ApiBrandController extends ApiBaseAction {
             case 11:
             case 12:
             case 13:
-                List<BrandVo> list = zhiHouseService.queryRecomendsByType(type).parallelStream().map(entity->{
+                List<BrandVo> list = zhiHouseService.queryRecomendsByType(type,request.getHeader(AuthorizationInterceptor.LOGIN_TOKEN_KEY)).parallelStream().map(entity->{
                     BrandVo vo = new BrandVo();
                     vo.setName(entity.getString("title"));
                     vo.setId(entity.getInteger("connectId"));

+ 5 - 2
platform-common/src/main/java/com/platform/service/impl/ZhiHouseService.java

@@ -288,11 +288,14 @@ public class ZhiHouseService {
         return list;
     }
 
-    public Collection<JSONObject> queryRecomendsByType(Integer type){
+    public Collection<JSONObject> queryRecomendsByType(Integer type,String token){
         Map<String, Object> mp = new HashMap<>();
         mp.put("type", type);
         String url = zhiHouseHost + "recommend/selectByType";
-        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        HttpHeaders headers = new HttpHeaders();
+        headers.add("token", token);
+        HttpEntity<Object> formEntity = new HttpEntity<>(mp, headers);
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, formEntity,ReturnDTO.class);
         if(responseEntity.getStatusCode()!= HttpStatus.OK){
             throw new CommonBaseException(ResultCodeEnum.D100);
         }