yujian
2019-08-27 d8359ddb48dab5cc797a9d552e11fde571f4920c
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -35,7 +35,6 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
import com.yeshi.fanli.exception.integral.IntegralGetException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.user.TokenRecordException;
import com.yeshi.fanli.log.LogHelper;
@@ -57,6 +56,7 @@
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.Utils;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.cache.IntegralGetCacheManager;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
@@ -119,6 +119,9 @@
   @Resource
   private IntegralGetService integralGetService;
   @Resource
   private IntegralGetCacheManager integralGetCacheManager;
   /**
    * 粘贴板信息推荐
@@ -415,6 +418,7 @@
   @RequestMapping(value = "searchGoods")
   public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
         Integer order, Long uid, HttpSession session, PrintWriter out) {
      if (goodsType == null || goodsType < 1 || goodsType > 3) {
         out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
         return;
@@ -433,24 +437,18 @@
      if (uid != null) {
         if (page == 1) {
            session.setAttribute("searchFirstTime", System.currentTimeMillis());
         } else if (page == 2) {
            Long lastTime = (Long) session.getAttribute("searchFirstTime");
            integralGetCacheManager.cacheSearchGoods(acceptData.getDevice(), System.currentTimeMillis());
         } else if (page > 1) {
            Long lastTime = integralGetCacheManager.getLastSearchTime(acceptData.getDevice());
            if (lastTime != null && System.currentTimeMillis() - lastTime >= 15 * 1000L) {// 超过15s浏览
               integralGetCacheManager.clearSearchTime(acceptData.getDevice());
               ThreadUtil.run(new Runnable() {
                  @Override
                  public void run() {
                     try {
                        // 增加金币
                        integralGetService.addSearchResultScan(uid,key);
                     } catch (IntegralGetException e) {
                        e.printStackTrace();
                     }
                     // 增加金币
                     integralGetService.addSearchResultScan(uid, key);
                  }
               });
            }
         }
      }