|
...
|
...
|
@@ -21,8 +21,11 @@ use App\Models\Project\Payment; |
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Project\ProjectAiSetting;
|
|
|
|
use App\Models\Project\ProjectWhiteHatAffix;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Template\BTemplateMain;
|
|
|
|
use App\Models\Template\TemplateTypeMain;
|
|
|
|
use App\Models\WebSetting\Translate;
|
|
|
|
use App\Models\WebSetting\TranslateData;
|
|
|
|
use App\Models\WebSetting\WebSetting;
|
|
|
|
use App\Models\WorkOrder\TicketLog;
|
|
|
|
use App\Models\WorkOrder\Tickets;
|
|
...
|
...
|
@@ -51,18 +54,7 @@ class lyhDemo extends Command |
|
|
|
protected $description = '更新路由';
|
|
|
|
|
|
|
|
public function handle(){
|
|
|
|
$projectModel = new Payment();
|
|
|
|
$lists = $projectModel->list(['renewal_record'=>['not like','"expire_at": null']]);
|
|
|
|
foreach ($lists as $item){
|
|
|
|
foreach ($item['renewal_record'] as $key => $val){
|
|
|
|
if(!isset($val['end_time']) && !empty($val['expire_at'])){
|
|
|
|
$val['end_time'] = $val['expire_at'];
|
|
|
|
}
|
|
|
|
$item['renewal_record'][$key] = $val;
|
|
|
|
}
|
|
|
|
$projectModel->edit(['renewal_record'=>json_encode($item['renewal_record'],true)],['id'=>$item['id']]);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return $this->translate_action();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -245,9 +237,77 @@ class lyhDemo extends Command |
|
|
|
echo "字段 $field 小写替换出错:" . $e->getMessage() . PHP_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '执行结束' . PHP_EOL;
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function translate_action()
|
|
|
|
{
|
|
|
|
ProjectServer::useProject(655);
|
|
|
|
$this->model = new Translate();
|
|
|
|
$lists = DB::connection('custom_mysql')->table('gl_translate_copy1')->where('url','!=','All')->get();
|
|
|
|
foreach ($lists as $item) {
|
|
|
|
$sourceInfo = $this->getRouteSource($item['url']);
|
|
|
|
$info = $this->model->read(['language_id'=>$item['language_id'],'source_id'=>$sourceInfo['source_id'],'url'=>$item['url'],'project_id'=>655,'type'=>$item['type']]);
|
|
|
|
if($info === false){
|
|
|
|
$param = [
|
|
|
|
'type'=>$item['type'] ?? 1,
|
|
|
|
'project_id'=>655,
|
|
|
|
'url'=>$item['url'],
|
|
|
|
'language_id'=>$item['language_id'],
|
|
|
|
'alias'=>$item['alias'],
|
|
|
|
'source'=>$sourceInfo['source'],
|
|
|
|
'source_id'=>$sourceInfo['source_id'],
|
|
|
|
'is_list'=>$sourceInfo['is_list'],
|
|
|
|
'is_custom'=>$sourceInfo['is_custom'],
|
|
|
|
'page'=>$sendData['page'] ?? 0
|
|
|
|
];
|
|
|
|
$id = $this->model->addReturnId($param);
|
|
|
|
TranslateData::insert(['trans_id'=>$id,'data'=>$item['data']]);
|
|
|
|
}else{
|
|
|
|
TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>$item['data']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRouteSource($route){
|
|
|
|
$routes = $route;
|
|
|
|
$data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0,'page'=>0];
|
|
|
|
if(strtolower($route) == 'all'){
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
if($route == 'index' || $route == '/'){
|
|
|
|
$data['source'] = 1;
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
$route = basename($route);
|
|
|
|
$page = 0;
|
|
|
|
if (is_numeric($route)) {
|
|
|
|
$arr = explode('/',$routes);
|
|
|
|
$page = $route;
|
|
|
|
$route = $arr[0];
|
|
|
|
}
|
|
|
|
$routeModel = new RouteMap();
|
|
|
|
$routeInfo = $routeModel->read(['route'=>$route]);
|
|
|
|
if($routeInfo === false){
|
|
|
|
if(in_array($route,['products','news','blog'])){
|
|
|
|
//固定路由
|
|
|
|
$data['page'] = $page;
|
|
|
|
$data['is_list'] = 1;
|
|
|
|
if($route == 'products'){
|
|
|
|
$data['source'] = 2;
|
|
|
|
}elseif ($route == 'news'){
|
|
|
|
$data['source'] = 4;
|
|
|
|
}else{
|
|
|
|
$data['source'] = 3;
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
$data = $this->resultData($routeInfo,$data);
|
|
|
|
$data['page'] = $page;
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|