15954078560 2 vuotta sitten
vanhempi
commit
2964c30345
1 muutettua tiedostoa jossa 21 lisäystä ja 2 poistoa
  1. 21 2
      application/api/controller/Notify.php

+ 21 - 2
application/api/controller/Notify.php

@@ -728,14 +728,15 @@ class Notify extends Api
         );
 
         $hu_video = Db::name('video');
-        $list = $hu_video->where($where)->count('id');
+//        $list = $hu_video->where($where)->count('id');
+        $list = $hu_video->where($where)->limit(50)->select();
 
         if (!$list) {
             echo 'mei shu ju';
             die;
         }
 
-        $starttime = date('Ymd000000', time());
+        /*$starttime = date('Ymd000000', time());
         $endtime = date('Ymd235959', time());
 //        $url = 'http://'.config('inject_ip').':'.config('inject_port').'/injectResult/v1/queryAdd?cspId=' . config('cspid') . '&startTime='.$starttime.'&endTime='.$endtime;
         $url = 'http://jscp.agency.gitv.tv/injectResult/v1/queryAdd?cspId=' . config('cspid') . '&startTime='.$starttime.'&endTime='.$endtime;
@@ -757,6 +758,24 @@ class Notify extends Api
             if ($v['taskStatus'] == 2) {
                 $hu_video->where(['id' => $v['cpTvId'], 'inject_status' => 1])->setField(['inject_status' => 2]);
             }
+        }*/
+
+        $header = [
+            'Content-Type: application/json'
+        ];
+        foreach ($list as &$v) {
+            $url = 'http://jscp.agency.gitv.tv/injectResult/v1/queryTv?cspId=' . config('cspid') . '&cpAlbumId=' . $v['id'] . '&cpTvId=' .  $v['id'];
+            $rs = httpRequest($url, 'POST', [], $header);
+            if (!$rs) {
+                continue;
+            }
+            $rs = json_decode($rs, true);
+            if ($rs['code'] != 'A000000') {
+                continue;
+            }
+            if ($rs['data'][0]['taskStatus'] == 2) {
+                $hu_video->where(['id' => $v['id'], 'inject_status' => 1])->setField(['inject_status' => 2]);
+            }
         }
 
         echo 'wan bi';