作者 lyh

gx

... ... @@ -55,7 +55,7 @@ class ReplaceHtml extends Command
echo '开始,任务id:'.$v['id'].PHP_EOL;
$this->createReplaceHtmlLog($v);
//修改当前主任务状态为待执行
$rs = $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START],['id'=>$v['id']]);
$replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START],['id'=>$v['id']]);
echo '结束'.PHP_EOL;
DB::disconnect('custom_mysql');
}
... ... @@ -96,4 +96,6 @@ class ReplaceHtml extends Command
}
return true;
}
}
... ...
... ... @@ -47,16 +47,21 @@ class ReplaceHtmlLog extends Command
*/
public function handle()
{
$replaceHtmlLogModel = new TemplateReplaceHtmlLog();
$replaceHtmlList = $replaceHtmlLogModel->list(['status'=>$replaceHtmlLogModel::STATUS]);
foreach ($replaceHtmlList as $k => $v){
ProjectServer::useProject($v['project_id']);
echo '开始,任务id:'.$v['id'].PHP_EOL;
$this->replaceHtml($v);
$replaceHtmlModel = new TemplateReplaceHtml();
$replaceHtmlList = $replaceHtmlModel->list(['status'=>$replaceHtmlModel::STATUS_START]);
foreach ($replaceHtmlList as $value){
echo '开始主任务id:'.$value['id'].PHP_EOL;
$replaceHtmlLogModel = new TemplateReplaceHtmlLog();
$replaceHtmlLogList = $replaceHtmlLogModel->list(['replace_id'=>$value['id'],'status'=>$replaceHtmlLogModel::STATUS]);
ProjectServer::useProject($value['project_id']);
foreach ($replaceHtmlLogList as $v){
$this->replaceHtml($v);
$replaceHtmlLogModel->edit(['status'=>$replaceHtmlLogModel::STATUS_END],['id'=>$v['id']]);
}
DB::disconnect('custom_mysql');
//修改当前主任务状态为待执行
$replaceHtmlLogModel->edit(['status'=>$replaceHtmlLogModel::STATUS_END],['id'=>$v['id']]);
$replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_END],['id'=>$value['id']]);
echo '结束'.PHP_EOL;
DB::disconnect('custom_mysql');
}
return true;
}
... ... @@ -79,5 +84,6 @@ class ReplaceHtmlLog extends Command
}else{
$bTemplateModel->formatQuery($condition)->update(['main_html' => DB::raw("REPLACE(main_html, '$old_html', '$html')")]);
}
return true;
}
}
... ...