admin
2019-10-25 819774494bae0c987bc7cbba5060f98443ff30cc
订单列表订单找回提醒
2个文件已修改
52 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/RedisManager.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java
@@ -43,6 +43,7 @@
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.CMQManager;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
@@ -85,6 +86,9 @@
    @Resource
    private LostOrderService lostOrderService;
    @Resource
    private RedisManager redisManager;
    /**
     * 订单列表
@@ -181,6 +185,14 @@
        if (endTime != null && endTime.trim().length() > 0) {
            endTime += " 23:59:59";
        }
        // 判断是否需要显示订单找回提示
        if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion()))
            if (state == 0 && page == 1) {
                if (redisManager.frequencyLimit("orderlist-" + acceptData.getDevice(), 15, 3)) {// 15秒内请求3次触发
                    // TODO 显示订单找回提醒
                }
            }
        try {
            long count = 0;
@@ -510,7 +522,7 @@
                Date maxGetTime = new Date(nowTime);
                inviteMoney = hongBaoV2CountService.sumAlreadyGetMoneyByUid(uid, inviteTypes, minGetTime, maxGetTime);
                inviteCount = hongBaoV2CountService.countAlreadyGetMoneyByUid(uid, inviteTypes, minGetTime, maxGetTime);
                sharemoney = hongBaoV2CountService.sumAlreadyGetMoneyByUid(uid, shareTypes, minGetTime, maxGetTime);
                shareCount = hongBaoV2CountService.countAlreadyGetMoneyByUid(uid, shareTypes, minGetTime, maxGetTime);
fanli/src/main/java/com/yeshi/fanli/util/RedisManager.java
@@ -266,6 +266,22 @@
        }
    }
    public boolean frequencyLimit(String key, int timeS, int num) {
        key = "frequency-" + key;
        Jedis jedis = jedisPool.getResource();
        try {
            long count = jedis.incr(key);
            if (count == 1)
                jedis.expire(key, timeS);
            if (count >= num)
                return true;
            else
                return false;
        } finally {
            jedisPool.returnResource(jedis);
        }
    }
    /**
     * 获取淘宝图片
     * 
@@ -400,8 +416,8 @@
     * @return
     */
    public String getSMSVCode(String phone, int type) {
//        if (!Constant.IS_OUTNET)
//            return "";
        // if (!Constant.IS_OUTNET)
        // return "";
        String key = "smscode-" + phone + "-" + type;
        // 保存2分钟
        return getString(key);
@@ -415,8 +431,8 @@
     * @param code
     */
    public void clearSMSVCode(String phone, int type) {
//        if (!Constant.IS_OUTNET)
//            return;
        // if (!Constant.IS_OUTNET)
        // return;
        String key = "smscode-" + phone + "-" + type;
        removeKey(key);
    }
@@ -600,11 +616,10 @@
        String value = getCommonString(key);
        return JsonUtil.jsonToList(value, clazz);
    }
    public JDGoods getJDGoods(long goodsId) {
        String key = "jingdong-goods-" + goodsId;
        String value = getCommonString(key);
        if (StringUtil.isNullOrEmpty(value)) {
            JDGoods jdGoods = JDApiUtil.queryGoodsDetail(goodsId);
@@ -615,17 +630,16 @@
            // 缓存20分钟
            if (jdGoods != null)
                cacheCommonString(key, JsonUtil.getSimpleGson().toJson(jdGoods), 60 * 20);
            return jdGoods;
        } else {// 直接取缓存
            return JsonUtil.getSimpleGson().fromJson(value, JDGoods.class);
        }
    }
    public PDDGoodsDetail getPDDGoodsDetail(long goodsId) {
        String key = "pinduoduo-goods-" + goodsId;
        String value = getCommonString(key);
        if (StringUtil.isNullOrEmpty(value)) {
            PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(goodsId);
@@ -633,7 +647,7 @@
            // 缓存20分钟
            if (pddGoods != null)
                cacheCommonString(key, JsonUtil.getSimpleGson().toJson(pddGoods), 60 * 20);
            return pddGoods;
        } else {// 直接取缓存
            return JsonUtil.getSimpleGson().fromJson(value, PDDGoodsDetail.class);