作者 lyh

GXgeo设置

@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Console\Commands\LyhTest; 10 namespace App\Console\Commands\LyhTest;
11 11
12 use App\Models\Ai\AiBlog; 12 use App\Models\Ai\AiBlog;
  13 +use App\Models\News\News;
13 use App\Models\Product\Category; 14 use App\Models\Product\Category;
14 use App\Models\Project\AggregateKeywordAffix; 15 use App\Models\Project\AggregateKeywordAffix;
15 use App\Models\Project\AiBlogTask; 16 use App\Models\Project\AiBlogTask;
@@ -41,6 +42,14 @@ class lyhDemo extends Command @@ -41,6 +42,14 @@ class lyhDemo extends Command
41 protected $description = '更新路由'; 42 protected $description = '更新路由';
42 43
43 public function handle(){ 44 public function handle(){
  45 + ProjectServer::useProject(3531);
  46 + $newsModel = new News();
  47 + $rows = $newsModel->select('id', 'text')->get();
  48 + foreach ($rows as $row) {
  49 + $newText = preg_replace('/<h1 class="t">.*?<\/h1>/is', '', $row->text);
  50 + $newsModel->where('id', $row->id)->update(['text' => $newText]);
  51 + }
  52 + DB::disconnect('custom_mysql');
44 return true; 53 return true;
45 } 54 }
46 55
@@ -154,7 +154,7 @@ class CustomModuleContentLogic extends BaseLogic @@ -154,7 +154,7 @@ class CustomModuleContentLogic extends BaseLogic
154 if($info !== false){ 154 if($info !== false){
155 $this->fail('当前数据名称已存在'); 155 $this->fail('当前数据名称已存在');
156 } 156 }
157 - try { 157 +// try {
158 $this->param['sort'] = $this->setNewsSort(); 158 $this->param['sort'] = $this->setNewsSort();
159 $id = $this->model->addReturnId($this->param); 159 $id = $this->model->addReturnId($this->param);
160 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, 160 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE,
@@ -162,9 +162,9 @@ class CustomModuleContentLogic extends BaseLogic @@ -162,9 +162,9 @@ class CustomModuleContentLogic extends BaseLogic
162 $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); 162 $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route);
163 $this->curlDelRoute(['new_route'=>$route]); 163 $this->curlDelRoute(['new_route'=>$route]);
164 $this->edit(['route' => $route], ['id' => $id]); 164 $this->edit(['route' => $route], ['id' => $id]);
165 - }catch (\Exception $e){  
166 - $this->fail('系统错误,请联系管理员');  
167 - } 165 +// }catch (\Exception $e){
  166 +// $this->fail('系统错误,请联系管理员');
  167 +// }
168 return $id; 168 return $id;
169 } 169 }
170 170