Merge remote-tracking branch 'origin/master' into akun
正在显示
12 个修改的文件
包含
73 行增加
和
37 行删除
| @@ -11,6 +11,7 @@ use App\Models\Mail\Mail; | @@ -11,6 +11,7 @@ use App\Models\Mail\Mail; | ||
| 11 | use App\Models\Project\DeployOptimize; | 11 | use App\Models\Project\DeployOptimize; |
| 12 | use App\Models\Project\ProjectUpdateTdk; | 12 | use App\Models\Project\ProjectUpdateTdk; |
| 13 | use App\Models\User\User; | 13 | use App\Models\User\User; |
| 14 | +use App\Models\WebSetting\WebLanguage; | ||
| 14 | use App\Services\ProjectServer; | 15 | use App\Services\ProjectServer; |
| 15 | use Illuminate\Console\Command; | 16 | use Illuminate\Console\Command; |
| 16 | use Illuminate\Support\Facades\Cache; | 17 | use Illuminate\Support\Facades\Cache; |
| @@ -40,6 +41,8 @@ class UpdateSeoTdk extends Command | @@ -40,6 +41,8 @@ class UpdateSeoTdk extends Command | ||
| 40 | */ | 41 | */ |
| 41 | protected $description = '一键生成tdk'; | 42 | protected $description = '一键生成tdk'; |
| 42 | 43 | ||
| 44 | + protected $project; | ||
| 45 | + | ||
| 43 | /** | 46 | /** |
| 44 | * Create a new command instance. | 47 | * Create a new command instance. |
| 45 | * | 48 | * |
| @@ -143,7 +146,7 @@ class UpdateSeoTdk extends Command | @@ -143,7 +146,7 @@ class UpdateSeoTdk extends Command | ||
| 143 | 146 | ||
| 144 | echo date('Y-m-d H:i:s') . ' start project_id: ' . $project_id . PHP_EOL; | 147 | echo date('Y-m-d H:i:s') . ' start project_id: ' . $project_id . PHP_EOL; |
| 145 | try { | 148 | try { |
| 146 | - ProjectServer::useProject($project_id); | 149 | + $this->project = ProjectServer::useProject($project_id); |
| 147 | $this->seo_tdk($project_id, $task->id); | 150 | $this->seo_tdk($project_id, $task->id); |
| 148 | DB::disconnect('custom_mysql'); | 151 | DB::disconnect('custom_mysql'); |
| 149 | }catch (\Exception $e){ | 152 | }catch (\Exception $e){ |
| @@ -280,7 +283,6 @@ class UpdateSeoTdk extends Command | @@ -280,7 +283,6 @@ class UpdateSeoTdk extends Command | ||
| 280 | } | 283 | } |
| 281 | 284 | ||
| 282 | public function getPrompt($project_id, $prompt, $table, $data){ | 285 | public function getPrompt($project_id, $prompt, $table, $data){ |
| 283 | - $lang = ''; | ||
| 284 | if(strpos($prompt, '{topic}') !== false){ | 286 | if(strpos($prompt, '{topic}') !== false){ |
| 285 | $topic = $data[$this->topic_fields[$table]] ?? ''; | 287 | $topic = $data[$this->topic_fields[$table]] ?? ''; |
| 286 | if(!$topic){ | 288 | if(!$topic){ |
| @@ -288,7 +290,6 @@ class UpdateSeoTdk extends Command | @@ -288,7 +290,6 @@ class UpdateSeoTdk extends Command | ||
| 288 | return false; | 290 | return false; |
| 289 | } | 291 | } |
| 290 | $prompt = str_replace('{topic}', $topic, $prompt); | 292 | $prompt = str_replace('{topic}', $topic, $prompt); |
| 291 | - $lang = $this->getLang($topic); | ||
| 292 | } | 293 | } |
| 293 | if(strpos($prompt, '{keyword}') !== false) { | 294 | if(strpos($prompt, '{keyword}') !== false) { |
| 294 | $keyword = $this->mainKeywords($project_id, 1); | 295 | $keyword = $this->mainKeywords($project_id, 1); |
| @@ -297,7 +298,6 @@ class UpdateSeoTdk extends Command | @@ -297,7 +298,6 @@ class UpdateSeoTdk extends Command | ||
| 297 | return false; | 298 | return false; |
| 298 | } | 299 | } |
| 299 | $prompt = str_replace('{keyword}', $keyword, $prompt); | 300 | $prompt = str_replace('{keyword}', $keyword, $prompt); |
| 300 | - !$lang && $lang = $this->getLang($keyword); | ||
| 301 | } | 301 | } |
| 302 | if(strpos($prompt, '{company name}') !== false) { | 302 | if(strpos($prompt, '{company name}') !== false) { |
| 303 | $company_name = $this->companyName($project_id); | 303 | $company_name = $this->companyName($project_id); |
| @@ -307,8 +307,7 @@ class UpdateSeoTdk extends Command | @@ -307,8 +307,7 @@ class UpdateSeoTdk extends Command | ||
| 307 | } | 307 | } |
| 308 | $prompt = str_replace('{company name}', $company_name, $prompt); | 308 | $prompt = str_replace('{company name}', $company_name, $prompt); |
| 309 | } | 309 | } |
| 310 | - $prompt .= '.Please answer in ' . ($lang ?: 'English'); | ||
| 311 | - | 310 | + $prompt .= '.Please answer in ' . $this->getLang(); |
| 312 | return $prompt; | 311 | return $prompt; |
| 313 | } | 312 | } |
| 314 | 313 | ||
| @@ -365,14 +364,9 @@ class UpdateSeoTdk extends Command | @@ -365,14 +364,9 @@ class UpdateSeoTdk extends Command | ||
| 365 | return $str; | 364 | return $str; |
| 366 | } | 365 | } |
| 367 | 366 | ||
| 368 | - public function getLang($content){ | ||
| 369 | - $result = Translate::translateSl($content); | ||
| 370 | - if (isset($result['texts']['sl']) && isset(Translate::$tls_list[$result['texts']['sl']])) { | ||
| 371 | - $lang = Translate::$tls_list[$result['texts']['sl']]['lang_en']; | ||
| 372 | - } else { | ||
| 373 | - $lang = 'English'; | ||
| 374 | - } | ||
| 375 | - return $lang; | 367 | + public function getLang(){ |
| 368 | + $lang = WebLanguage::getLangById($this->project['main_lang_id']??1); | ||
| 369 | + return $lang['english'] ?? 'English'; | ||
| 376 | } | 370 | } |
| 377 | 371 | ||
| 378 | /** | 372 | /** |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Bside\CustomModule; | 10 | namespace App\Http\Controllers\Bside\CustomModule; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 13 | use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic; | 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic; |
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 15 | use App\Models\CustomModule\CustomModuleCategory; |
| @@ -354,6 +354,7 @@ class FileController | @@ -354,6 +354,7 @@ class FileController | ||
| 354 | 'file'=>$path, | 354 | 'file'=>$path, |
| 355 | 'file_link'=>getFileUrl($path,$this->upload_location), | 355 | 'file_link'=>getFileUrl($path,$this->upload_location), |
| 356 | 'name'=>$name, | 356 | 'name'=>$name, |
| 357 | + 'file_download'=>url('a/download_files?path='.$path) | ||
| 357 | ]; | 358 | ]; |
| 358 | return $data; | 359 | return $data; |
| 359 | } | 360 | } |
| @@ -427,6 +427,7 @@ class ImageController extends Controller | @@ -427,6 +427,7 @@ class ImageController extends Controller | ||
| 427 | 'image'=>$path, | 427 | 'image'=>$path, |
| 428 | 'image_link'=>getImageUrl($path), | 428 | 'image_link'=>getImageUrl($path), |
| 429 | 'name'=>$name, | 429 | 'name'=>$name, |
| 430 | + 'image_download'=>url('a/download_images?path='.$path) | ||
| 430 | ]; | 431 | ]; |
| 431 | return $data; | 432 | return $data; |
| 432 | } | 433 | } |
| @@ -645,10 +645,11 @@ class ProjectLogic extends BaseLogic | @@ -645,10 +645,11 @@ class ProjectLogic extends BaseLogic | ||
| 645 | 645 | ||
| 646 | 646 | ||
| 647 | /** | 647 | /** |
| 648 | - * @param $project | ||
| 649 | - * @return bool | ||
| 650 | - * @author zbj | ||
| 651 | - * @date 2023/4/23 | 648 | + * @remark :创建数据库 |
| 649 | + * @name :initTable | ||
| 650 | + * @author :lyh | ||
| 651 | + * @method :post | ||
| 652 | + * @time :2023/12/11 10:09 | ||
| 652 | */ | 653 | */ |
| 653 | public function initTable($project_id,$news_project_id) | 654 | public function initTable($project_id,$news_project_id) |
| 654 | { | 655 | { |
| @@ -8,6 +8,7 @@ use App\Helper\Translate; | @@ -8,6 +8,7 @@ use App\Helper\Translate; | ||
| 8 | use App\Http\Logic\Bside\BaseLogic; | 8 | use App\Http\Logic\Bside\BaseLogic; |
| 9 | use App\Models\Ai\AiCommand; | 9 | use App\Models\Ai\AiCommand; |
| 10 | use App\Models\Project\DeployOptimize; | 10 | use App\Models\Project\DeployOptimize; |
| 11 | +use App\Models\WebSetting\WebLanguage; | ||
| 11 | use Illuminate\Support\Facades\Cache; | 12 | use Illuminate\Support\Facades\Cache; |
| 12 | 13 | ||
| 13 | class AiCommandLogic extends BaseLogic | 14 | class AiCommandLogic extends BaseLogic |
| @@ -58,8 +59,8 @@ class AiCommandLogic extends BaseLogic | @@ -58,8 +59,8 @@ class AiCommandLogic extends BaseLogic | ||
| 58 | if(trim($ai_command->ai) == '{core keywords 8}'){ | 59 | if(trim($ai_command->ai) == '{core keywords 8}'){ |
| 59 | $ai_send = false; | 60 | $ai_send = false; |
| 60 | }else{ | 61 | }else{ |
| 61 | - $lang = $this->getLang($this->param['keywords']); | ||
| 62 | - $prompt .= '.Please answer in ' . ($lang ?: 'English'); | 62 | + $lang = WebLanguage::getLangById($this->project['main_lang_id']??1)['english'] ?? 'English'; |
| 63 | + $prompt .= '.Please answer in ' . $lang; | ||
| 63 | $ai_send = true; | 64 | $ai_send = true; |
| 64 | } | 65 | } |
| 65 | 66 |
| @@ -82,7 +82,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -82,7 +82,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 82 | if($info === false){ | 82 | if($info === false){ |
| 83 | $this->fail('当前数据不存在或已被删除'); | 83 | $this->fail('当前数据不存在或已被删除'); |
| 84 | } | 84 | } |
| 85 | - $info['image_link'] = getImageUrl($info['image']); | 85 | + $info['image'] = getImageUrl($info['image']); |
| 86 | return $this->success($info); | 86 | return $this->success($info); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| @@ -131,10 +131,10 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -131,10 +131,10 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 131 | public function categoryAdd(){ | 131 | public function categoryAdd(){ |
| 132 | try { | 132 | try { |
| 133 | $id = $this->model->addReturnId($this->param); | 133 | $id = $this->model->addReturnId($this->param); |
| 134 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], | 134 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, |
| 135 | $id, $this->user['project_id']); | 135 | $id, $this->user['project_id']); |
| 136 | $this->handleAddSon($id); | 136 | $this->handleAddSon($id); |
| 137 | - $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route); | 137 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); |
| 138 | $this->curlDelRoute(['new_route'=>$route]); | 138 | $this->curlDelRoute(['new_route'=>$route]); |
| 139 | $this->edit(['route' => $route], ['id' => $id]); | 139 | $this->edit(['route' => $route], ['id' => $id]); |
| 140 | //处理上级分类商品 | 140 | //处理上级分类商品 |
| @@ -153,7 +153,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -153,7 +153,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 153 | * @time :2023/12/5 10:55 | 153 | * @time :2023/12/5 10:55 |
| 154 | */ | 154 | */ |
| 155 | public function categoryEdit(){ | 155 | public function categoryEdit(){ |
| 156 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], | 156 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, |
| 157 | $this->param['id'], $this->user['project_id']); | 157 | $this->param['id'], $this->user['project_id']); |
| 158 | $this->editHandleCategory($this->param['id'],$this->param['pid']); | 158 | $this->editHandleCategory($this->param['id'],$this->param['pid']); |
| 159 | $this->editRoute($this->param['id'],$route); | 159 | $this->editRoute($this->param['id'],$route); |
| @@ -218,7 +218,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -218,7 +218,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 218 | //生成一条删除路由记录 | 218 | //生成一条删除路由记录 |
| 219 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 219 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 220 | if ($info['route'] != $route) { | 220 | if ($info['route'] != $route) { |
| 221 | - $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route); | 221 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); |
| 222 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | 222 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); |
| 223 | } | 223 | } |
| 224 | return true; | 224 | return true; |
| @@ -300,7 +300,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -300,7 +300,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 300 | public function delRoute($id) | 300 | public function delRoute($id) |
| 301 | { | 301 | { |
| 302 | $info = $this->model->read(['id' => $id], ['id', 'route','module_id']); | 302 | $info = $this->model->read(['id' => $id], ['id', 'route','module_id']); |
| 303 | - RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE.$info['module_id'], $id, $this->user['project_id']); | 303 | + RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE, $id, $this->user['project_id']); |
| 304 | //通知 | 304 | //通知 |
| 305 | $this->curlDelRoute(['route'=>$info['route']]); | 305 | $this->curlDelRoute(['route'=>$info['route']]); |
| 306 | return $this->success(); | 306 | return $this->success(); |
| @@ -41,7 +41,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -41,7 +41,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 41 | if($info === false){ | 41 | if($info === false){ |
| 42 | $this->fail('当前数据不存在或已被删除'); | 42 | $this->fail('当前数据不存在或已被删除'); |
| 43 | } | 43 | } |
| 44 | - $info['image_link'] = getImageUrl($info['image']); | 44 | + $info['image'] = getImageUrl($info['image']); |
| 45 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); | 45 | $info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']); |
| 46 | return $this->success($info); | 46 | return $this->success($info); |
| 47 | } | 47 | } |
| @@ -152,9 +152,9 @@ class CustomModuleContentLogic extends BaseLogic | @@ -152,9 +152,9 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 152 | public function contentAdd(){ | 152 | public function contentAdd(){ |
| 153 | try { | 153 | try { |
| 154 | $id = $this->model->addReturnId($this->param); | 154 | $id = $this->model->addReturnId($this->param); |
| 155 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE.$this->param['module_id'], | 155 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, |
| 156 | $id, $this->user['project_id']); | 156 | $id, $this->user['project_id']); |
| 157 | - $this->addUpdateNotify(RouteMap::SOURCE_MODULE.$this->param['module_id'],$route); | 157 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); |
| 158 | $this->curlDelRoute(['new_route'=>$route]); | 158 | $this->curlDelRoute(['new_route'=>$route]); |
| 159 | $this->edit(['route' => $route], ['id' => $id]); | 159 | $this->edit(['route' => $route], ['id' => $id]); |
| 160 | }catch (\Exception $e){ | 160 | }catch (\Exception $e){ |
| @@ -171,7 +171,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -171,7 +171,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 171 | * @time :2023/12/7 15:04 | 171 | * @time :2023/12/7 15:04 |
| 172 | */ | 172 | */ |
| 173 | public function contentEdit(){ | 173 | public function contentEdit(){ |
| 174 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE.$this->param['module_id'], | 174 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, |
| 175 | $this->param['id'], $this->user['project_id']); | 175 | $this->param['id'], $this->user['project_id']); |
| 176 | $this->editRoute($this->param['id'],$route); | 176 | $this->editRoute($this->param['id'],$route); |
| 177 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 177 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| @@ -214,7 +214,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -214,7 +214,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 214 | //生成一条删除路由记录 | 214 | //生成一条删除路由记录 |
| 215 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 215 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 216 | if ($info['route'] != $route) { | 216 | if ($info['route'] != $route) { |
| 217 | - $this->addUpdateNotify(RouteMap::SOURCE_MODULE.$this->param['module_id'],$route); | 217 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); |
| 218 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | 218 | $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); |
| 219 | } | 219 | } |
| 220 | return true; | 220 | return true; |
| @@ -320,7 +320,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -320,7 +320,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 320 | */ | 320 | */ |
| 321 | public function delRoute($id) | 321 | public function delRoute($id) |
| 322 | { | 322 | { |
| 323 | - RouteMap::delRoute(RouteMap::SOURCE_MODULE.$this->param['module_id'], $id, $this->user['project_id']); | 323 | + RouteMap::delRoute(RouteMap::SOURCE_MODULE, $id, $this->user['project_id']); |
| 324 | //通知 | 324 | //通知 |
| 325 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 325 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 326 | $this->curlDelRoute(['route'=>$info['url']]); | 326 | $this->curlDelRoute(['route'=>$info['url']]); |
| @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\CustomModule; | @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\CustomModule; | ||
| 11 | 11 | ||
| 12 | use App\Http\Logic\Bside\BaseLogic; | 12 | use App\Http\Logic\Bside\BaseLogic; |
| 13 | use App\Models\CustomModule\CustomModuleExtend; | 13 | use App\Models\CustomModule\CustomModuleExtend; |
| 14 | +use App\Models\CustomModule\CustomModuleExtentContent; | ||
| 14 | 15 | ||
| 15 | class CustomModuleExtendLogic extends BaseLogic | 16 | class CustomModuleExtendLogic extends BaseLogic |
| 16 | { | 17 | { |
| @@ -115,10 +116,14 @@ class CustomModuleExtendLogic extends BaseLogic | @@ -115,10 +116,14 @@ class CustomModuleExtendLogic extends BaseLogic | ||
| 115 | * @time :2023/12/4 15:47 | 116 | * @time :2023/12/4 15:47 |
| 116 | */ | 117 | */ |
| 117 | public function extendDel(){ | 118 | public function extendDel(){ |
| 118 | - $rs = $this->model->del($this->param); | ||
| 119 | - if($rs === false){ | ||
| 120 | - $this->fail('系统错误,请联系管理员'); | 119 | + $info = $this->model->read(['id'=>$this->param['id']]); |
| 120 | + //查看当前扩展字段是否设置了值 | ||
| 121 | + $extendInfoModel = new CustomModuleExtentContent(); | ||
| 122 | + $extendInfo = $extendInfoModel->read(['key'=>$info['key']]); | ||
| 123 | + if($extendInfo !== false){ | ||
| 124 | + $this->fail('当前扩展字段已有产品在使用,不允许删除'); | ||
| 121 | } | 125 | } |
| 126 | + $this->model->del(['id'=>$this->param['id']]); | ||
| 122 | return $this->success(); | 127 | return $this->success(); |
| 123 | } | 128 | } |
| 124 | } | 129 | } |
| @@ -25,6 +25,7 @@ class ProjectCountryLogic extends BaseLogic | @@ -25,6 +25,7 @@ class ProjectCountryLogic extends BaseLogic | ||
| 25 | if (empty($lists)){ | 25 | if (empty($lists)){ |
| 26 | $lists = []; | 26 | $lists = []; |
| 27 | } | 27 | } |
| 28 | + $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']); | ||
| 28 | return $this->success($lists); | 29 | return $this->success($lists); |
| 29 | } | 30 | } |
| 30 | 31 | ||
| @@ -39,6 +40,8 @@ class ProjectCountryLogic extends BaseLogic | @@ -39,6 +40,8 @@ class ProjectCountryLogic extends BaseLogic | ||
| 39 | if(!isset($this->param['country_lists']) || empty($this->param['country_lists'])){ | 40 | if(!isset($this->param['country_lists']) || empty($this->param['country_lists'])){ |
| 40 | $this->param['country_lists'] = ''; | 41 | $this->param['country_lists'] = ''; |
| 41 | } | 42 | } |
| 43 | + | ||
| 44 | + $this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']); | ||
| 42 | $info = $this->model->read(['project_id'=>$this->user['project_id']]); | 45 | $info = $this->model->read(['project_id'=>$this->user['project_id']]); |
| 43 | if($info === false){ | 46 | if($info === false){ |
| 44 | $this->param['project_id'] = $this->user['project_id']; | 47 | $this->param['project_id'] = $this->user['project_id']; |
| @@ -51,4 +54,15 @@ class ProjectCountryLogic extends BaseLogic | @@ -51,4 +54,15 @@ class ProjectCountryLogic extends BaseLogic | ||
| 51 | } | 54 | } |
| 52 | return $this->success(); | 55 | return $this->success(); |
| 53 | } | 56 | } |
| 57 | + | ||
| 58 | + protected function countryListsFormat($country_lists) | ||
| 59 | + { | ||
| 60 | + //默认选中主语种 | ||
| 61 | + $country_lists = explode(',', $country_lists); | ||
| 62 | + $main_lang_id = $this->project['main_lang_id'] ?? 1; | ||
| 63 | + if (!in_array($main_lang_id, $country_lists)) { | ||
| 64 | + $country_lists[] = $main_lang_id; | ||
| 65 | + } | ||
| 66 | + return implode(',', $country_lists); | ||
| 67 | + } | ||
| 54 | } | 68 | } |
| @@ -39,10 +39,10 @@ class RouteMap extends Base | @@ -39,10 +39,10 @@ class RouteMap extends Base | ||
| 39 | const SOURCE_NAV = 'nav'; | 39 | const SOURCE_NAV = 'nav'; |
| 40 | 40 | ||
| 41 | //自定义模块 | 41 | //自定义模块 |
| 42 | - const SOURCE_MODULE = 'module_'; | 42 | + const SOURCE_MODULE = 'module'; |
| 43 | 43 | ||
| 44 | //自定义模块分类 | 44 | //自定义模块分类 |
| 45 | - const SOURCE_MODULE_CATE = 'module_cate_'; | 45 | + const SOURCE_MODULE_CATE = 'module_category'; |
| 46 | /** | 46 | /** |
| 47 | * 生成路由标识 | 47 | * 生成路由标识 |
| 48 | * @param $title | 48 | * @param $title |
| @@ -10,8 +10,26 @@ | @@ -10,8 +10,26 @@ | ||
| 10 | namespace App\Models\WebSetting; | 10 | namespace App\Models\WebSetting; |
| 11 | 11 | ||
| 12 | use App\Models\Base; | 12 | use App\Models\Base; |
| 13 | +use Illuminate\Support\Facades\Cache; | ||
| 13 | 14 | ||
| 14 | class WebLanguage extends Base | 15 | class WebLanguage extends Base |
| 15 | { | 16 | { |
| 16 | protected $table = 'gl_web_language'; | 17 | protected $table = 'gl_web_language'; |
| 18 | + | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * @param $id | ||
| 22 | + * @return mixed | ||
| 23 | + * @author zbj | ||
| 24 | + * @date 2023/12/11 | ||
| 25 | + */ | ||
| 26 | + public static function getLangById($id){ | ||
| 27 | + $cache_key = 'lang_'.$id; | ||
| 28 | + $lang = Cache::get($cache_key); | ||
| 29 | + if(!$lang){ | ||
| 30 | + $lang = self::find($id); | ||
| 31 | + Cache::put($cache_key, $lang, 7200); | ||
| 32 | + } | ||
| 33 | + return $lang; | ||
| 34 | + } | ||
| 17 | } | 35 | } |
-
请 注册 或 登录 后发表评论