MCPcopy Create free account
hub / github.com/SEBV1/idlefish_monitor / call

Method call

src/main/java/com/github/threading/SearchTask.java:60–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58 }
59
60 @Override
61 public List<SearchView> call() throws Exception {
62 List<SearchView> searchViewList = new ArrayList<>();
63 String json = (String) redisTemplate.opsForValue().get("keywords");
64 if (json != null) {
65 List<Keywords> keywordsList = JSONObject.parseObject(json, new TypeReference<List<Keywords>>() {
66 });
67 for (Keywords item : keywordsList) {
68 SearchRequest searchRequest = getSearchRequest(item);
69 assert searchRequest != null;
70 searchRequest.rowsPerPage = searchRequest.pageNumber * searchRequest.rowsPerPage;
71 String titleFilter = getTitleFilter(item);
72 String sellFilter = getSellFilter(item);
73
74 String t = String.valueOf(System.currentTimeMillis() / 1000);
75 String dataJson = JSONObject.toJSONString(searchRequest);
76 Map<String, String> param = RequestParamBuilder.builderParam(t, dataJson, CommonConstants.searchApi);
77 String input = MapConvert.convertInnerBaseStrMap(CommonConstants.appKey, param, true).get("INPUT").toString();
78 Map<String, String> signResult = jnicLibraryV7_18_92ServiceWorker.doCommandNative_70102(CommonConstants.appKey, input, CommonConstants.searchApi).get();
79
80 try {
81
82 String cookie = Optional.ofNullable(redisTemplate.opsForValue().get("cookie"))
83 .map(Object::toString)
84 .orElse(null);
85 Map<String, String> headers = RequestParamBuilder.builderHeaders(signResult.get("x-sgext"), signResult.get("x-sign"), signResult.get("x-mini-wua"), t, signResult.get("x-umt"), cookie);
86 param.clear();
87 param.put("data", URLEncoder.encode(dataJson, "UTF-8"));
88 String url = "https://acs.m.goofish.com/gw/mtop.taobao.idlemtopsearch.search/1.0/";
89 JSONArray resultList = JSONObject.parseObject(OkHttpUtil.postForm(url, headers, dataJson)).getJSONObject("data").getJSONArray("resultList");
90 for (int i = 0; i < resultList.size(); i++) {
91 SearchView searchView = buildSearchView(resultList.getJSONObject(i), searchRequest);
92 // 标题关键字过滤
93 if (searchView != null && isCheckTitleFilter(titleFilter, searchView.getTitle()) && isSellFilter(sellFilter, searchView.getUserNickName())) {
94 if (searchView.getUserNickName() != null) {
95 searchViewList.add(searchView);
96 }
97 }
98 }
99 } catch (IOException e) {
100 log.error(e.getMessage(), e);
101 }
102 }
103 }
104 return searchViewList;
105 }
106
107
108 private SearchView buildSearchView(JSONObject jsonObject, SearchRequest searchRequest) {

Callers 15

jquery.jsFile · 0.80
SizzleFunction · 0.80
makeArrayFunction · 0.80
liveHandlerFunction · 0.80
yadmin.jsFile · 0.80
layui.jsFile · 0.80
cFunction · 0.80
layui.all.jsFile · 0.80
cFunction · 0.80
aFunction · 0.80
rFunction · 0.80
SFunction · 0.80

Calls 15

getSearchRequestMethod · 0.95
getTitleFilterMethod · 0.95
getSellFilterMethod · 0.95
builderParamMethod · 0.95
builderHeadersMethod · 0.95
postFormMethod · 0.95
buildSearchViewMethod · 0.95
isCheckTitleFilterMethod · 0.95
isSellFilterMethod · 0.95
clearMethod · 0.80
encodeMethod · 0.80

Tested by

no test coverage detected