From e257a2834bf7b62af5c5c96f9b0b21fac92f2196 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 24 七月 2021 18:31:02 +0800
Subject: [PATCH] jumpdetail分system

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java |   53 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
index 1436f18..2a13229 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
+++ b/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;
 			}

--
Gitblit v1.8.0