|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :EditPage.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/11/13 10:06
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class EditPage extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'edit_page';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = '修复单页面路由数据';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new command instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
//获取所有项目
|
|
|
|
$projectModel = new Project();
|
|
|
|
$list = $projectModel->list(['type'=>['in',[1,2,3,4]]]);
|
|
|
|
|
|
|
|
try {
|
|
|
|
foreach ($list as $v){
|
|
|
|
echo date('Y-m-d H:i:s') . ' start: '. $v['id'] . PHP_EOL;
|
|
|
|
ProjectServer::useProject($v['id']);
|
|
|
|
BCustomTemplate::where('url', 'like', '%-tag%')
|
|
|
|
->update(['url' => DB::raw("REPLACE(url, '-tag', '')")]);
|
|
|
|
RouteMap::where('url', 'like', '%-tag%')->where('source','page')
|
|
|
|
->update(['url' => DB::raw("REPLACE(url, '-tag', '')")]);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
echo date('Y-m-d H:i:s') . ' error: ->' . $e->getMessage() . PHP_EOL;
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . ' end: down' . PHP_EOL;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|