正在显示
1 个修改的文件
包含
9 行增加
和
2 行删除
| @@ -53,7 +53,7 @@ class UpdateRoute extends Command | @@ -53,7 +53,7 @@ class UpdateRoute extends Command | ||
| 53 | * @time :2023/11/20 15:13 | 53 | * @time :2023/11/20 15:13 |
| 54 | */ | 54 | */ |
| 55 | public function handle(){ | 55 | public function handle(){ |
| 56 | - ProjectServer::useProject(75); | 56 | + ProjectServer::useProject(91); |
| 57 | $this->getProductKeyword(); | 57 | $this->getProductKeyword(); |
| 58 | DB::disconnect('custom_mysql'); | 58 | DB::disconnect('custom_mysql'); |
| 59 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 59 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -68,9 +68,16 @@ class UpdateRoute extends Command | @@ -68,9 +68,16 @@ class UpdateRoute extends Command | ||
| 68 | */ | 68 | */ |
| 69 | public function getProductKeyword(){ | 69 | public function getProductKeyword(){ |
| 70 | $keywordModel = new Keyword(); | 70 | $keywordModel = new Keyword(); |
| 71 | - $lists = $keywordModel->list(['route'=>'']); | 71 | + $lists = $keywordModel->list(['status'=>1]); |
| 72 | if(!empty($lists)){ | 72 | if(!empty($lists)){ |
| 73 | foreach ($lists as $v){ | 73 | foreach ($lists as $v){ |
| 74 | + $tag = "-tag"; | ||
| 75 | + if (!substr($v['route'], -strlen($tag)) === $tag) { | ||
| 76 | + $route = $v['route'].$tag; | ||
| 77 | + // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | ||
| 78 | + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | ||
| 79 | + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 80 | + } | ||
| 74 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 81 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| 75 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | 82 | $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); |
| 76 | $this->curlDelRoute(['new_route'=>$route]); | 83 | $this->curlDelRoute(['new_route'=>$route]); |
-
请 注册 或 登录 后发表评论