Browse Source

fix 处理对外接口

tjf 3 years ago
parent
commit
1882b2be72

+ 1 - 0
boman-common/boman-common-redis/src/main/java/com/boman/common/redis/RedisKey.java

@@ -44,4 +44,5 @@ public class RedisKey {
     public static final String CHINA_AREA = "CHINA_AREA";
     /** 外部访问接口的次数限制 key **/
     public static final String IP_TIMES = "IP:TIMES:";
+    public static final String APPID_TIMES = "APPID:TIMES=";
 }

+ 6 - 7
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -49,8 +49,7 @@ import java.util.concurrent.TimeUnit;
 import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.fieldTranslator.IdCardUtils.getSex;
 import static com.boman.common.core.utils.obj.ObjectUtils.*;
-import static com.boman.common.redis.RedisKey.IP_TIMES;
-import static com.boman.common.redis.RedisKey.STS_CZRK_;
+import static com.boman.common.redis.RedisKey.*;
 import static com.boman.web.core.utils.IdCardUtils.getAge;
 import static com.google.common.base.Strings.nullToEmpty;
 
@@ -1071,14 +1070,14 @@ public class CzrkServiceImpl implements ICzrkService {
 
         long time = DateUtils.getTodayEnd().getTime(), time1 = DateUtils.getNowDate().getTime();
         redisService.setCacheObject(redisKey, cacheTimes, ((time - time1) / 1000), TimeUnit.SECONDS);
-/*        packAddr(Collections.singletonList(czrk));
+        packAddr(czrk);
 
         CzrkJzdz czrkJzdz = new CzrkJzdz();
-        czrkJzdz.setCzrkId(czrk.getId());
+        czrkJzdz.setCzrkId(czrk.getLong("id"));
         List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzList(czrkJzdz);
         packCzrkJzdzAddr(czrkJzdzList);
-        czrk.setCzrkJzdzList(czrkJzdzList);
-        log.info("appKey:{}, appSecret:{}, idCard:{}, 查询到信息,czrk:{}", appKey, appSecret, idCard, JSON.toJSONString(czrk));*/
+        czrk.put("czrkJzdzList", czrkJzdzList);
+        log.info("appKey:{}, appSecret:{}, idCard:{}, 查询到信息,czrk:{}", appKey, appSecret, idCard, JSON.toJSONString(czrk));
         return AjaxResult.success(czrk);
     }
 
@@ -1145,7 +1144,7 @@ public class CzrkServiceImpl implements ICzrkService {
             }
         }
         String today = DateUtils.getDate();
-        String redisKey = IP_TIMES + ip + ":" + today;
+        String redisKey = APPID_TIMES + appId + ":" + today;
         Integer cacheTimes = redisService.getCacheObject(redisKey);
         if (cacheTimes == null) cacheTimes = 0;
         int times = ipTimes.getIntValue("times");