作者 lyh

gx数据

... ... @@ -42,16 +42,7 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
ProjectServer::useProject(3531);
$newsModel = new News();
$rows = $newsModel->select('id', 'text')->get();
foreach ($rows as $row) {
echo '执行数据id:'.$row->id.PHP_EOL;
$newText = preg_replace('/<h1 class="t">.*?<\/h1>/is', '', $row->text);
$newsModel->where('id', $row->id)->update(['text' => $newText]);
}
DB::disconnect('custom_mysql');
return true;
return $this->_actionRoute();
}
/**
... ... @@ -62,7 +53,22 @@ class lyhDemo extends Command
* @time :2025/7/22 15:14
*/
public function _actionRoute(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
$data = [];
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
ProjectServer::useProject($item['id']);
$aiBlogModel = new AiBlog();
$info = $aiBlogModel->read(['route'=>null],['id']);
if($info !== false){
echo '项目id:'.$item['id'].PHP_EOL;
$data[] = $item['id'];
}
dd($data);
echo 'end';
DB::disconnect('custom_mysql');
}
}
public function _actionTemplateMain(){
... ...