admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
@@ -7,7 +7,11 @@
import javax.annotation.Resource;
import com.ks.push.pojo.DO.BPushDeviceToken;
import com.ks.push.pojo.DO.PushPlatform;
import com.ks.push.service.BDeviceTokenService;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -109,7 +113,48 @@
   
   @Resource
   private GoodsEvaluateService goodsEvaluateService;
   @Reference(version = "1.0", check = false)
   private BDeviceTokenService bDeviceTokenService;
   /**
    * 店铺列表
    *
    * @param acceptData
    * @param out
    */
   @RequestMapping(value = "bindToken", method = RequestMethod.POST)
   public void bindToken(AcceptData acceptData, Long uid, String type, String token, PrintWriter out) {
      BPushDeviceToken deviceToken = new BPushDeviceToken();
      deviceToken.setAppCode(acceptData.getSystem().name());
      deviceToken.setDeviceId(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid());
      deviceToken.setBuildModel(acceptData.getDeviceType());
      deviceToken.setBuildVersion(acceptData.getOsVersion());
      deviceToken.setToken(token);
      switch (type) {
         case "huawei":
            type = "hw";
            break;
         case "xiaomi":
            type = "xm";
            break;
         case "meizu":
            type = "mz";
            break;
      }
      deviceToken.setType(PushPlatform.valueOf(type));
      deviceToken.setUid(uid + "");
      deviceToken.setVersionCode(Integer.parseInt(acceptData.getVersion()));
      try {
         bDeviceTokenService.save(deviceToken);
         out.print(JsonUtil.loadTrueResult(""));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult("绑定出错:" + e.getMessage()));
         e.printStackTrace();
      }
   }
   @RequestMapping(value = "callback", method = RequestMethod.POST)
   public void callback(AcceptData acceptData, String pushId, PrintWriter out) {
@@ -286,7 +331,7 @@
            if (totalgoods == 1) {
               params = JumpDetailParamsFactory.createGoodsParams(goods.getGoodsId(), goods.getGoodsType());
               jumpDetail = jumpDetailV2Service.getByTypeCache("goodsdetail",Constant.getPlatformCode(acceptData.getPlatform()),
                     Integer.parseInt(acceptData.getVersion()));
                     Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
            } else {
               String url = configService.getValue(ConfigKeyEnum.pushGoodsDetails.getKey(),acceptData.getSystem());
               if (url == null) {
@@ -296,7 +341,7 @@
               params = JumpDetailParamsFactory.createWEBParams(url);
               jumpDetail = jumpDetailV2Service.getByTypeCache("web",Constant.getPlatformCode(acceptData.getPlatform()),
                     Integer.parseInt(acceptData.getVersion()));
                     Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
            }
            totalwords.add(new ClientTextStyleVO("本次推荐共", "#666666"));
@@ -328,7 +373,7 @@
            url = url + "?id=" + id;
            params = JumpDetailParamsFactory.createWEBParams(url);
            jumpDetail = jumpDetailV2Service.getByTypeCache("web",
                  Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()));
                  Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
         } else {
            continue;
         }