正在显示
1 个修改的文件
包含
17 行增加
和
6 行删除
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Console\Commands; | 10 | namespace App\Console\Commands; |
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | +use App\Helper\Translate; | ||
| 13 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 15 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| @@ -63,16 +64,26 @@ class UpdateRoute extends Command | @@ -63,16 +64,26 @@ class UpdateRoute extends Command | ||
| 63 | // $this->getRouteMap(); | 64 | // $this->getRouteMap(); |
| 64 | // $this->getProductCategory(); | 65 | // $this->getProductCategory(); |
| 65 | // $this->delRouteMap(); | 66 | // $this->delRouteMap(); |
| 66 | - | 67 | +// $this->setCustomRoute($v['id']); |
| 67 | DB::disconnect('custom_mysql'); | 68 | DB::disconnect('custom_mysql'); |
| 68 | } | 69 | } |
| 69 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 70 | } | 71 | } |
| 71 | 72 | ||
| 73 | + public function setCustomRoute($project_id){ | ||
| 74 | +// $customModel = new CustomModuleContent(); | ||
| 75 | +// $list = $customModel->list(); | ||
| 76 | +// foreach ($list as $v){ | ||
| 77 | +// $route = RouteMap::setRoute($v['name'], RouteMap::SOURCE_MODULE, $v['id'], $project_id); | ||
| 78 | +// $customModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 79 | +// } | ||
| 80 | + $cateModel = new CustomModuleCategory(); | ||
| 81 | + $lists = $cateModel->list(); | ||
| 82 | + foreach ($lists as $v1){ | ||
| 83 | + $route = RouteMap::setRoute($v1['name'], RouteMap::SOURCE_MODULE_CATE, $v1['id'], $project_id); | ||
| 84 | + $cateModel->edit(['route'=>$route],['id'=>$v1['id']]); | ||
| 72 | 85 | ||
| 73 | - public function setKeywordRoute($project_id){ | ||
| 74 | - $keywordModel = new Keyword(); | ||
| 75 | - $keywordModel->list(); | 86 | + } |
| 76 | } | 87 | } |
| 77 | 88 | ||
| 78 | /** | 89 | /** |
| @@ -83,7 +94,6 @@ class UpdateRoute extends Command | @@ -83,7 +94,6 @@ class UpdateRoute extends Command | ||
| 83 | * @time :2023/12/21 14:37 | 94 | * @time :2023/12/21 14:37 |
| 84 | */ | 95 | */ |
| 85 | public function setProductKeyword(){ | 96 | public function setProductKeyword(){ |
| 86 | - //批量设置关键字 | ||
| 87 | $keywordModel = new Keyword(); | 97 | $keywordModel = new Keyword(); |
| 88 | $lists = $keywordModel->list(); | 98 | $lists = $keywordModel->list(); |
| 89 | if(!empty($lists)){ | 99 | if(!empty($lists)){ |
| @@ -91,8 +101,9 @@ class UpdateRoute extends Command | @@ -91,8 +101,9 @@ class UpdateRoute extends Command | ||
| 91 | if(!empty($v['route'])){ | 101 | if(!empty($v['route'])){ |
| 92 | $tag = "-tag"; | 102 | $tag = "-tag"; |
| 93 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { | 103 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { |
| 94 | - $route = $v['route'].$tag; | 104 | +// $route = Translate::tran($v['route'], 'en').$tag; |
| 95 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | 105 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' |
| 106 | + $route = $v['route'].$tag; | ||
| 96 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | 107 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); |
| 97 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 108 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 98 | } | 109 | } |
-
请 注册 或 登录 后发表评论