...
|
...
|
@@ -22,9 +22,6 @@ public class GuessLikeResourceParse implements IResourceParse { |
|
|
|
|
|
public static final String TEMPLATE_NAME="guessLike";
|
|
|
|
|
|
@javax.annotation.Resource
|
|
|
private MakeUrlService makeUrlService;
|
|
|
|
|
|
@Override
|
|
|
public Serializable parse(Resource resource) {
|
|
|
try {
|
...
|
...
|
@@ -46,11 +43,29 @@ public class GuessLikeResourceParse implements IResourceParse { |
|
|
JSONObject list = data.getJSONObject("data").getJSONObject("list");
|
|
|
for (String key : list.keySet()) {
|
|
|
JSONObject value = list.getJSONObject(key);
|
|
|
|
|
|
// 用query的json 代替原来的k=1&v=2
|
|
|
value.put("query",getQueryArray(value.getString("query")));
|
|
|
|
|
|
value.put("tab_name", value.getString("tab_name"));
|
|
|
value.put("url", makeUrlService.makeUrl(value.getJSONObject("url"), resource.getClientType()));
|
|
|
}
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
private JSONArray getQueryArray(String queryParam) {
|
|
|
if (StringUtils.isBlank(queryParam)){
|
|
|
return new JSONArray();
|
|
|
}
|
|
|
|
|
|
JSONArray queryArray = new JSONArray();
|
|
|
// k1=v1&k2=v2
|
|
|
String[] kys = queryParam.split("&");
|
|
|
for (String ky : kys){
|
|
|
JSONObject queryObj = new JSONObject();
|
|
|
String[] kvItem = ky.split("=");
|
|
|
queryObj.put(kvItem[0], kvItem[1]);
|
|
|
queryArray.add(queryObj);
|
|
|
}
|
|
|
return queryArray;
|
|
|
}
|
|
|
} |
...
|
...
|
|