正在显示
1 个修改的文件
包含
20 行增加
和
3 行删除
| @@ -57,7 +57,7 @@ class UpdateRoute extends Command | @@ -57,7 +57,7 @@ class UpdateRoute extends Command | ||
| 57 | // $list = $projectModel->list(['type'=>['in',[1,2,3,4]]]); | 57 | // $list = $projectModel->list(['type'=>['in',[1,2,3,4]]]); |
| 58 | // foreach ($list as $v){ | 58 | // foreach ($list as $v){ |
| 59 | ProjectServer::useProject(197); | 59 | ProjectServer::useProject(197); |
| 60 | - $this->setProductKeyword(); | 60 | + $this->getProduct(); |
| 61 | DB::disconnect('custom_mysql'); | 61 | DB::disconnect('custom_mysql'); |
| 62 | // } | 62 | // } |
| 63 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 63 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -83,6 +83,24 @@ class UpdateRoute extends Command | @@ -83,6 +83,24 @@ class UpdateRoute extends Command | ||
| 83 | $routeModel = new RouteMap(); | 83 | $routeModel = new RouteMap(); |
| 84 | $routeModel->edit(['route'=>$route],['source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,'source_id'=>$v['id']]); | 84 | $routeModel->edit(['route'=>$route],['source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,'source_id'=>$v['id']]); |
| 85 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 85 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 86 | + echo date('Y-m-d H:i:s') . 'end'.$v['id'] . PHP_EOL; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public function getProduct(){ | ||
| 93 | + $productModel = new Product(); | ||
| 94 | + $lists = $productModel->list(['status'=>1]); | ||
| 95 | + if(!empty($lists)){ | ||
| 96 | + foreach ($lists as $v){ | ||
| 97 | + $tag = "-product"; | ||
| 98 | + if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 99 | + echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 100 | + $route = $v['route'].$tag; | ||
| 101 | + // 如果不是以 '-product' 结尾,则拼接上 '-product' | ||
| 102 | + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 103 | + $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 86 | } | 104 | } |
| 87 | } | 105 | } |
| 88 | } | 106 | } |
| @@ -105,8 +123,7 @@ class UpdateRoute extends Command | @@ -105,8 +123,7 @@ class UpdateRoute extends Command | ||
| 105 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { | 123 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { |
| 106 | $route = $v['route'].$tag; | 124 | $route = $v['route'].$tag; |
| 107 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | 125 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' |
| 108 | - $routeModel = new RouteMap(); | ||
| 109 | - $routeModel->edit(['route'=>$route],['source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,'source_id'=>$v['id']]); | 126 | + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); |
| 110 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 127 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 111 | } | 128 | } |
| 112 | }else{ | 129 | }else{ |
-
请 注册 或 登录 后发表评论