作者 lyh

gx生成评论

... ... @@ -33,7 +33,7 @@ class InitKeywordComment extends Command
*/
protected $description = '初始化关键字评论';
public $number = 100;
public function handle(){
return $this->_action(467);
... ... @@ -47,7 +47,17 @@ class InitKeywordComment extends Command
echo date('Y-m-d H:i:s').'start:' . $item['id'] . PHP_EOL;
$project_id = $item['data']['project_id'];
echo date('Y-m-d H:i:s').'执行的项目id:' . $project_id . PHP_EOL;
try {
$this->_action($project_id);
$count = $keywordCommonModel->counts(['project_id'=>$project_id]);
if($count > 100){
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}
}catch (\Exception $e){
echo date('Y-m-d H:i:s').'错误信息:'.$e->getMessage().PHP_EOL;
continue;
}
echo date('Y-m-d H:i:s').'end:' . $item['id'] . PHP_EOL;
}
}
... ... @@ -73,7 +83,7 @@ class InitKeywordComment extends Command
$item = str_replace("'", '"', $item);
// 解码成 PHP 关联数组
$item = json_decode($item, true);
if(!isset($item) || !isset($item)){
if(!isset($item['name']) || !isset($item['comment'])){
continue;
}
$data[] = [
... ... @@ -89,10 +99,6 @@ class InitKeywordComment extends Command
$keywordCommonModel = new AggregateKeywordComment();
$keywordCommonModel->insertAll($data);
}
$count = $keywordCommonModel->counts(['project_id'=>$project_id]);
if($count < 100){
$this->_action($project_id);
}
return true;
}
}
... ...