正在显示
1 个修改的文件
包含
27 行增加
和
0 行删除
| @@ -30,6 +30,7 @@ use App\Models\Workchat\MessagePush; | @@ -30,6 +30,7 @@ use App\Models\Workchat\MessagePush; | ||
| 30 | use App\Services\AiBlogService; | 30 | use App\Services\AiBlogService; |
| 31 | use App\Services\ProjectServer; | 31 | use App\Services\ProjectServer; |
| 32 | use Illuminate\Console\Command; | 32 | use Illuminate\Console\Command; |
| 33 | +use Illuminate\Support\Facades\Schema; | ||
| 33 | use Illuminate\Support\Facades\Artisan; | 34 | use Illuminate\Support\Facades\Artisan; |
| 34 | use Illuminate\Support\Facades\DB; | 35 | use Illuminate\Support\Facades\DB; |
| 35 | 36 | ||
| @@ -50,6 +51,8 @@ class lyhDemo extends Command | @@ -50,6 +51,8 @@ class lyhDemo extends Command | ||
| 50 | protected $description = '更新路由'; | 51 | protected $description = '更新路由'; |
| 51 | 52 | ||
| 52 | public function handle(){ | 53 | public function handle(){ |
| 54 | + $this->_actions(); | ||
| 55 | + dd(111); | ||
| 53 | $projectModel = new Project(); | 56 | $projectModel = new Project(); |
| 54 | $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); | 57 | $lists = $projectModel->list(['delete_status' => 0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); |
| 55 | foreach ($lists as $val) { | 58 | foreach ($lists as $val) { |
| @@ -125,4 +128,28 @@ class lyhDemo extends Command | @@ -125,4 +128,28 @@ class lyhDemo extends Command | ||
| 125 | return $aiSettingInfo; | 128 | return $aiSettingInfo; |
| 126 | } | 129 | } |
| 127 | 130 | ||
| 131 | + | ||
| 132 | + public function _actions(){ | ||
| 133 | + echo '565'.PHP_EOL; | ||
| 134 | + ProjectServer::useProject(565); | ||
| 135 | + $table = 'gl_route_map'; | ||
| 136 | + $filed = 'route'; | ||
| 137 | + $str = 'Trimos,insize,Fowler,Mahr,Starrett,Tesa,Mitutoyo,Wixey,Shars,Fisso,Spi,Grizzly,Accumaster,Accuremote,Baker,Sharpe,Compac,Earth,Etalon,Federal,Fell,Fisso,Fowler,Gem,Grizzly,Husky,iGaging,Insize,Kanetec,Magnetics,Mighty,Mitutoyo,Noga,Pittsburgh,Procheck,Saker,Scherr Tumico,Shars,Shinwa,SPI,Starrett,Tesa,Technidea,Trimos,Verdict,Wyler,Wixey'; | ||
| 138 | + $arr = explode(',', $str); | ||
| 139 | + foreach ($arr as $val) { | ||
| 140 | + $val = strtolower(trim($val)); // 去除空白并转小写 | ||
| 141 | + $str_s = $val.'-'; | ||
| 142 | + DB::connection('custom_mysql')->table($table) | ||
| 143 | + ->whereRaw("LOWER($filed) LIKE ?", ["%{$str_s}%"]) // 不区分大小写匹配包含 | ||
| 144 | + ->update([ | ||
| 145 | + $filed => DB::raw("REPLACE(LOWER($filed), '$str_s', '')") // 只替换对应字符串,且都转小写替换 | ||
| 146 | + ]); | ||
| 147 | + DB::connection('custom_mysql')->table($table) | ||
| 148 | + ->whereRaw("LOWER($filed) LIKE ?", ["%{$val}%"]) // 不区分大小写匹配包含 | ||
| 149 | + ->update([ | ||
| 150 | + $filed => DB::raw("REPLACE(LOWER($filed), '$val', '')") // 只替换对应字符串,且都转小写替换 | ||
| 151 | + ]); | ||
| 152 | + } | ||
| 153 | + DB::disconnect('custom_mysql'); | ||
| 154 | + } | ||
| 128 | } | 155 | } |
-
请 注册 或 登录 后发表评论