From bbe1a381f99d957d003f48b68dfd5bf0e401f5f0 Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 14 五月 2019 11:27:25 +0800
Subject: [PATCH] 合并

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java |  174 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 171 insertions(+), 3 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java
index c2602a8..4024031 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java
@@ -7,11 +7,20 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.encrypt.DESUtil;
 
 import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
 import com.yeshi.fanli.entity.config.AppHomeFloatImg;
+import com.yeshi.fanli.entity.taobao.ClientTBPid;
 import com.yeshi.fanli.service.inter.config.ConfigService;
-import org.yeshi.utils.JsonUtil;
+import com.yeshi.fanli.service.inter.homemodule.FloatADService;
+import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
+import com.yeshi.fanli.service.inter.user.TBPidService;
+import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.StringUtil;
 
 import net.sf.json.JSONObject;
 
@@ -28,6 +37,19 @@
 	@Resource
 	private ConfigService configService;
 
+	@Resource
+	private TBPidService tbPidService;
+
+	@Resource
+	private TaoBaoUnionConfigService taoBaoUnionConfigService;
+
+	@Resource
+	private UserInfoExtraService userInfoExtraService;
+
+	@Resource
+	private FloatADService floatADService;
+	
+	
 	/**
 	 * 棣栭〉閰嶇疆淇℃伅
 	 * 
@@ -35,12 +57,158 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "getHomeConfig", method = RequestMethod.POST)
-	public void getHomeConfig(AcceptData acceptData, PrintWriter out) {
+	public void getHomeConfig(AcceptData acceptData, Long uid, PrintWriter out) {
 		AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg();
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) {
+			appHomeFloatImg = null;
+		}
+		
 		JSONObject data = new JSONObject();
-		if (appHomeFloatImg != null)
+		if (appHomeFloatImg != null) {
 			data.put("floatImg", appHomeFloatImg);
+		}
+		
+		String notifyImg = configService.getAppHomeFloatNotifyImg();
+		if (!StringUtil.isNullOrEmpty(notifyImg)) {
+			data.put("floatNotifyImg", notifyImg);
+		}
+		
+		// 鎮诞澶у浘 1.5.2  -2019.3.20
+		FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX);
+		if (floatAD != null) {
+			JSONObject detail = new JSONObject();
+			detail.put("img", floatAD.getPicture());
+			detail.put("jumpDetail", floatAD.getJumpDetail());
+			detail.put("params", floatAD.getParams());
+			detail.put("showTime", floatAD.getShowMode());
+			detail.put("accountLogin", floatAD.isJumpNeedLogin());
+			
+			if (uid != null && userInfoExtraService.isNewUser(uid)) {
+				// 鏂扮敤鎴�
+				data.put("floatImgDetail", detail);
+			} else {
+				data.put("floatImgDetail", detail);
+			}
+		}
+		
+		// 棰嗗埜甯姪閾炬帴,1.5.2鍚庣敓鏁�
+		String couponHelp = configService.get("taobao_coupon_help");
+		data.put("couponHelpUrl", couponHelp);
+		
+		// 搴曢儴缃戦〉閾炬帴
+		String platform = acceptData.getPlatform();
+		if ("android".equalsIgnoreCase(platform)) {
+			data.put("htmlLink", configService.get("index_html_link_android"));
+		}
+
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
+	@RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST)
+	public void getTaoBaoCartConfig(AcceptData acceptData, Long uid, PrintWriter out) {
+		if (uid == null || uid <= 0) {
+			out.print(JsonUtil.loadFalseResult("鐢ㄦ埛灏氭湭鐧诲綍"));
+			return;
+		}
+
+		ClientTBPid clientTBPid = null;
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+			clientTBPid = tbPidService.getIOSDefault();
+		} else {
+			clientTBPid = tbPidService.getAndroidDefault();
+		}
+
+		String cartJS = configService.get("taobao_cart_js");
+		String cartUrl = configService.get("taobao_cart_link");
+		String js = null;
+		String link = null;
+		try {
+			js = DESUtil.encode(cartJS, StringUtil.getBase64String("YeShiFANLI889*+"),
+					StringUtil.getBase64String("*M#34f?,"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		try {
+			link = DESUtil.encode(cartUrl, StringUtil.getBase64String("YeShiFANLI889*+"),
+					StringUtil.getBase64String("*M#34f?,"));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		JSONObject data = new JSONObject();
+		data.put("js", js);
+		data.put("link", link);
+		data.put("tbPidInfo", clientTBPid);
+		out.print(JsonUtil.loadTrueResult(data));
+	}
+
+	@RequestMapping(value = "getWebConfig", method = RequestMethod.POST)
+	public void getWebConfig(AcceptData acceptData, String url, PrintWriter out) {
+		JSONObject data = new JSONObject();
+		if (url != null && (url.contains("s.click") || url.contains("taobao.com") || url.contains("tmall.com"))) {
+			data.put("baichuan", true);// 閲囩敤闃块噷鐧惧窛鐨勬柟寮忓姞杞絯ebview
+			data.put("goodsDetail", true);// 闇�瑕佹嫤鎴晢鍝佽鎯�
+		} else {
+			data.put("baichuan", false);// 涓嶉渶瑕侀噰鐢ㄩ樋閲岀櫨宸濈殑鏂瑰紡鍔犺浇webview
+			data.put("goodsDetail", false);// 涓嶉渶瑕佹嫤鎴晢鍝佽鎯�
+		}
+		out.print(JsonUtil.loadTrueResult(data));
+	}
+
+	/**
+	 * 鑾峰彇璐﹀彿缁戝畾涓殑閰嶇疆淇℃伅
+	 * 
+	 * @param acceptData
+	 * @param uid
+	 * @param out
+	 */
+
+	@RequestMapping(value = "getBindAccountConfig", method = RequestMethod.POST)
+	public void getBindAccountConfig(AcceptData acceptData, PrintWriter out) {
+		String alipayHelpUrl = configService.get("alipay_help");// 鏀粯瀹濆府鍔�
+		String alipayBindFailUrl = configService.get("alipay_bind_fail_reason");// 鏀粯瀹濈粦瀹氬け璐ュ師鍥�
+		JSONObject data = new JSONObject();
+		data.put("alipayHelp", alipayHelpUrl);
+		data.put("alipayBindFailReason", alipayBindFailUrl);
+		out.print(JsonUtil.loadTrueResult(data));
+	}
+
+	@RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
+	public void getUserConfig(AcceptData acceptData, PrintWriter out) {
+		try {
+			// 鐢ㄦ埛鍗忚閾炬帴
+			String serviceProtocol = configService.get("service_protocol_link");
+			// 闅愮鏉℃閾炬帴
+			String privacyProtocol = configService.get("privacy_protocol_link");
+			JSONObject data = new JSONObject();
+			data.put("serviceProtocolLink", serviceProtocol);
+			data.put("privacyProtocolLink", privacyProtocol);
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("鑾峰彇澶辫触"));
+			e.printStackTrace();
+		}
+		
+	}
+	
+	/**
+	 * 璁㈠崟瑙f瀽閰嶇疆
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping(value = "getOrderParseConfig", method = RequestMethod.POST)
+	public void getOrderParseConfig(AcceptData acceptData, PrintWriter out) {
+		String orderJS = "var orderId= document.getElementById('tp-bought-root').getElementsByClassName('js-order-container')[0].getElementsByTagName('div')[0].getAttribute('data-id');";
+		orderJS += "if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href='yestv://taobaoorder#'+orderId;} else {window.handle.showOrder(orderId)}";
+		JSONObject data = new JSONObject();
+		try {
+			data.put("orderJS", DESUtil.encode(orderJS, StringUtil.getBase64String("YeShiFANLI889*+"),
+					StringUtil.getBase64String("*M#34f?,")));
+			data.put("orderUrl", DESUtil.encode( "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm",StringUtil.getBase64String("YeShiFANLI889*+"),
+					StringUtil.getBase64String("*M#34f?,")));
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		out.print(JsonUtil.loadTrueResult(data));
+	}
 }

--
Gitblit v1.8.0