正在显示
2 个修改的文件
包含
45 行增加
和
0 行删除
| @@ -85,6 +85,7 @@ class UpdateRoute extends Command | @@ -85,6 +85,7 @@ class UpdateRoute extends Command | ||
| 85 | $aiBlogModel = new AiBlog(); | 85 | $aiBlogModel = new AiBlog(); |
| 86 | $lists = $aiBlogModel->list(['updated_at'=>['<=','2025-03-21 00:00:00']]); | 86 | $lists = $aiBlogModel->list(['updated_at'=>['<=','2025-03-21 00:00:00']]); |
| 87 | if(!empty($lists)){ | 87 | if(!empty($lists)){ |
| 88 | + | ||
| 88 | $aiBlogTaskModel = new AiBlogTask(); | 89 | $aiBlogTaskModel = new AiBlogTask(); |
| 89 | foreach ($lists as $k => $v){ | 90 | foreach ($lists as $k => $v){ |
| 90 | $aiBlogTaskModel->edit(['status'=>1],['task_id'=>$v['task_id']]); | 91 | $aiBlogTaskModel->edit(['status'=>1],['task_id'=>$v['task_id']]); |
app/Console/Commands/LyhTest/lyhDemo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :lyhDemo.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/24 9:38 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\LyhTest; | ||
| 11 | + | ||
| 12 | +use Illuminate\Console\Command; | ||
| 13 | +use Illuminate\Support\Facades\DB; | ||
| 14 | + | ||
| 15 | +class lyhDemo extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'lyh_demo'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '更新路由'; | ||
| 30 | + | ||
| 31 | + public function handle(){ | ||
| 32 | + $missingTaskIds = array_diff( | ||
| 33 | + DB::connection('custom_mysql')->table('article')->pluck('task_id')->toArray(), | ||
| 34 | + DB::connection('custom_mysql')->table('gl_ai_blog_task')->pluck('task_id')->toArray() | ||
| 35 | + ); | ||
| 36 | + echo '数据'.json_encode($missingTaskIds,true).PHP_EOL; | ||
| 37 | + if (!empty($missingTaskIds)) { | ||
| 38 | + DB::connection('custom_mysql')->table('article') | ||
| 39 | + ->whereIn('task_id', $missingTaskIds) | ||
| 40 | + ->delete(); | ||
| 41 | + } | ||
| 42 | + return true; | ||
| 43 | + } | ||
| 44 | +} |
-
请 注册 或 登录 后发表评论