陈德本 %!s(int64=7) %!d(string=hai) anos
pai
achega
36e5745fd8
Modificáronse 1 ficheiros con 7 adicións e 3 borrados
  1. 7 3
      cli.php

+ 7 - 3
cli.php

@@ -108,15 +108,19 @@ function getRelatedKeywords($wd)
             $data = json_decode($arr[1], true);
             if ($data['data'][0]['hintData']) {
                 foreach ($data['data'][0]['hintData'] as $hintDatum) {
-                    if ($response[md5($item['wd'])]) {
-                        continue;
-                    }
+
                     foreach ($hintDatum['linkInfo'] as $item) {
+                        if ($response[md5($item['wd'])]) {
+                            continue;
+                        }
                         $response[md5($item['wd'])] = $item['wd'];
                         $result[] = ['key' => $wd, 'relatedWd' => $item['wd']];
                         $wds[] = $item['wd'];
                     }
                     foreach ($hintDatum['linkInfo2'] as $item) {
+                        if ($response[md5($item['wd'])]) {
+                            continue;
+                        }
                         $response[md5($item['wd'])] = $item['wd'];
                         $result[] = ['key' => $wd, 'relatedWd' => $item['wd']];
                         $wds[] = $item['wd'];