瀏覽代碼

Merge branch 'test' of git.oschina.net:yiguanjia/php into test

洪海涛 8 年之前
父節點
當前提交
9c6b689959
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      www/protected/commands/getPetUserWorkCommand.php

+ 2 - 4
www/protected/commands/getPetUserWorkCommand.php

@@ -27,7 +27,6 @@ class GetPetUserWorkCommand extends CConsoleCommand{
             $index = 1;
         }
         $start_time = time();
-        var_dump($start_time);
         $collection->remove(array('id' => $index));
         while($index) {
             $res = CommonFn::simple_http('http://pet.appcute.im/api/user/get?id=' . $index++);
@@ -35,7 +34,7 @@ class GetPetUserWorkCommand extends CConsoleCommand{
             $end_time = time();
             if ($d['error'] == 10000) {
                 $data = $d['data'];
-                if (!$collection->find(array('id' => $data['id']))) {
+                if (!$collection->findOne(array('id' => $data['id']))) {
                     foreach($data['photos'] as $key => $value) {
                         $data['photos'][$key] = $value;
                     }
@@ -61,8 +60,7 @@ class GetPetUserWorkCommand extends CConsoleCommand{
                     $collection->insert($data);
                 }
             }
-            if ($end_time  >= $start_time+60*1){
-                $collection->insert(array('id' => $index));
+            if ($end_time  >= $start_time+60*5){
                 die();
             }