作者 lyh

gx

@@ -55,7 +55,7 @@ class ReplaceHtml extends Command @@ -55,7 +55,7 @@ class ReplaceHtml extends Command
55 echo '开始,任务id:'.$v['id'].PHP_EOL; 55 echo '开始,任务id:'.$v['id'].PHP_EOL;
56 $this->createReplaceHtmlLog($v); 56 $this->createReplaceHtmlLog($v);
57 //修改当前主任务状态为待执行 57 //修改当前主任务状态为待执行
58 - $rs = $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START],['id'=>$v['id']]); 58 + $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START],['id'=>$v['id']]);
59 echo '结束'.PHP_EOL; 59 echo '结束'.PHP_EOL;
60 DB::disconnect('custom_mysql'); 60 DB::disconnect('custom_mysql');
61 } 61 }
@@ -96,4 +96,6 @@ class ReplaceHtml extends Command @@ -96,4 +96,6 @@ class ReplaceHtml extends Command
96 } 96 }
97 return true; 97 return true;
98 } 98 }
  99 +
  100 +
99 } 101 }
@@ -47,16 +47,21 @@ class ReplaceHtmlLog extends Command @@ -47,16 +47,21 @@ class ReplaceHtmlLog extends Command
47 */ 47 */
48 public function handle() 48 public function handle()
49 { 49 {
50 - $replaceHtmlLogModel = new TemplateReplaceHtmlLog();  
51 - $replaceHtmlList = $replaceHtmlLogModel->list(['status'=>$replaceHtmlLogModel::STATUS]);  
52 - foreach ($replaceHtmlList as $k => $v){  
53 - ProjectServer::useProject($v['project_id']);  
54 - echo '开始,任务id:'.$v['id'].PHP_EOL;  
55 - $this->replaceHtml($v); 50 + $replaceHtmlModel = new TemplateReplaceHtml();
  51 + $replaceHtmlList = $replaceHtmlModel->list(['status'=>$replaceHtmlModel::STATUS_START]);
  52 + foreach ($replaceHtmlList as $value){
  53 + echo '开始主任务id:'.$value['id'].PHP_EOL;
  54 + $replaceHtmlLogModel = new TemplateReplaceHtmlLog();
  55 + $replaceHtmlLogList = $replaceHtmlLogModel->list(['replace_id'=>$value['id'],'status'=>$replaceHtmlLogModel::STATUS]);
  56 + ProjectServer::useProject($value['project_id']);
  57 + foreach ($replaceHtmlLogList as $v){
  58 + $this->replaceHtml($v);
  59 + $replaceHtmlLogModel->edit(['status'=>$replaceHtmlLogModel::STATUS_END],['id'=>$v['id']]);
  60 + }
  61 + DB::disconnect('custom_mysql');
56 //修改当前主任务状态为待执行 62 //修改当前主任务状态为待执行
57 - $replaceHtmlLogModel->edit(['status'=>$replaceHtmlLogModel::STATUS_END],['id'=>$v['id']]); 63 + $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_END],['id'=>$value['id']]);
58 echo '结束'.PHP_EOL; 64 echo '结束'.PHP_EOL;
59 - DB::disconnect('custom_mysql');  
60 } 65 }
61 return true; 66 return true;
62 } 67 }
@@ -79,5 +84,6 @@ class ReplaceHtmlLog extends Command @@ -79,5 +84,6 @@ class ReplaceHtmlLog extends Command
79 }else{ 84 }else{
80 $bTemplateModel->formatQuery($condition)->update(['main_html' => DB::raw("REPLACE(main_html, '$old_html', '$html')")]); 85 $bTemplateModel->formatQuery($condition)->update(['main_html' => DB::raw("REPLACE(main_html, '$old_html', '$html')")]);
81 } 86 }
  87 + return true;
82 } 88 }
83 } 89 }