Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
3 个修改的文件
包含
74 行增加
和
21 行删除
| @@ -29,6 +29,7 @@ use App\Models\WebSetting\WebSettingReceiving; | @@ -29,6 +29,7 @@ use App\Models\WebSetting\WebSettingReceiving; | ||
| 29 | use App\Services\CosService; | 29 | use App\Services\CosService; |
| 30 | use App\Services\ProjectServer; | 30 | use App\Services\ProjectServer; |
| 31 | use Illuminate\Console\Command; | 31 | use Illuminate\Console\Command; |
| 32 | +use Illuminate\Support\Facades\Cache; | ||
| 32 | use Illuminate\Support\Facades\DB; | 33 | use Illuminate\Support\Facades\DB; |
| 33 | use Illuminate\Support\Facades\Redis; | 34 | use Illuminate\Support\Facades\Redis; |
| 34 | 35 | ||
| @@ -67,9 +68,14 @@ class ProjectUpdate extends Command | @@ -67,9 +68,14 @@ class ProjectUpdate extends Command | ||
| 67 | protected function start_update() | 68 | protected function start_update() |
| 68 | { | 69 | { |
| 69 | $task_id = $this->get_task(); | 70 | $task_id = $this->get_task(); |
| 70 | - if (!$task_id) { | 71 | + if ($task_id === false) { |
| 72 | + //所有任务执行完成 | ||
| 71 | sleep(60); | 73 | sleep(60); |
| 72 | return true; | 74 | return true; |
| 75 | + } elseif ($task_id === 0) { | ||
| 76 | + //队列任务已处理完,有进程正在查询数据库,等待5秒后执行 | ||
| 77 | + sleep(5); | ||
| 78 | + return true; | ||
| 73 | } | 79 | } |
| 74 | 80 | ||
| 75 | $task = UpdateLog::where('id', $task_id)->where('status', UpdateLog::STATUS_UN)->first(); | 81 | $task = UpdateLog::where('id', $task_id)->where('status', UpdateLog::STATUS_UN)->first(); |
| @@ -707,25 +713,11 @@ class ProjectUpdate extends Command | @@ -707,25 +713,11 @@ class ProjectUpdate extends Command | ||
| 707 | //扩展字段 | 713 | //扩展字段 |
| 708 | if ($six_read) { | 714 | if ($six_read) { |
| 709 | if ($item['extend'] ?? []) { | 715 | if ($item['extend'] ?? []) { |
| 710 | - if($project_id == 1646){ | ||
| 711 | - //特殊项目处理 | ||
| 712 | - $extend_list = []; | ||
| 713 | - foreach ($item['extend'] as $k_e=>$v_e){ | ||
| 714 | - if(empty($v_e)){ | ||
| 715 | - continue; | ||
| 716 | - } | ||
| 717 | - | ||
| 718 | - foreach ($v_e as $k_e_e => $v_e_e){ | ||
| 719 | - $extend_list[$k_e.'_'.$k_e_e] = $v_e_e; | ||
| 720 | - } | ||
| 721 | - } | ||
| 722 | - }else{ | ||
| 723 | - $extend_list = $item['extend']; | ||
| 724 | - } | ||
| 725 | - foreach ($extend_list as $ke => $ve) { | 716 | + foreach ($item['extend'] as $ke => $ve) { |
| 726 | $extend = $extend_model->read(['title' => $ke]); | 717 | $extend = $extend_model->read(['title' => $ke]); |
| 727 | if ($extend) { | 718 | if ($extend) { |
| 728 | if ($extend['type'] == 3) { | 719 | if ($extend['type'] == 3) { |
| 720 | + //图片 | ||
| 729 | $gallery = []; | 721 | $gallery = []; |
| 730 | if (is_array($ve)) { | 722 | if (is_array($ve)) { |
| 731 | foreach ($ve as $ve_img) { | 723 | foreach ($ve as $ve_img) { |
| @@ -736,8 +728,24 @@ class ProjectUpdate extends Command | @@ -736,8 +728,24 @@ class ProjectUpdate extends Command | ||
| 736 | } | 728 | } |
| 737 | $value = Arr::a2s($gallery); | 729 | $value = Arr::a2s($gallery); |
| 738 | } elseif ($extend['type'] == 4) { | 730 | } elseif ($extend['type'] == 4) { |
| 731 | + //文件 | ||
| 732 | + if (is_array($ve)) { | ||
| 733 | + if (isset($ve['title']) || isset($ve['url'])) { | ||
| 734 | + $file = [ | ||
| 735 | + [ | ||
| 736 | + 'name' => isset($ve['title']) ? $ve['title'] : '', | ||
| 737 | + 'url' => isset($ve['url']) ? $this->source_download($ve['url'], $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1) : '' | ||
| 738 | + ] | ||
| 739 | + ]; | ||
| 740 | + } else { | ||
| 741 | + $file = []; | ||
| 742 | + } | ||
| 743 | + $value = Arr::a2s($file); | ||
| 744 | + } else { | ||
| 739 | $value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]); | 745 | $value = Arr::a2s([$this->source_download($ve, $project_id, $domain_arr['host'], $web_url_domain, $home_url, 1)]); |
| 746 | + } | ||
| 740 | } else { | 747 | } else { |
| 748 | + //文本 | ||
| 741 | $value = $ve; | 749 | $value = $ve; |
| 742 | } | 750 | } |
| 743 | 751 | ||
| @@ -792,6 +800,11 @@ class ProjectUpdate extends Command | @@ -792,6 +800,11 @@ class ProjectUpdate extends Command | ||
| 792 | return $task_id; | 800 | return $task_id; |
| 793 | } | 801 | } |
| 794 | 802 | ||
| 803 | + if (!Cache::add('console_update_task_select_mysql', true, 5)) { | ||
| 804 | + //如果存在数据锁,表示有其他进程已往下执行,当前进程直接返回 | ||
| 805 | + return 0; | ||
| 806 | + } | ||
| 807 | + | ||
| 795 | $task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('sort', 'asc')->orderBy('updated_at', 'asc')->limit(20)->get(); | 808 | $task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('sort', 'asc')->orderBy('updated_at', 'asc')->limit(20)->get(); |
| 796 | if ($task_list->count() == 0) { | 809 | if ($task_list->count() == 0) { |
| 797 | return false; | 810 | return false; |
| @@ -808,7 +821,7 @@ class ProjectUpdate extends Command | @@ -808,7 +821,7 @@ class ProjectUpdate extends Command | ||
| 808 | //获取地址路由 | 821 | //获取地址路由 |
| 809 | protected function get_url_route($url) | 822 | protected function get_url_route($url) |
| 810 | { | 823 | { |
| 811 | - if (strpos($url, '%3A') !== false || strpos($url, '%2F') !== false) { | 824 | + if (strpos($url, '%') !== false) { |
| 812 | $url = urldecode($url); | 825 | $url = urldecode($url); |
| 813 | } | 826 | } |
| 814 | $arr = parse_url($url); | 827 | $arr = parse_url($url); |
| @@ -66,7 +66,7 @@ class ExtensionModuleController extends BaseController | @@ -66,7 +66,7 @@ class ExtensionModuleController extends BaseController | ||
| 66 | 'module_id.required' => '模块id不能为空', | 66 | 'module_id.required' => '模块id不能为空', |
| 67 | ]); | 67 | ]); |
| 68 | $moduleFieldModel = new ExtensionModuleField(); | 68 | $moduleFieldModel = new ExtensionModuleField(); |
| 69 | - $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']],'sort'); | 69 | + $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']],'sort',['*'],'desc'); |
| 70 | $moduleValueModel = new ExtensionModuleValue(); | 70 | $moduleValueModel = new ExtensionModuleValue(); |
| 71 | foreach ($list as $k => $v){ | 71 | foreach ($list as $k => $v){ |
| 72 | $v['is_use'] = 0; | 72 | $v['is_use'] = 0; |
| @@ -136,12 +136,25 @@ class ExtensionModuleController extends BaseController | @@ -136,12 +136,25 @@ class ExtensionModuleController extends BaseController | ||
| 136 | ],[ | 136 | ],[ |
| 137 | 'module_id.required' => '模块id不能为空', | 137 | 'module_id.required' => '模块id不能为空', |
| 138 | ]); | 138 | ]); |
| 139 | + $searchParam = [ | ||
| 140 | + 'module_id'=>$this->param['module_id'], | ||
| 141 | + ]; | ||
| 139 | $data = []; | 142 | $data = []; |
| 140 | $moduleValueModel = new ExtensionModuleValue(); | 143 | $moduleValueModel = new ExtensionModuleValue(); |
| 141 | - $lists = $moduleValueModel->list(['module_id'=>$this->param['module_id']]); | 144 | + if(isset($this->param['field_id']) && ($this->param['field_id'] != 0) && isset($this->param['value'])){ |
| 145 | + $uuidArr = $moduleValueModel->formatQuery(['field_id'=>$this->param['field_id'],'value'=>$this->param['value'],'module_id'=>$this->param['module_id']])->distinct()->pluck('id')->toArray(); | ||
| 146 | + if(!empty($uuidArr)){ | ||
| 147 | + $searchParam['uuid'] = ['in',$uuidArr]; | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + if(isset($this->param['start_time']) && !empty($this->param['start_time']) && isset($this->param['end_time']) && !empty($this->param['end_time'])){ | ||
| 151 | + $searchParam['created_at'] = ['between',[$this->param['start_time'],$this->param['end_time']]]; | ||
| 152 | + } | ||
| 153 | + $lists = $moduleValueModel->list($searchParam); | ||
| 142 | if(!empty($lists)){ | 154 | if(!empty($lists)){ |
| 143 | foreach ($lists as $k => $v){ | 155 | foreach ($lists as $k => $v){ |
| 144 | $data[$v['uuid']][$v['field_id']] = $v['value']; | 156 | $data[$v['uuid']][$v['field_id']] = $v['value']; |
| 157 | + $data[$v['uuid']]['created_at'] = $v['created_at']; | ||
| 145 | } | 158 | } |
| 146 | } | 159 | } |
| 147 | $resultData = []; | 160 | $resultData = []; |
| @@ -286,7 +299,33 @@ class ExtensionModuleController extends BaseController | @@ -286,7 +299,33 @@ class ExtensionModuleController extends BaseController | ||
| 286 | */ | 299 | */ |
| 287 | public function setSort(){ | 300 | public function setSort(){ |
| 288 | $moduleFieldModel = new ExtensionModuleField(); | 301 | $moduleFieldModel = new ExtensionModuleField(); |
| 289 | - $moduleFieldModel->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]); | 302 | + $num = 100; |
| 303 | + foreach ($this->param['id'] as $id){ | ||
| 304 | + $moduleFieldModel->edit(['sort'=>$num],['id'=>$id]); | ||
| 305 | + $num--; | ||
| 306 | + } | ||
| 307 | + $this->response('success'); | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + /** | ||
| 311 | + * @remark :设置搜索参数 | ||
| 312 | + * @name :setSearchParam | ||
| 313 | + * @author :lyh | ||
| 314 | + * @method :post | ||
| 315 | + * @time :2024/8/23 16:24 | ||
| 316 | + */ | ||
| 317 | + public function setSearchParam(){ | ||
| 318 | + $this->request->validate([ | ||
| 319 | + 'module_id'=>'required', | ||
| 320 | + 'id'=>'required|array' | ||
| 321 | + ],[ | ||
| 322 | + 'module_id.required' => '模块id不能为空', | ||
| 323 | + 'id.required'=>'id不能为空', | ||
| 324 | + 'id.array'=>'id是一个数组' | ||
| 325 | + ]); | ||
| 326 | + $moduleFieldModel = new ExtensionModuleField(); | ||
| 327 | + $moduleFieldModel->edit(['is_search'=>0],['module_id'=>$this->param['module_id']]); | ||
| 328 | + $moduleFieldModel->edit(['is_search'=>1],['id'=>['in',$this->param['id']]]); | ||
| 290 | $this->response('success'); | 329 | $this->response('success'); |
| 291 | } | 330 | } |
| 292 | } | 331 | } |
| @@ -586,6 +586,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -586,6 +586,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 586 | Route::any('/sendUniqueStr', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'sendUniqueStr'])->name('extension_module_sendUniqueStr'); | 586 | Route::any('/sendUniqueStr', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'sendUniqueStr'])->name('extension_module_sendUniqueStr'); |
| 587 | Route::any('/getFieldType', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getFieldType'])->name('extension_module_getFieldType'); | 587 | Route::any('/getFieldType', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getFieldType'])->name('extension_module_getFieldType'); |
| 588 | Route::any('/setSort', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'setSort'])->name('extension_module_setSort'); | 588 | Route::any('/setSort', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'setSort'])->name('extension_module_setSort'); |
| 589 | + Route::any('/setSearchParam', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'setSearchParam'])->name('extension_module_setSearchParam'); | ||
| 589 | }); | 590 | }); |
| 590 | 591 | ||
| 591 | //自定义小语种文本信息 | 592 | //自定义小语种文本信息 |
-
请 注册 或 登录 后发表评论