From 4114e871bcb3dce771b6aed64a1027d0bbb95ca6 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 16 五月 2019 15:28:37 +0800
Subject: [PATCH] 增加动态用户

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java
index 34601eb..02c4e33 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/SystemClientController.java
@@ -5,10 +5,12 @@
 import java.util.List;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.beanutils.PropertyUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.yeshi.utils.IPUtil;
 import org.yeshi.utils.JsonUtil;
 
 import com.google.gson.Gson;
@@ -46,19 +48,20 @@
 
 	@Resource
 	private DeviceActiveService deviceActiveService;
-	
+
 	@Resource
 	private CustomerContentService customerContentService;
 
 	@RequestMapping("getsystemclientparams")
-	public void getSystemClientParams(AcceptData acceptData, PrintWriter out) {
-		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
+	public void getSystemClientParams(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
+		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
+				acceptData.getPackages());
 		if (system == null) {
 			out.print("绯荤粺涓嶅瓨鍦�");
 			return;
 		}
 		List<SystemClientParams> systemClientParamsList = systemClientParamsService
-				.getSystemClientParamsBySystemId(system.getId(),Integer.parseInt(acceptData.getVersion()));
+				.getSystemClientParamsBySystemId(system.getId(), Integer.parseInt(acceptData.getVersion()));
 		if (systemClientParamsList == null || systemClientParamsList.size() == 0) {
 			out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
 			return;
@@ -84,7 +87,7 @@
 					// 鑰佺増鏈瑆eex锛�1.5.1涔嬪墠鐨勶級
 					ssp.setValue("http://ec-1255749512.file.myqcloud.com/resource/weex/flq_index_v2.js");
 				} else if ("ios".equalsIgnoreCase(acceptData.getPlatform())
-						&& Integer.parseInt(acceptData.getVersion()) < 44&&system.getId().longValue()!=5L)
+						&& Integer.parseInt(acceptData.getVersion()) < 44 && system.getId().longValue() != 5L)
 					ssp.setValue("http://ec-1255749512.file.myqcloud.com/resource/weex/flq_index_v2.js");
 			}
 			list.add(ssp);
@@ -95,19 +98,19 @@
 		data.put("count", list.size());
 		data.put("systemClientParamsList", gson.toJson(list));
 		out.print(JsonUtil.loadTrueResult(data));
+		String ipInfo = IPUtil.getRemotIP(request) + ":" + request.getRemotePort();
 		ThreadUtil.run(new Runnable() {
 			@Override
 			public void run() {
 				try {
 					// 瀹夊崜骞冲彴娣诲姞璁惧娲昏穬璁板綍
-					if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
-						DeviceActive da = new DeviceActive();
-						da.setDevice(acceptData.getDevice());
-						da.setPlatform(DeviceActive.PLATFORM_ANDROID);
-						da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
-						deviceActiveService.addDeviceActive(da);
-					}
-
+					DeviceActive da = new DeviceActive();
+					da.setDevice(acceptData.getDevice());
+					da.setPlatform("android".equalsIgnoreCase(acceptData.getPlatform()) ? DeviceActive.PLATFORM_ANDROID
+							: DeviceActive.PLATFORM_IOS);
+					da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
+					da.setIpInfo(ipInfo);
+					deviceActiveService.addDeviceActive(da);
 				} catch (Exception e) {
 				}
 			}

--
Gitblit v1.8.0