|
@@ -14,7 +14,7 @@ class BookSpider extends Command
|
|
|
*
|
|
|
* @var string
|
|
|
*/
|
|
|
- protected $signature = 'zytest';
|
|
|
+ protected $signature = 'zytest {--type=} {--bid=}';
|
|
|
|
|
|
/**
|
|
|
* The console command description.
|
|
@@ -42,7 +42,15 @@ class BookSpider extends Command
|
|
|
public function handle()
|
|
|
{
|
|
|
//32401811
|
|
|
- $this->cpc();
|
|
|
+ //$this->cpc();
|
|
|
+ $type = $this->option('type');
|
|
|
+ if($type == 'yunqi'){
|
|
|
+ $bids = $this->option('bid');
|
|
|
+ $bids = explode(',',$bids);
|
|
|
+ foreach ($bids as $bid){
|
|
|
+ $this->newYunQi($bid);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private function cpc(){
|
|
@@ -160,7 +168,14 @@ WHERE u.openid in (SELECT openid from users WHERE id = %s)";
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
- private function newYunQi(){
|
|
|
- \App\Modules\Book\Services\BookService::newYunQiBook(1);
|
|
|
+ private function newYunQi($bid){
|
|
|
+ $result = \App\Modules\Book\Services\BookService::newYunQiBook($bid);
|
|
|
+ if($result == -1){
|
|
|
+ echo 'yunqi book had collected'.PHP_EOL;
|
|
|
+ }
|
|
|
+ if ($result == -2) {
|
|
|
+ echo 'new_yunqi book not exists'.PHP_EOL;
|
|
|
+ }
|
|
|
+ echo "OK!";
|
|
|
}
|
|
|
}
|