Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
16 个修改的文件
包含
199 行增加
和
155 行删除
| @@ -16,6 +16,8 @@ use App\Models\Manage\BelongingGroup; | @@ -16,6 +16,8 @@ use App\Models\Manage\BelongingGroup; | ||
| 16 | use App\Models\Manage\Dept; | 16 | use App\Models\Manage\Dept; |
| 17 | use App\Models\Manage\EntryPosition; | 17 | use App\Models\Manage\EntryPosition; |
| 18 | use App\Models\Manage\ManageHr; | 18 | use App\Models\Manage\ManageHr; |
| 19 | +use App\Models\Nav\BNav; | ||
| 20 | +use App\Models\Nav\BNavGroup; | ||
| 19 | use App\Models\Product\Keyword; | 21 | use App\Models\Product\Keyword; |
| 20 | use App\Models\Product\Product; | 22 | use App\Models\Product\Product; |
| 21 | use App\Models\Project\DeployOptimize; | 23 | use App\Models\Project\DeployOptimize; |
| @@ -262,33 +264,74 @@ class Demo extends Command | @@ -262,33 +264,74 @@ class Demo extends Command | ||
| 262 | // | 264 | // |
| 263 | // print_r($include); | 265 | // print_r($include); |
| 264 | // } | 266 | // } |
| 265 | - | ||
| 266 | public function handle(){ | 267 | public function handle(){ |
| 267 | - $projectModel = new DeployOptimize(); | ||
| 268 | - $list = $projectModel->list(['project_id'=>['<',187]]); | ||
| 269 | - foreach ($list as $v){ | ||
| 270 | - echo date('Y-m-d H:i:s') . 'end'.json_encode($v) . PHP_EOL; | ||
| 271 | - $data = []; | ||
| 272 | - if(!empty($v['minor_languages']) && is_array($v['minor_languages'])){ | ||
| 273 | - foreach ($v['minor_languages'] as $k1=> $v1){ | ||
| 274 | - if(!empty($v1['tl']) && !empty($v1['type'])){ | ||
| 275 | - $data[] = [ | ||
| 276 | - 'language'=>$v1['tl'], | ||
| 277 | - 'type'=>$v1['type'], | ||
| 278 | - 'keywords'=>$v1['keywords'], | ||
| 279 | - 'service_day'=>$v1['service_day'], | ||
| 280 | - 'project_id'=>$v['project_id'], | ||
| 281 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 282 | - 'updated_at'=>date('Y-m-d H:i:s') | ||
| 283 | - ]; | ||
| 284 | - } | 268 | + $projectModel = new Project(); |
| 269 | + $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]); | ||
| 270 | + foreach ($list as $v1){ | ||
| 271 | + ProjectServer::useProject($v1['id']); | ||
| 272 | + echo date('Y-m-d H:i:s') . '项目id:'.$v1['id'] . PHP_EOL; | ||
| 273 | + $navGroupModel = new BNavGroup(); | ||
| 274 | + $groupList = $navGroupModel->list(['sort_list'=>['!=','']]); | ||
| 275 | + if(empty($groupList)){ | ||
| 276 | + continue; | ||
| 277 | + } | ||
| 278 | + foreach ($groupList as $k=>$v){ | ||
| 279 | + if(!empty($v['sort_list'])){ | ||
| 280 | + $sort_list = json_decode($v['sort_list']); | ||
| 281 | + $sort = 0; | ||
| 282 | + $this->subSort($sort_list,$sort); | ||
| 285 | } | 283 | } |
| 286 | } | 284 | } |
| 287 | - $languageModel = new MinorLanguages(); | ||
| 288 | - $languageModel->insert($data); | 285 | + DB::disconnect('custom_mysql'); |
| 289 | } | 286 | } |
| 287 | + return true; | ||
| 288 | + } | ||
| 290 | 289 | ||
| 290 | + /** | ||
| 291 | + * @remark :处理子集排序 | ||
| 292 | + * @name :subSort | ||
| 293 | + * @author :lyh | ||
| 294 | + * @method :post | ||
| 295 | + * @time :2024/2/29 15:30 | ||
| 296 | + */ | ||
| 297 | + public function subSort($subList,&$sort,$pid = 0){ | ||
| 298 | + $navModel = new BNav(); | ||
| 299 | + foreach ($subList as $k => $v){ | ||
| 300 | + $v = (array)$v; | ||
| 301 | + $sort = $sort+1; | ||
| 302 | + $navModel->edit(['sort'=>$sort],['id'=>$v['id']]); | ||
| 303 | + if(!empty($v['sub'])){ | ||
| 304 | + $this->subSort($v['sub'],$sort,$v['id']); | ||
| 305 | + } | ||
| 306 | + } | ||
| 307 | + return true; | ||
| 291 | } | 308 | } |
| 309 | +// public function handle(){ | ||
| 310 | +// $projectModel = new DeployOptimize(); | ||
| 311 | +// $list = $projectModel->list(['project_id'=>['<',187]]); | ||
| 312 | +// foreach ($list as $v){ | ||
| 313 | +// echo date('Y-m-d H:i:s') . 'end'.json_encode($v) . PHP_EOL; | ||
| 314 | +// $data = []; | ||
| 315 | +// if(!empty($v['minor_languages']) && is_array($v['minor_languages'])){ | ||
| 316 | +// foreach ($v['minor_languages'] as $k1=> $v1){ | ||
| 317 | +// if(!empty($v1['tl']) && !empty($v1['type'])){ | ||
| 318 | +// $data[] = [ | ||
| 319 | +// 'language'=>$v1['tl'], | ||
| 320 | +// 'type'=>$v1['type'], | ||
| 321 | +// 'keywords'=>$v1['keywords'], | ||
| 322 | +// 'service_day'=>$v1['service_day'], | ||
| 323 | +// 'project_id'=>$v['project_id'], | ||
| 324 | +// 'created_at'=>date('Y-m-d H:i:s'), | ||
| 325 | +// 'updated_at'=>date('Y-m-d H:i:s') | ||
| 326 | +// ]; | ||
| 327 | +// } | ||
| 328 | +// } | ||
| 329 | +// } | ||
| 330 | +// $languageModel = new MinorLanguages(); | ||
| 331 | +// $languageModel->insert($data); | ||
| 332 | +// } | ||
| 333 | +// | ||
| 334 | +// } | ||
| 292 | 335 | ||
| 293 | public function printMessage() | 336 | public function printMessage() |
| 294 | { | 337 | { |
| @@ -562,15 +562,30 @@ class ProjectUpdate extends Command | @@ -562,15 +562,30 @@ class ProjectUpdate extends Command | ||
| 562 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); | 562 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); |
| 563 | $data = curl_c($url); | 563 | $data = curl_c($url); |
| 564 | if (isset($data['code']) && $data['code'] == 200) { | 564 | if (isset($data['code']) && $data['code'] == 200) { |
| 565 | - $category = [ | ||
| 566 | - [ | ||
| 567 | - 'id' => 0, | ||
| 568 | - 'name' => $custom_info['route'], | ||
| 569 | - 'url' => '/' . $custom_info['route'], | ||
| 570 | - 'parent' => 0, | ||
| 571 | - 'children' => $data['data']['category'] ?? [] | ||
| 572 | - ] | ||
| 573 | - ]; | 565 | + //判断分类里面是否存在自定义模块路由 |
| 566 | + $is_exist = 0; | ||
| 567 | + if ($data['data']['category'] ?? []) { | ||
| 568 | + foreach ($data['data']['category'] as $vc) { | ||
| 569 | + $c_route = $this->get_url_route($vc['url'] ?? ''); | ||
| 570 | + if ($c_route == $custom_info['route']) { | ||
| 571 | + $is_exist = 1; | ||
| 572 | + } | ||
| 573 | + } | ||
| 574 | + } | ||
| 575 | + if ($is_exist) { | ||
| 576 | + //存在,无需添加自定义模块路由为分类路由 | ||
| 577 | + $category = $data['data']['category']; | ||
| 578 | + } else { | ||
| 579 | + //不存在,需要添加自定义模块路由为分类路由 | ||
| 580 | + $category = [ | ||
| 581 | + [ | ||
| 582 | + 'id' => 0, | ||
| 583 | + 'name' => $custom_info['route'], | ||
| 584 | + 'url' => '/' . $custom_info['route'], | ||
| 585 | + 'parent' => $data['data']['category'] ?? [] | ||
| 586 | + ] | ||
| 587 | + ]; | ||
| 588 | + } | ||
| 574 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); | 589 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); |
| 575 | 590 | ||
| 576 | $count = $data['data']['count'] ?? 0; | 591 | $count = $data['data']['count'] ?? 0; |
| @@ -55,7 +55,7 @@ class UpdateRoute extends Command | @@ -55,7 +55,7 @@ class UpdateRoute extends Command | ||
| 55 | */ | 55 | */ |
| 56 | public function handle(){ | 56 | public function handle(){ |
| 57 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 58 | - $list = $projectModel->list(['id'=>672]); | 58 | + $list = $projectModel->list(['id'=>917]); |
| 59 | $data = []; | 59 | $data = []; |
| 60 | foreach ($list as $v){ | 60 | foreach ($list as $v){ |
| 61 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 61 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| @@ -56,7 +56,7 @@ class UpdateController extends BaseController | @@ -56,7 +56,7 @@ class UpdateController extends BaseController | ||
| 56 | 'type' => 'required', | 56 | 'type' => 'required', |
| 57 | ], [ | 57 | ], [ |
| 58 | 'project_id.required' => 'project_id不能为空', | 58 | 'project_id.required' => 'project_id不能为空', |
| 59 | - 'type.required' => '采集类型不能为空', | 59 | + 'type.required' => '是否重新采集分类不能为空', |
| 60 | ]); | 60 | ]); |
| 61 | 61 | ||
| 62 | $collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get(); | 62 | $collect_un = UpdateLog::where('project_id', $this->param['project_id'])->where('collect_status', 0)->get(); |
| @@ -90,10 +90,19 @@ class UpdateController extends BaseController | @@ -90,10 +90,19 @@ class UpdateController extends BaseController | ||
| 90 | try { | 90 | try { |
| 91 | DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'"); | 91 | DB::connection('custom_mysql')->statement("DELETE FROM `gl_collect_source` WHERE `origin` LIKE '%.css%' OR `origin` LIKE '%.js%'"); |
| 92 | if ($domain_info) { | 92 | if ($domain_info) { |
| 93 | + //已上线项目 | ||
| 93 | DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''"); | 94 | DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0,`domain` = '" . $test_domain . "' WHERE `language` = ''"); |
| 94 | } else { | 95 | } else { |
| 95 | DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''"); | 96 | DB::connection('custom_mysql')->statement("UPDATE `gl_collect_task` SET `status` = 0 WHERE `language` = ''"); |
| 96 | } | 97 | } |
| 98 | + if ($this->param['type'] == 1) { | ||
| 99 | + //需要重新采集分类 | ||
| 100 | + DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`"); | ||
| 101 | + DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category_related`"); | ||
| 102 | + DB::connection('custom_mysql')->statement("TRUNCATE `gl_news_category`"); | ||
| 103 | + | ||
| 104 | + DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'product_category' OR `source` = 'news_category'"); | ||
| 105 | + } | ||
| 97 | } catch (\Exception $e) { | 106 | } catch (\Exception $e) { |
| 98 | errorLog('重新采集升级项目数据', $this->param, $e); | 107 | errorLog('重新采集升级项目数据', $this->param, $e); |
| 99 | 108 | ||
| @@ -115,24 +124,27 @@ class UpdateController extends BaseController | @@ -115,24 +124,27 @@ class UpdateController extends BaseController | ||
| 115 | $old_info->save(); | 124 | $old_info->save(); |
| 116 | } | 125 | } |
| 117 | 126 | ||
| 118 | - $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->get(); | 127 | + if ($this->param['type'] == 1) { |
| 128 | + //需要重新采集分类 | ||
| 129 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->orderBy('sort', 'asc')->get(); | ||
| 130 | + } else { | ||
| 131 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->orderBy('sort', 'asc')->get(); | ||
| 132 | + } | ||
| 119 | 133 | ||
| 120 | foreach ($logs as $log) { | 134 | foreach ($logs as $log) { |
| 135 | + $log->status = 0; | ||
| 136 | + | ||
| 137 | + if (!in_array($log->api_type, ['website_info', 'tag', 'category', 'category_news'])) { | ||
| 138 | + $log->collect_status = 0; | ||
| 139 | + } | ||
| 140 | + | ||
| 121 | if ($domain_info) { | 141 | if ($domain_info) { |
| 142 | + //已上线项目 | ||
| 122 | $url_arr = parse_url($log->api_url); | 143 | $url_arr = parse_url($log->api_url); |
| 123 | $api_url = str_replace($url_arr['host'], $test_domain, $log->api_url); | 144 | $api_url = str_replace($url_arr['host'], $test_domain, $log->api_url); |
| 124 | - | ||
| 125 | $log->api_url = $api_url; | 145 | $log->api_url = $api_url; |
| 126 | - $log->status = 0; | ||
| 127 | - } else { | ||
| 128 | - if ($this->param['type'] == 2) { | ||
| 129 | - $log->status = 0; | ||
| 130 | - } | ||
| 131 | } | 146 | } |
| 132 | 147 | ||
| 133 | - if (!in_array($log->api_type, ['website_info', 'tag'])) { | ||
| 134 | - $log->collect_status = 0; | ||
| 135 | - } | ||
| 136 | $log->save(); | 148 | $log->save(); |
| 137 | } | 149 | } |
| 138 | 150 |
| @@ -219,23 +219,23 @@ class OptimizeController extends BaseController | @@ -219,23 +219,23 @@ class OptimizeController extends BaseController | ||
| 219 | if(isset($this->map['is_remain_today'])){ | 219 | if(isset($this->map['is_remain_today'])){ |
| 220 | $query = $query->where('gl_project.is_remain_today',$this->map['is_remain_today']); | 220 | $query = $query->where('gl_project.is_remain_today',$this->map['is_remain_today']); |
| 221 | } | 221 | } |
| 222 | - if(isset($this->map['manager_mid']) && !empty($this->map['manager_mid'])){ | ||
| 223 | - $query = $query->where('gl_project_deploy_build.manager_mid','like','%'.$this->map['manager_mid'].'%'); | 222 | + if(isset($this->map['manager_mid'])){ |
| 223 | + $query = $query->where('gl_project_deploy_build.manager_mid',$this->map['manager_mid']); | ||
| 224 | } | 224 | } |
| 225 | - if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){ | ||
| 226 | - $query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%'); | 225 | + if(isset($this->map['optimize_manager_mid'])){ |
| 226 | + $query = $query->where('gl_project_deploy_optimize.manager_mid',$this->map['optimize_manager_mid']); | ||
| 227 | } | 227 | } |
| 228 | if(isset($this->map['is_upgrade'])){ | 228 | if(isset($this->map['is_upgrade'])){ |
| 229 | $query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']); | 229 | $query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']); |
| 230 | } | 230 | } |
| 231 | - if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){ | ||
| 232 | - $query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%'); | 231 | + if(isset($this->map['optimize_tech_mid'])){ |
| 232 | + $query = $query->where('gl_project_deploy_optimize.tech_mid',$this->map['optimize_tech_mid']); | ||
| 233 | } | 233 | } |
| 234 | - if(isset($this->map['optimize_optimist_mid']) && !empty($this->map['optimize_optimist_mid'])){ | ||
| 235 | - $query = $query->where('gl_project_deploy_optimize.optimist_mid','like','%'.$this->map['optimize_optimist_mid'].'%'); | 234 | + if(isset($this->map['optimize_optimist_mid'])){ |
| 235 | + $query = $query->where('gl_project_deploy_optimize.optimist_mid',$this->map['optimize_optimist_mid']); | ||
| 236 | } | 236 | } |
| 237 | - if(isset($this->map['optimize_assist_mid']) && !empty($this->map['optimize_assist_mid'])){ | ||
| 238 | - $query = $query->where('gl_project_deploy_optimize.assist_mid','like','%'.$this->map['optimize_assist_mid'].'%'); | 237 | + if(isset($this->map['optimize_assist_mid'])){ |
| 238 | + $query = $query->where('gl_project_deploy_optimize.assist_mid',$this->map['optimize_assist_mid']); | ||
| 239 | } | 239 | } |
| 240 | if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){ | 240 | if(isset($this->map['channel_id']) && !empty($this->map['channel_id'])){ |
| 241 | $query->where(function ($subQuery) { | 241 | $query->where(function ($subQuery) { |
| @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Project; | @@ -12,6 +12,7 @@ namespace App\Http\Controllers\Aside\Project; | ||
| 12 | use App\Enums\Common\Code; | 12 | use App\Enums\Common\Code; |
| 13 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | use App\Models\Project\MinorLanguages; | 14 | use App\Models\Project\MinorLanguages; |
| 15 | +use App\Models\WebSetting\WebLanguage; | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * @remark :小语种 | 18 | * @remark :小语种 |
| @@ -22,6 +23,13 @@ use App\Models\Project\MinorLanguages; | @@ -22,6 +23,13 @@ use App\Models\Project\MinorLanguages; | ||
| 22 | */ | 23 | */ |
| 23 | class MinorLanguagesController extends BaseController | 24 | class MinorLanguagesController extends BaseController |
| 24 | { | 25 | { |
| 26 | + /** | ||
| 27 | + * @remark :小语种列表 | ||
| 28 | + * @name :getMinorLanguageList | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2024/3/1 10:35 | ||
| 32 | + */ | ||
| 25 | public function getMinorLanguageList(){ | 33 | public function getMinorLanguageList(){ |
| 26 | $this->request->validate([ | 34 | $this->request->validate([ |
| 27 | 'project_id'=>'required', | 35 | 'project_id'=>'required', |
| @@ -29,7 +37,20 @@ class MinorLanguagesController extends BaseController | @@ -29,7 +37,20 @@ class MinorLanguagesController extends BaseController | ||
| 29 | 'project_id.required' => 'keyword不能为空', | 37 | 'project_id.required' => 'keyword不能为空', |
| 30 | ]); | 38 | ]); |
| 31 | $languageModel = new MinorLanguages(); | 39 | $languageModel = new MinorLanguages(); |
| 32 | - $lists = $languageModel->list($this->map,'id',['language','type','keywords','service_day']); | 40 | + $lists = $languageModel->list($this->map,'id',['language','type','keywords','service_day','lang']); |
| 41 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @remark :获取所有的小语种 | ||
| 46 | + * @name :getLanguages | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2024/3/1 10:11 | ||
| 50 | + */ | ||
| 51 | + public function getLanguages(){ | ||
| 52 | + $webLanguageModel = new WebLanguage(); | ||
| 53 | + $lists = $webLanguageModel->list($this->map,'id',['short','chinese']); | ||
| 33 | $this->response('success',Code::SUCCESS,$lists); | 54 | $this->response('success',Code::SUCCESS,$lists); |
| 34 | } | 55 | } |
| 35 | } | 56 | } |
| @@ -28,9 +28,9 @@ class NavController extends BaseController | @@ -28,9 +28,9 @@ class NavController extends BaseController | ||
| 28 | * @method :post | 28 | * @method :post |
| 29 | * @time :2023/12/4 15:00 | 29 | * @time :2023/12/4 15:00 |
| 30 | */ | 30 | */ |
| 31 | - public function index(BNav $nav,BNavGroup $navGroup){ | 31 | + public function index(BNav $nav){ |
| 32 | $this->map['project_id'] = $this->user['project_id']; | 32 | $this->map['project_id'] = $this->user['project_id']; |
| 33 | - $lists = $nav->list($this->map,$this->order = ['sort','id']); | 33 | + $lists = $nav->list($this->map,$this->order = ['sort','id'],['*'],'asc'); |
| 34 | $data = array(); | 34 | $data = array(); |
| 35 | if(!empty($lists)){ | 35 | if(!empty($lists)){ |
| 36 | foreach ($lists as $v){ | 36 | foreach ($lists as $v){ |
| @@ -41,13 +41,6 @@ class NavController extends BaseController | @@ -41,13 +41,6 @@ class NavController extends BaseController | ||
| 41 | $data[] = $v; | 41 | $data[] = $v; |
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | - //获取菜单组排序字段 | ||
| 45 | - $groupInfo = $navGroup->read(['id'=>$this->param['group_id']]); | ||
| 46 | - if(!empty($groupInfo['sort_list'])){ | ||
| 47 | - $sort_list = json_decode($groupInfo['sort_list']); | ||
| 48 | - $detailsList = $this->getIdDetailsList($data); | ||
| 49 | - $data = $this->findDetailsLists($sort_list,$detailsList); | ||
| 50 | - } | ||
| 51 | } | 44 | } |
| 52 | $this->response('success',Code::SUCCESS,$data); | 45 | $this->response('success',Code::SUCCESS,$data); |
| 53 | } | 46 | } |
| @@ -70,66 +63,6 @@ class NavController extends BaseController | @@ -70,66 +63,6 @@ class NavController extends BaseController | ||
| 70 | } | 63 | } |
| 71 | 64 | ||
| 72 | /** | 65 | /** |
| 73 | - * @remark :根据固定的数组排序 | ||
| 74 | - * @name :findDetailsInList | ||
| 75 | - * @author :lyh | ||
| 76 | - * @method :post | ||
| 77 | - * @time :2023/12/18 14:54 | ||
| 78 | - */ | ||
| 79 | - public function findDetailsLists($sort_list, $detailsList) | ||
| 80 | - { | ||
| 81 | - $result = []; | ||
| 82 | - foreach ($sort_list as $val) { | ||
| 83 | - $val = (array)$val; | ||
| 84 | - if (!empty($val['sub']) && is_array($val['sub']) && isset($detailsList[$val['id']]['sub'])){ | ||
| 85 | - $detailsList[$val['id']]['sub'] = $this->findDetailsLists($val['sub'], $detailsList[$val['id']]['sub']); | ||
| 86 | - } | ||
| 87 | - if (empty($detailsList[$val['id']])){ | ||
| 88 | - continue; | ||
| 89 | - } | ||
| 90 | - if(!empty($detailsList[$val['id']]['sub']) && is_array($detailsList[$val['id']]['sub'])){ | ||
| 91 | - $detailsList[$val['id']]['sub'] = $this->handleDetailsSub($detailsList[$val['id']]['sub']); | ||
| 92 | - } | ||
| 93 | - $result[] = $detailsList[$val['id']]; | ||
| 94 | - unset($detailsList[$val['id']]); | ||
| 95 | - } | ||
| 96 | - $result = array_merge($result, $detailsList); | ||
| 97 | - return $this->success($result); | ||
| 98 | - } | ||
| 99 | - | ||
| 100 | - /** | ||
| 101 | - * @remark :处理子集 | ||
| 102 | - * @name :handleDetailsSub | ||
| 103 | - * @author :lyh | ||
| 104 | - * @method :post | ||
| 105 | - * @time :2023/12/21 16:36 | ||
| 106 | - */ | ||
| 107 | - public function handleDetailsSub($detailsList){ | ||
| 108 | - if(!empty($detailsList['sub']) && is_array($detailsList['sub'])){ | ||
| 109 | - $detailsList['sub'] = $this->handleDetailsSub($detailsList['sub']); | ||
| 110 | - } | ||
| 111 | - return array_merge($detailsList); | ||
| 112 | - } | ||
| 113 | - | ||
| 114 | - /** | ||
| 115 | - * @remark :根据id组装数据 | ||
| 116 | - * @name :getDetailsList | ||
| 117 | - * @author :lyh | ||
| 118 | - * @method :post | ||
| 119 | - * @time :2023/12/20 18:52 | ||
| 120 | - */ | ||
| 121 | - public function getIdDetailsList($data){ | ||
| 122 | - $detailsList = []; | ||
| 123 | - foreach ($data as $v) { | ||
| 124 | - if (!empty($v['sub'])){ | ||
| 125 | - $v['sub'] = $this->getIdDetailsList($v['sub']); | ||
| 126 | - } | ||
| 127 | - $detailsList[$v['id']] = $v; | ||
| 128 | - } | ||
| 129 | - return $this->success($detailsList); | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | * @remark :获取当前id下的所有子集 | 66 | * @remark :获取当前id下的所有子集 |
| 134 | * @name :getSubList | 67 | * @name :getSubList |
| 135 | * @author :lyh | 68 | * @author :lyh |
| @@ -233,10 +166,8 @@ class NavController extends BaseController | @@ -233,10 +166,8 @@ class NavController extends BaseController | ||
| 233 | */ | 166 | */ |
| 234 | public function setSortList(NavLogic $navLogic){ | 167 | public function setSortList(NavLogic $navLogic){ |
| 235 | $this->request->validate([ | 168 | $this->request->validate([ |
| 236 | - 'id'=>'required', | ||
| 237 | 'sort_list'=>'required', | 169 | 'sort_list'=>'required', |
| 238 | ],[ | 170 | ],[ |
| 239 | - 'id.required' => 'ID不能为空', | ||
| 240 | 'sort_list.required' => '排序不能为空', | 171 | 'sort_list.required' => '排序不能为空', |
| 241 | ]); | 172 | ]); |
| 242 | $navLogic->setSortList(); | 173 | $navLogic->setSortList(); |
| @@ -539,7 +539,8 @@ class ProductController extends BaseController | @@ -539,7 +539,8 @@ class ProductController extends BaseController | ||
| 539 | ],[ | 539 | ],[ |
| 540 | 'keyword.required' => 'keyword不能为空', | 540 | 'keyword.required' => 'keyword不能为空', |
| 541 | ]); | 541 | ]); |
| 542 | - $data = http_get('http://title.globalso.com/ajax_data_for_web.php?keyword='.$this->param['keyword'],['charset=utf-8']); | 542 | + $data = curl_c('http://title.globalso.com/ajax_data_for_web.php?keyword='.$this->param['keyword'],false); |
| 543 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($data, true) . PHP_EOL, FILE_APPEND); | ||
| 543 | $this->response('success',Code::SUCCESS,$data); | 544 | $this->response('success',Code::SUCCESS,$data); |
| 544 | } | 545 | } |
| 545 | } | 546 | } |
| @@ -132,8 +132,8 @@ class ProjectLogic extends BaseLogic | @@ -132,8 +132,8 @@ class ProjectLogic extends BaseLogic | ||
| 132 | * @time :2023/8/30 11:57 | 132 | * @time :2023/8/30 11:57 |
| 133 | */ | 133 | */ |
| 134 | public function projectSave(){ | 134 | public function projectSave(){ |
| 135 | -// DB::beginTransaction(); | ||
| 136 | -// try { | 135 | + DB::beginTransaction(); |
| 136 | + try { | ||
| 137 | $this->param['project_location'] = 0;//TODO::图片文件存储不同地方,上线后删除 | 137 | $this->param['project_location'] = 0;//TODO::图片文件存储不同地方,上线后删除 |
| 138 | if($this->param['type'] == Project::TYPE_SEVEN){ | 138 | if($this->param['type'] == Project::TYPE_SEVEN){ |
| 139 | //错误单直接返回,单独处理 | 139 | //错误单直接返回,单独处理 |
| @@ -151,20 +151,15 @@ class ProjectLogic extends BaseLogic | @@ -151,20 +151,15 @@ class ProjectLogic extends BaseLogic | ||
| 151 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); | 151 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); |
| 152 | //保存售后信息 | 152 | //保存售后信息 |
| 153 | $this->saveProjectAfter($this->param['project_after']); | 153 | $this->saveProjectAfter($this->param['project_after']); |
| 154 | - | ||
| 155 | $this->saveMinorLanguages($this->param['minor_language'] ?? []); | 154 | $this->saveMinorLanguages($this->param['minor_language'] ?? []); |
| 156 | - //保存询盘过滤配置 | ||
| 157 | -// $this->param['inquiry_filter_config']['project_id'] = $this->param['id']; | ||
| 158 | -// $this->saveInquiryFilterConfig($this->param['inquiry_filter_config']); | ||
| 159 | $this->syncImageFile($this->param['project_location'],$this->param['id']); | 155 | $this->syncImageFile($this->param['project_location'],$this->param['id']); |
| 160 | //创建站点 | 156 | //创建站点 |
| 161 | -// $this->createSite($this->param); | ||
| 162 | (new SyncService())->projectAcceptAddress($this->param['id']); | 157 | (new SyncService())->projectAcceptAddress($this->param['id']); |
| 163 | -// } | ||
| 164 | -// DB::commit(); | ||
| 165 | -// }catch (\Exception $e){ | ||
| 166 | -// DB::rollBack(); | ||
| 167 | -// $this->fail('保存失败,请联系管理员'); | 158 | + } |
| 159 | + DB::commit(); | ||
| 160 | + }catch (\Exception $e){ | ||
| 161 | + DB::rollBack(); | ||
| 162 | + $this->fail('保存失败,请联系管理员'); | ||
| 168 | } | 163 | } |
| 169 | 164 | ||
| 170 | return $this->success(); | 165 | return $this->success(); |
| @@ -189,6 +184,9 @@ class ProjectLogic extends BaseLogic | @@ -189,6 +184,9 @@ class ProjectLogic extends BaseLogic | ||
| 189 | $param['extend_type'] = Project::TYPE_FIVE; | 184 | $param['extend_type'] = Project::TYPE_FIVE; |
| 190 | unset($param['type']); | 185 | unset($param['type']); |
| 191 | } | 186 | } |
| 187 | + if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ | ||
| 188 | + $param['uptime'] = date('Y-m-d H:i:s'); | ||
| 189 | + } | ||
| 192 | if(isset($param['level']) && !empty($param['level'])){ | 190 | if(isset($param['level']) && !empty($param['level'])){ |
| 193 | $param['level'] = Arr::arrToSet($param['level']); | 191 | $param['level'] = Arr::arrToSet($param['level']); |
| 194 | } | 192 | } |
| @@ -228,6 +226,7 @@ class ProjectLogic extends BaseLogic | @@ -228,6 +226,7 @@ class ProjectLogic extends BaseLogic | ||
| 228 | $param['is_visualization'] = json_encode($param['is_visualization']); | 226 | $param['is_visualization'] = json_encode($param['is_visualization']); |
| 229 | } | 227 | } |
| 230 | } | 228 | } |
| 229 | + | ||
| 231 | $this->model->edit($param,['id'=>$param['id']]); | 230 | $this->model->edit($param,['id'=>$param['id']]); |
| 232 | Common::del_user_cache($this->model->getTable(),$param['id']); | 231 | Common::del_user_cache($this->model->getTable(),$param['id']); |
| 233 | return $this->success(); | 232 | return $this->success(); |
| @@ -323,12 +322,14 @@ class ProjectLogic extends BaseLogic | @@ -323,12 +322,14 @@ class ProjectLogic extends BaseLogic | ||
| 323 | if(!empty($minor_language)){ | 322 | if(!empty($minor_language)){ |
| 324 | foreach ($minor_language as $k => $v){ | 323 | foreach ($minor_language as $k => $v){ |
| 325 | if(!empty($v['language'])){ | 324 | if(!empty($v['language'])){ |
| 325 | + $v['created_at'] = date('Y-m-d H:i:s'); | ||
| 326 | + $v['updated_at'] = date('Y-m-d H:i:s'); | ||
| 326 | $v['project_id'] = $this->param['id']; | 327 | $v['project_id'] = $this->param['id']; |
| 327 | $data[] = $v; | 328 | $data[] = $v; |
| 328 | } | 329 | } |
| 329 | } | 330 | } |
| 330 | if(!empty($data)){ | 331 | if(!empty($data)){ |
| 331 | - $languageModel->insert($minor_language); | 332 | + $languageModel->insert($data); |
| 332 | } | 333 | } |
| 333 | } | 334 | } |
| 334 | return $this->success(); | 335 | return $this->success(); |
| @@ -260,11 +260,30 @@ class NavLogic extends BaseLogic | @@ -260,11 +260,30 @@ class NavLogic extends BaseLogic | ||
| 260 | * @time :2023/12/18 13:47 | 260 | * @time :2023/12/18 13:47 |
| 261 | */ | 261 | */ |
| 262 | public function setSortList(){ | 262 | public function setSortList(){ |
| 263 | - $navGroupModel = new BNavGroup(); | ||
| 264 | - if(!empty($this->param['sort_list'])){ | ||
| 265 | - $this->param['sort_list'] = json_encode($this->param['sort_list']); | 263 | + $navList = $this->param['sort_list']; |
| 264 | + if(!empty($navList)){ | ||
| 265 | + $sort = 0; | ||
| 266 | + $this->subSort($navList,$sort); | ||
| 266 | } | 267 | } |
| 267 | - $navGroupModel->edit(['sort_list'=>$this->param['sort_list']],['id'=>$this->param['id']]); | ||
| 268 | return $this->success(); | 268 | return $this->success(); |
| 269 | } | 269 | } |
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * @remark :处理子集排序 | ||
| 273 | + * @name :subSort | ||
| 274 | + * @author :lyh | ||
| 275 | + * @method :post | ||
| 276 | + * @time :2024/2/29 15:30 | ||
| 277 | + */ | ||
| 278 | + public function subSort($subList,&$sort,$pid = 0){ | ||
| 279 | + $navModel = new BNav(); | ||
| 280 | + foreach ($subList as $k => $v){ | ||
| 281 | + $sort = $sort+1; | ||
| 282 | + $navModel->edit(['pid'=>$pid,'sort'=>$sort],['id'=>$v['id']]); | ||
| 283 | + if(!empty($v['sub'])){ | ||
| 284 | + $this->subSort($v['sub'],$sort,$v['id']); | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + return true; | ||
| 288 | + } | ||
| 270 | } | 289 | } |
| @@ -45,7 +45,7 @@ class ProductLogic extends BaseLogic | @@ -45,7 +45,7 @@ class ProductLogic extends BaseLogic | ||
| 45 | $category_ids = $this->handleCategory(); | 45 | $category_ids = $this->handleCategory(); |
| 46 | //处理其他字段 | 46 | //处理其他字段 |
| 47 | $this->param = $this->handleSaveParam($this->param); | 47 | $this->param = $this->handleSaveParam($this->param); |
| 48 | - try { | 48 | +// try { |
| 49 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 49 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 50 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 | 50 | $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0 |
| 51 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 | 51 | $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示 |
| @@ -66,10 +66,10 @@ class ProductLogic extends BaseLogic | @@ -66,10 +66,10 @@ class ProductLogic extends BaseLogic | ||
| 66 | CategoryRelated::saveRelated($id, $category_ids); | 66 | CategoryRelated::saveRelated($id, $category_ids); |
| 67 | //保存扩展字段 | 67 | //保存扩展字段 |
| 68 | $this->saveExtendInfo($id,$extend); | 68 | $this->saveExtendInfo($id,$extend); |
| 69 | - }catch (\Exception $e){ | ||
| 70 | - Log::info('错误信息---'.$e->getMessage()); | ||
| 71 | - $this->fail('系统错误请联系管理员'); | ||
| 72 | - } | 69 | +// }catch (\Exception $e){ |
| 70 | +// Log::info('错误信息---'.$e->getMessage()); | ||
| 71 | +// $this->fail('系统错误请联系管理员'); | ||
| 72 | +// } | ||
| 73 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); | 73 | $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); |
| 74 | $this->curlDelRoute(['new_route'=>$route]); | 74 | $this->curlDelRoute(['new_route'=>$route]); |
| 75 | return $this->success(); | 75 | return $this->success(); |
| @@ -88,9 +88,9 @@ class RankDataLogic extends BaseLogic | @@ -88,9 +88,9 @@ class RankDataLogic extends BaseLogic | ||
| 88 | $languageList = $languageModel->list(['project_id'=>$project['id']]); | 88 | $languageList = $languageModel->list(['project_id'=>$project['id']]); |
| 89 | if(!empty($languageList) && is_array($languageList)){ | 89 | if(!empty($languageList) && is_array($languageList)){ |
| 90 | foreach($languageList as $lang){ | 90 | foreach($languageList as $lang){ |
| 91 | - $remain_day = $lang_data[$lang['language']]['dabiao_day'] ?? 0; | 91 | + $remain_day = $lang_data[$lang['lang']]['dabiao_day'] ?? 0; |
| 92 | $data['langs'][$lang['language'] ?? ''] = [ | 92 | $data['langs'][$lang['language'] ?? ''] = [ |
| 93 | - 'lang_text' => Translate::getTls($lang['tl'] ?? ''), | 93 | + 'lang_text' => $lang['language'], |
| 94 | 'keyword_num' => $lang['keywords'] ?? 0, | 94 | 'keyword_num' => $lang['keywords'] ?? 0, |
| 95 | 'reach_day' => $lang_data[$lang['language']]['dabiao_day'] ?? 0, | 95 | 'reach_day' => $lang_data[$lang['language']]['dabiao_day'] ?? 0, |
| 96 | 'home_cnt' => $lang_data[$lang['language']]['home_cnt'] ?? 0, | 96 | 'home_cnt' => $lang_data[$lang['language']]['home_cnt'] ?? 0, |
| @@ -488,7 +488,6 @@ class RankDataLogic extends BaseLogic | @@ -488,7 +488,6 @@ class RankDataLogic extends BaseLogic | ||
| 488 | } | 488 | } |
| 489 | } | 489 | } |
| 490 | } | 490 | } |
| 491 | - | ||
| 492 | $model->project_id = $project_id; | 491 | $model->project_id = $project_id; |
| 493 | $model->first_num = $first_num; | 492 | $model->first_num = $first_num; |
| 494 | $model->first_page_num = $first_page_num; | 493 | $model->first_page_num = $first_page_num; |
| @@ -67,7 +67,7 @@ class ProductRequest extends FormRequest | @@ -67,7 +67,7 @@ class ProductRequest extends FormRequest | ||
| 67 | { | 67 | { |
| 68 | return [ | 68 | return [ |
| 69 | 'title.required' => '请输入产品标题', | 69 | 'title.required' => '请输入产品标题', |
| 70 | - 'title.max' => '产品标题不能超过20个字符', | 70 | + 'title.max' => '产品标题不能超过200个字符', |
| 71 | 'route.required' => '请输入产品链接', | 71 | 'route.required' => '请输入产品链接', |
| 72 | 'route.max' => '产品链接不能超过200个字符', | 72 | 'route.max' => '产品链接不能超过200个字符', |
| 73 | // 'gallery.required' => '请上传产品图片', | 73 | // 'gallery.required' => '请上传产品图片', |
| @@ -55,9 +55,10 @@ class RouteMap extends Base | @@ -55,9 +55,10 @@ class RouteMap extends Base | ||
| 55 | public static function generateRoute($title, $source, $source_id, $project_id){ | 55 | public static function generateRoute($title, $source, $source_id, $project_id){ |
| 56 | if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){ | 56 | if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $title)){ |
| 57 | $title = Translate::tran($title, 'en'); | 57 | $title = Translate::tran($title, 'en'); |
| 58 | - } | ||
| 59 | - if (preg_match('/[а-яА-Я]/u', $title) || mb_ereg('[а-яА-Я]', $title)) { | ||
| 60 | - $title = Translate::tran($title, 'en'); | 58 | + }else{ |
| 59 | + if(!preg_match('/^[a-zA-Z\s]+$/', $title)){ | ||
| 60 | + $title = Translate::tran($title, 'en'); | ||
| 61 | + } | ||
| 61 | } | 62 | } |
| 62 | $i=1; | 63 | $i=1; |
| 63 | $sign = generateRoute($title); | 64 | $sign = generateRoute($title); |
| @@ -193,6 +193,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -193,6 +193,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 193 | 193 | ||
| 194 | Route::prefix('language')->group(function () { | 194 | Route::prefix('language')->group(function () { |
| 195 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); | 195 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); |
| 196 | + Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); | ||
| 196 | }); | 197 | }); |
| 197 | //更新项目tdk | 198 | //更新项目tdk |
| 198 | Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); | 199 | Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); |
-
请 注册 或 登录 后发表评论