作者 刘锟

update

... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Models\Collect\CollectTask;
use App\Models\Com\UpdateLog;
use App\Models\Com\UpdateVisit;
use App\Models\Product\Product;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
... ... @@ -29,31 +30,12 @@ class Temp extends Command
public function handle()
{
$data_project = [162];
foreach ($data_project as $project_id) {
$project = ProjectServer::useProject($project_id);
if ($project) {
$list = Product::get();
foreach ($list as $item) {
$seo = $item->seo_mate;
if ($seo) {
$seo['title'] = substr(strip_tags($seo['title']??''), 0, 70);
$seo['keyword'] = substr(strip_tags($seo['keyword']??''), 0, 255);
$seo['description'] = substr(strip_tags($seo['description']??''), 0, 200);
$item->seo_mate = Arr::a2s($seo);
try {
$item->save();
}catch (\Exception $e){
continue;
}
}
}
}
//关闭数据库
DB::disconnect('custom_mysql');
echo $project_id . '成功, product' . PHP_EOL;
$data = UpdateLog::where('api_type','website_info')->get();
foreach ($data as $item) {
UpdateVisit::createLog($item->project_id,$item->api_url);
echo $item->project_id . '成功' . PHP_EOL;
}
}
}
... ...