|
|
@ -112,16 +112,15 @@ public class PluginOperateUtils { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
// HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword);
|
|
|
|
if (StringUtils.isBlank(keyword)) { |
|
|
|
if(StringUtils.isBlank(keyword)){ |
|
|
|
|
|
|
|
getRecommendPlugins(jsCallback); |
|
|
|
getRecommendPlugins(jsCallback); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
HttpClient httpClient = new HttpClient("http://shop.finereport.com/searchApi?type=all" + "&keyword=" + keyword); |
|
|
|
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword); |
|
|
|
httpClient.asGet(); |
|
|
|
httpClient.asGet(); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("result"); |
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("result"); |
|
|
|
jsCallback.execute(jsonArray.toString()); |
|
|
|
jsCallback.execute(jsonArray.toString()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
@ -135,40 +134,39 @@ public class PluginOperateUtils { |
|
|
|
new Thread(new Runnable() { |
|
|
|
new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
// String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist");
|
|
|
|
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?"; |
|
|
|
String plistUrl = "http://shop.finereport.com/plugins" + "?"; |
|
|
|
|
|
|
|
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee); |
|
|
|
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee); |
|
|
|
if (getRecommend) { |
|
|
|
if (getRecommend) { |
|
|
|
getRecommendPlugins(jsCallback); |
|
|
|
getRecommendPlugins(jsCallback); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(plistUrl)) { |
|
|
|
if (StringUtils.isNotBlank(plistUrl)) { |
|
|
|
StringBuilder url = new StringBuilder(); |
|
|
|
StringBuilder url = new StringBuilder(); |
|
|
|
url.append(plistUrl); |
|
|
|
url.append(plistUrl); |
|
|
|
dealParams(url, category, seller, fee); |
|
|
|
dealParams(url, category, seller, fee); |
|
|
|
try { |
|
|
|
try { |
|
|
|
HttpClient httpClient = new HttpClient(url.toString()); |
|
|
|
HttpClient httpClient = new HttpClient(url.toString()); |
|
|
|
httpClient.asGet(); |
|
|
|
httpClient.asGet(); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
JSONObject resultJSONObject = new JSONObject(result); |
|
|
|
JSONObject resultJSONObject = new JSONObject(result); |
|
|
|
JSONArray resultArr = resultJSONObject.getJSONArray("result"); |
|
|
|
JSONArray resultArr = resultJSONObject.getJSONArray("result"); |
|
|
|
jsCallback.execute(resultArr.toString()); |
|
|
|
jsCallback.execute(resultArr.toString()); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
String result = PluginConstants.CONNECTION_404; |
|
|
|
|
|
|
|
jsCallback.execute(result); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).start(); |
|
|
|
}).start(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void getRecommendPlugins(JSCallback jsCallback){ |
|
|
|
public static void getRecommendPlugins(JSCallback jsCallback) { |
|
|
|
String plistUrl = "http://shop.finereport.com/ShopServer?pg=feature"; |
|
|
|
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.feature"); |
|
|
|
try { |
|
|
|
try { |
|
|
|
HttpClient httpClient = new HttpClient(plistUrl.toString()); |
|
|
|
HttpClient httpClient = new HttpClient(plistUrl.toString()); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
|
String result = httpClient.getResponseText(); |
|
|
@ -179,7 +177,7 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void dealParams(StringBuilder url, String category, String seller, String fee){ |
|
|
|
public static void dealParams(StringBuilder url, String category, String seller, String fee) { |
|
|
|
if (StringUtils.isNotBlank(category)) { |
|
|
|
if (StringUtils.isNotBlank(category)) { |
|
|
|
url.append("cid=").append(category.split("-")[1]); |
|
|
|
url.append("cid=").append(category.split("-")[1]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -216,7 +214,7 @@ public class PluginOperateUtils { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
String result; |
|
|
|
String result; |
|
|
|
String url = "http://shop.finereport.com/shopServer?pg=category"; |
|
|
|
String url = SiteCenter.getInstance().acquireUrlByKind("shop.plugin.category"); |
|
|
|
if (url != null) { |
|
|
|
if (url != null) { |
|
|
|
HttpClient httpClient = new HttpClient(url); |
|
|
|
HttpClient httpClient = new HttpClient(url); |
|
|
|
result = httpClient.getResponseText(); |
|
|
|
result = httpClient.getResponseText(); |
|
|
|