|
...
|
...
|
@@ -10,6 +10,7 @@ |
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
|
|
use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
use App\Models\Product\CategoryRelated;
|
|
...
|
...
|
@@ -63,16 +64,26 @@ class UpdateRoute extends Command |
|
|
|
// $this->getRouteMap();
|
|
|
|
// $this->getProductCategory();
|
|
|
|
// $this->delRouteMap();
|
|
|
|
|
|
|
|
// $this->setCustomRoute($v['id']);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setCustomRoute($project_id){
|
|
|
|
// $customModel = new CustomModuleContent();
|
|
|
|
// $list = $customModel->list();
|
|
|
|
// foreach ($list as $v){
|
|
|
|
// $route = RouteMap::setRoute($v['name'], RouteMap::SOURCE_MODULE, $v['id'], $project_id);
|
|
|
|
// $customModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
// }
|
|
|
|
$cateModel = new CustomModuleCategory();
|
|
|
|
$lists = $cateModel->list();
|
|
|
|
foreach ($lists as $v1){
|
|
|
|
$route = RouteMap::setRoute($v1['name'], RouteMap::SOURCE_MODULE_CATE, $v1['id'], $project_id);
|
|
|
|
$cateModel->edit(['route'=>$route],['id'=>$v1['id']]);
|
|
|
|
|
|
|
|
public function setKeywordRoute($project_id){
|
|
|
|
$keywordModel = new Keyword();
|
|
|
|
$keywordModel->list();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -83,7 +94,6 @@ class UpdateRoute extends Command |
|
|
|
* @time :2023/12/21 14:37
|
|
|
|
*/
|
|
|
|
public function setProductKeyword(){
|
|
|
|
//批量设置关键字
|
|
|
|
$keywordModel = new Keyword();
|
|
|
|
$lists = $keywordModel->list();
|
|
|
|
if(!empty($lists)){
|
|
...
|
...
|
@@ -91,8 +101,9 @@ class UpdateRoute extends Command |
|
|
|
if(!empty($v['route'])){
|
|
|
|
$tag = "-tag";
|
|
|
|
if (!(substr($v['route'], -strlen($tag)) === $tag)) {
|
|
|
|
$route = $v['route'].$tag;
|
|
|
|
// $route = Translate::tran($v['route'], 'en').$tag;
|
|
|
|
// 如果不是以 '-tag' 结尾,则拼接上 '-tag'
|
|
|
|
$route = $v['route'].$tag;
|
|
|
|
$route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
|
|
|
|
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
|
|
|
|
}
|
...
|
...
|
|