From 69bee82b81626b82b7f39f0e459e4f56b1699b51 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 13 三月 2019 12:02:16 +0800
Subject: [PATCH] 正式数据库修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java |   63 ++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 22 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
index 47776f8..8174bca 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/config/ConfigServiceImpl.java
@@ -12,6 +12,7 @@
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.yeshi.utils.entity.ProxyIP;
 
 import com.google.gson.Gson;
 import com.yeshi.fanli.dao.config.ConfigDao;
@@ -35,42 +36,41 @@
 
 	@Override
 	public List<Config> listObjects(String key, int page) {
-		int start = (page-1) * Constant.PAGE_SIZE;
-		StringBuffer hqlBuf=new StringBuffer("from Config pr where 1=1 ");
-		
-		if(key !=null && !"".equals(key.trim())){
+		int start = (page - 1) * Constant.PAGE_SIZE;
+		StringBuffer hqlBuf = new StringBuffer("from Config pr where 1=1 ");
+
+		if (key != null && !"".equals(key.trim())) {
 			hqlBuf.append(" and (pr.name like ? )");
 		}
-	
+
 		hqlBuf.append(" order by pr.id desc ");
 		String hql = hqlBuf.toString();
-		if(hql.contains("pr.name")){
-			return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[]{"%"+key+"%"});
+		if (hql.contains("pr.name")) {
+			return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[] { "%" + key + "%" });
 		} else {
-			return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[]{});
+			return configDao.list(hqlBuf.toString(), start, Constant.PAGE_SIZE, new Serializable[] {});
 		}
-		
+
 	}
-	
+
 	@Override
 	public int getCount(String key, int page) {
-		
-		StringBuffer hqlBuf=new StringBuffer("select count(*) from Config pr where 1=1 ");
-		
-		if(key !=null && !"".equals(key.trim())){
+
+		StringBuffer hqlBuf = new StringBuffer("select count(*) from Config pr where 1=1 ");
+
+		if (key != null && !"".equals(key.trim())) {
 			hqlBuf.append(" and (pr.name like ? )");
 		}
-	
+
 		String hql = hqlBuf.toString();
-		
-		if(hql.contains("pr.name")){
-			return (int) configDao.getCount(hqlBuf.toString(),new Serializable[]{"%"+key+"%"});
+
+		if (hql.contains("pr.name")) {
+			return (int) configDao.getCount(hqlBuf.toString(), new Serializable[] { "%" + key + "%" });
 		} else {
-			return (int) configDao.getCount(hqlBuf.toString(), new Serializable[]{});
+			return (int) configDao.getCount(hqlBuf.toString(), new Serializable[] {});
 		}
 	}
 
-	
 	@CacheEvict(value = "config", allEntries = true)
 	@Transactional
 	public void update(List<Config> list) {
@@ -142,6 +142,8 @@
 	@Override
 	public String getH5Host() {
 		String value = get("h5_url");
+		String[] sts = value.split(",");
+		value = sts[(int) (sts.length * Math.random())];
 		return value.trim();
 	}
 
@@ -186,10 +188,27 @@
 		String value = get("home_weex_url");
 		return value;
 	}
-	
+
 	@Override
 	public Config getConfig(long id) {
 		return configDao.find(Config.class, id);
 	}
-	
+
+	@Override
+	public ProxyIP getTaoBaoProxyIP() {
+		String value = get("taobao_proxy_ip");
+		try {
+			String[] sts = value.split(":");
+			return new ProxyIP(sts[0], Integer.parseInt(sts[1]));
+		} catch (Exception e) {
+		}
+		return null;
+	}
+
+	@Override
+	public String getAppHomeFloatNotifyImg() {
+
+		return get("home_float_notify_img");
+	}
+
 }

--
Gitblit v1.8.0