|
@@ -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;
|
|
@@ -54,16 +55,16 @@ class UpdateRoute extends Command |
|
@@ -54,16 +55,16 @@ class UpdateRoute extends Command |
|
54
|
*/
|
55
|
*/
|
|
55
|
public function handle(){
|
56
|
public function handle(){
|
|
56
|
$projectModel = new Project();
|
57
|
$projectModel = new Project();
|
|
57
|
- $list = $projectModel->list(['id'=>99]);
|
58
|
+ $list = $projectModel->list(['id'=>708]);
|
|
58
|
foreach ($list as $v){
|
59
|
foreach ($list as $v){
|
|
59
|
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
|
60
|
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
|
|
60
|
ProjectServer::useProject($v['id']);
|
61
|
ProjectServer::useProject($v['id']);
|
|
61
|
// $this->getProduct();
|
62
|
// $this->getProduct();
|
|
62
|
-// $this->setProductKeyword();
|
63
|
+ $this->setProductKeyword();
|
|
63
|
// $this->getRouteMap();
|
64
|
// $this->getRouteMap();
|
|
64
|
// $this->getProductCategory();
|
65
|
// $this->getProductCategory();
|
|
65
|
// $this->delRouteMap();
|
66
|
// $this->delRouteMap();
|
|
66
|
- $this->setCustomRoute($v['id']);
|
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;
|
|
@@ -94,14 +95,19 @@ class UpdateRoute extends Command |
|
@@ -94,14 +95,19 @@ class UpdateRoute extends Command |
|
94
|
*/
|
95
|
*/
|
|
95
|
public function setProductKeyword(){
|
96
|
public function setProductKeyword(){
|
|
96
|
$keywordModel = new Keyword();
|
97
|
$keywordModel = new Keyword();
|
|
97
|
- $lists = $keywordModel->list();
|
98
|
+ $lists = $keywordModel->list(['id'=>['>=',457]]);
|
|
98
|
if(!empty($lists)){
|
99
|
if(!empty($lists)){
|
|
99
|
foreach ($lists as $v){
|
100
|
foreach ($lists as $v){
|
|
100
|
if(!empty($v['route'])){
|
101
|
if(!empty($v['route'])){
|
|
101
|
$tag = "-tag";
|
102
|
$tag = "-tag";
|
|
102
|
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
|
103
|
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
|
|
103
|
- $route = $v['route'].$tag;
|
104
|
+// $route = Translate::tran($v['route'], 'en').$tag;
|
|
104
|
// 如果不是以 '-tag' 结尾,则拼接上 '-tag'
|
105
|
// 如果不是以 '-tag' 结尾,则拼接上 '-tag'
|
|
|
|
106
|
+ $route = $v['route'].$tag;
|
|
|
|
107
|
+ $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
|
|
|
|
108
|
+ $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
109
|
+ }else{
|
|
|
|
110
|
+ $route = Translate::tran($v['title'], 'en').$tag;
|
|
105
|
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
|
111
|
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
|
|
106
|
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
|
112
|
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
107
|
}
|
113
|
}
|