Merge remote-tracking branch 'origin/master' into akun
正在显示
20 个修改的文件
包含
560 行增加
和
40 行删除
| @@ -22,13 +22,30 @@ class CustomModuleCategoryController extends BaseController | @@ -22,13 +22,30 @@ class CustomModuleCategoryController extends BaseController | ||
| 22 | * @method :post | 22 | * @method :post |
| 23 | * @time :2023/12/4 15:43 | 23 | * @time :2023/12/4 15:43 |
| 24 | */ | 24 | */ |
| 25 | - public function list(CustomModuleCategory $customModuleCategory){ | 25 | + public function lists(CustomModuleCategory $customModuleCategory){ |
| 26 | + $this->request->validate([ | ||
| 27 | + 'module_id'=>['required'], | ||
| 28 | + ],[ | ||
| 29 | + 'module_id.required' => 'module_id不能为空', | ||
| 30 | + ]); | ||
| 26 | $this->map['project_id'] = $this->user['project_id']; | 31 | $this->map['project_id'] = $this->user['project_id']; |
| 27 | $lists = $customModuleCategory->lists($this->map,$this->page,$this->row,$this->order); | 32 | $lists = $customModuleCategory->lists($this->map,$this->page,$this->row,$this->order); |
| 28 | $this->response('success',Code::SUCCESS,$lists); | 33 | $this->response('success',Code::SUCCESS,$lists); |
| 29 | } | 34 | } |
| 30 | 35 | ||
| 31 | /** | 36 | /** |
| 37 | + * @remark :添加/编辑分类时获取分类列表 | ||
| 38 | + * @name :getCateList | ||
| 39 | + * @author :lyh | ||
| 40 | + * @method :post | ||
| 41 | + * @time :2023/12/5 17:11 | ||
| 42 | + */ | ||
| 43 | + public function getCateList(CustomModuleCategoryLogic $logic){ | ||
| 44 | + $list = $logic->getCateList(); | ||
| 45 | + $this->response('success',Code::SUCCESS,$list); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 32 | * @remark :获取当前数据详情 | 49 | * @remark :获取当前数据详情 |
| 33 | * @name :info | 50 | * @name :info |
| 34 | * @author :lyh | 51 | * @author :lyh |
| @@ -39,9 +56,9 @@ class CustomModuleCategoryController extends BaseController | @@ -39,9 +56,9 @@ class CustomModuleCategoryController extends BaseController | ||
| 39 | $this->request->validate([ | 56 | $this->request->validate([ |
| 40 | 'id'=>['required'], | 57 | 'id'=>['required'], |
| 41 | ],[ | 58 | ],[ |
| 42 | - 'id.required' => 'ID不能为空', | 59 | + 'id.required' => '主键不能为空', |
| 43 | ]); | 60 | ]); |
| 44 | - $info = $logic->getCustomModuleCategoryInfo(); | 61 | + $info = $logic->categoryInfo(); |
| 45 | $this->response('success',Code::SUCCESS,$info); | 62 | $this->response('success',Code::SUCCESS,$info); |
| 46 | } | 63 | } |
| 47 | 64 | ||
| @@ -53,7 +70,16 @@ class CustomModuleCategoryController extends BaseController | @@ -53,7 +70,16 @@ class CustomModuleCategoryController extends BaseController | ||
| 53 | * @time :2023/12/4 15:45 | 70 | * @time :2023/12/4 15:45 |
| 54 | */ | 71 | */ |
| 55 | public function save(CustomModuleCategoryLogic $logic){ | 72 | public function save(CustomModuleCategoryLogic $logic){ |
| 56 | - $logic->customModuleCategorySave(); | 73 | + $this->request->validate([ |
| 74 | + 'name'=>['required'], | ||
| 75 | + 'route'=>['required'], | ||
| 76 | + 'module_id'=>['required'] | ||
| 77 | + ],[ | ||
| 78 | + 'name.required' => '分类名称不能为空', | ||
| 79 | + 'route.required' => '分类路由不能为空', | ||
| 80 | + 'module_id.required' => '所选模块id不能为空' | ||
| 81 | + ]); | ||
| 82 | + $logic->categorySave(); | ||
| 57 | $this->response('success'); | 83 | $this->response('success'); |
| 58 | } | 84 | } |
| 59 | 85 | ||
| @@ -70,7 +96,7 @@ class CustomModuleCategoryController extends BaseController | @@ -70,7 +96,7 @@ class CustomModuleCategoryController extends BaseController | ||
| 70 | ],[ | 96 | ],[ |
| 71 | 'id.required' => 'ID不能为空', | 97 | 'id.required' => 'ID不能为空', |
| 72 | ]); | 98 | ]); |
| 73 | - $logic->customModuleCategoryDel(); | 99 | + $logic->categoryDel(); |
| 74 | $this->response('success'); | 100 | $this->response('success'); |
| 75 | } | 101 | } |
| 76 | } | 102 | } |
| @@ -22,7 +22,12 @@ class CustomModuleContentController extends BaseController | @@ -22,7 +22,12 @@ class CustomModuleContentController extends BaseController | ||
| 22 | * @method :post | 22 | * @method :post |
| 23 | * @time :2023/12/4 15:43 | 23 | * @time :2023/12/4 15:43 |
| 24 | */ | 24 | */ |
| 25 | - public function list(CustomModuleContent $customModuleContent){ | 25 | + public function lists(CustomModuleContent $customModuleContent){ |
| 26 | + $this->request->validate([ | ||
| 27 | + 'module_id'=>['required'], | ||
| 28 | + ],[ | ||
| 29 | + 'module_id.required' => 'module_id不能为空', | ||
| 30 | + ]); | ||
| 26 | $this->map['project_id'] = $this->user['project_id']; | 31 | $this->map['project_id'] = $this->user['project_id']; |
| 27 | $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order); | 32 | $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order); |
| 28 | $this->response('success',Code::SUCCESS,$lists); | 33 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -53,6 +58,15 @@ class CustomModuleContentController extends BaseController | @@ -53,6 +58,15 @@ class CustomModuleContentController extends BaseController | ||
| 53 | * @time :2023/12/4 15:45 | 58 | * @time :2023/12/4 15:45 |
| 54 | */ | 59 | */ |
| 55 | public function save(CustomModuleContentLogic $logic){ | 60 | public function save(CustomModuleContentLogic $logic){ |
| 61 | + $this->request->validate([ | ||
| 62 | + 'name'=>['required'], | ||
| 63 | + 'route'=>['required'], | ||
| 64 | + 'module_id'=>['required'] | ||
| 65 | + ],[ | ||
| 66 | + 'name.required' => '分类名称不能为空', | ||
| 67 | + 'route.required' => '分类路由不能为空', | ||
| 68 | + 'module_id.required' => '所选模块id不能为空' | ||
| 69 | + ]); | ||
| 56 | $logic->customModuleContentSave(); | 70 | $logic->customModuleContentSave(); |
| 57 | $this->response('success'); | 71 | $this->response('success'); |
| 58 | } | 72 | } |
| @@ -30,7 +30,7 @@ class CustomModuleController extends BaseController | @@ -30,7 +30,7 @@ class CustomModuleController extends BaseController | ||
| 30 | * @method :post | 30 | * @method :post |
| 31 | * @time :2023/12/4 15:43 | 31 | * @time :2023/12/4 15:43 |
| 32 | */ | 32 | */ |
| 33 | - public function list(CustomModule $customModule){ | 33 | + public function lists(CustomModule $customModule){ |
| 34 | $this->map['project_id'] = $this->user['project_id']; | 34 | $this->map['project_id'] = $this->user['project_id']; |
| 35 | $lists = $customModule->lists($this->map,$this->page,$this->row,$this->order); | 35 | $lists = $customModule->lists($this->map,$this->page,$this->row,$this->order); |
| 36 | $this->response('success',Code::SUCCESS,$lists); | 36 | $this->response('success',Code::SUCCESS,$lists); |
| @@ -61,10 +61,22 @@ class CustomModuleController extends BaseController | @@ -61,10 +61,22 @@ class CustomModuleController extends BaseController | ||
| 61 | * @time :2023/12/4 15:45 | 61 | * @time :2023/12/4 15:45 |
| 62 | */ | 62 | */ |
| 63 | public function save(CustomModuleLogic $logic){ | 63 | public function save(CustomModuleLogic $logic){ |
| 64 | + $this->request->validate([ | ||
| 65 | + 'name'=>['required'], | ||
| 66 | + ],[ | ||
| 67 | + 'name.required' => '模块名称不能为空', | ||
| 68 | + ]); | ||
| 64 | $logic->customModuleSave(); | 69 | $logic->customModuleSave(); |
| 65 | $this->response('success'); | 70 | $this->response('success'); |
| 66 | } | 71 | } |
| 67 | 72 | ||
| 73 | + /** | ||
| 74 | + * @remark :删除 | ||
| 75 | + * @name :del | ||
| 76 | + * @author :lyh | ||
| 77 | + * @method :post | ||
| 78 | + * @time :2023/12/5 9:53 | ||
| 79 | + */ | ||
| 68 | public function del(CustomModuleLogic $logic){ | 80 | public function del(CustomModuleLogic $logic){ |
| 69 | $this->request->validate([ | 81 | $this->request->validate([ |
| 70 | 'id'=>['required'], | 82 | 'id'=>['required'], |
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Inquiry; | @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Inquiry; | ||
| 5 | 5 | ||
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Bside\Inquiry\InquiryLogic; | 7 | use App\Http\Logic\Bside\Inquiry\InquiryLogic; |
| 8 | +use App\Models\Inquiry\InquiryForm; | ||
| 8 | use App\Rules\Ids; | 9 | use App\Rules\Ids; |
| 9 | use App\Services\BatchExportService; | 10 | use App\Services\BatchExportService; |
| 10 | use Illuminate\Http\Request; | 11 | use Illuminate\Http\Request; |
| @@ -20,9 +21,24 @@ use Illuminate\Support\Facades\Storage; | @@ -20,9 +21,24 @@ use Illuminate\Support\Facades\Storage; | ||
| 20 | class InquiryController extends BaseController | 21 | class InquiryController extends BaseController |
| 21 | { | 22 | { |
| 22 | 23 | ||
| 24 | + public function form_list(){ | ||
| 25 | + $list = InquiryForm::where('is_default', 0)->get(); | ||
| 26 | + $data = $list->toArray(); | ||
| 27 | + foreach ($data as &$item){ | ||
| 28 | + $field_text = []; | ||
| 29 | + foreach ($item['field'] as $v){ | ||
| 30 | + $field_text[$v] = InquiryForm::fieldMap($v); | ||
| 31 | + } | ||
| 32 | + $item['field_text'] = $field_text; | ||
| 33 | + } | ||
| 34 | + return $this->success($data); | ||
| 35 | + } | ||
| 36 | + | ||
| 23 | public function index(InquiryLogic $logic) | 37 | public function index(InquiryLogic $logic) |
| 24 | { | 38 | { |
| 25 | - if(($this->param['type']??'') == 'other'){ | 39 | + if(!empty($this->param['form_id'])){ |
| 40 | + $data = $logic->getFormDataList(); | ||
| 41 | + }elseif(($this->param['type']??'') == 'other'){ | ||
| 26 | $data = $logic->getOtherList(); | 42 | $data = $logic->getOtherList(); |
| 27 | }else{ | 43 | }else{ |
| 28 | $data = $logic->getApiList(); | 44 | $data = $logic->getApiList(); |
| @@ -36,7 +52,10 @@ class InquiryController extends BaseController | @@ -36,7 +52,10 @@ class InquiryController extends BaseController | ||
| 36 | ],[ | 52 | ],[ |
| 37 | 'id.required' => 'ID不能为空' | 53 | 'id.required' => 'ID不能为空' |
| 38 | ]); | 54 | ]); |
| 39 | - if(($this->param['type']??'') == 'other'){ | 55 | + |
| 56 | + if(!empty($this->param['form_id'])){ | ||
| 57 | + $data = $logic->getFormDataInfo($this->param['id'], $this->param['form_id']); | ||
| 58 | + }elseif(($this->param['type']??'') == 'other'){ | ||
| 40 | $data = $logic->getOtherInfo($this->param['id']); | 59 | $data = $logic->getOtherInfo($this->param['id']); |
| 41 | }else{ | 60 | }else{ |
| 42 | $data = $logic->getInfo($this->param['id']); | 61 | $data = $logic->getInfo($this->param['id']); |
| @@ -52,7 +71,9 @@ class InquiryController extends BaseController | @@ -52,7 +71,9 @@ class InquiryController extends BaseController | ||
| 52 | ],[ | 71 | ],[ |
| 53 | 'ids.required' => 'ID不能为空' | 72 | 'ids.required' => 'ID不能为空' |
| 54 | ]); | 73 | ]); |
| 55 | - if(($this->param['type']??'') == 'other'){ | 74 | + if(!empty($this->param['form_id'])){ |
| 75 | + $logic->deleteFormData($this->param['ids'], ['form_id' => $this->param['form_id']]); | ||
| 76 | + }elseif(($this->param['type']??'') == 'other'){ | ||
| 56 | $logic->deleteOther($this->param['ids']); | 77 | $logic->deleteOther($this->param['ids']); |
| 57 | }else{ | 78 | }else{ |
| 58 | $logic->delete($this->param['ids']); | 79 | $logic->delete($this->param['ids']); |
| @@ -71,13 +92,24 @@ class InquiryController extends BaseController | @@ -71,13 +92,24 @@ class InquiryController extends BaseController | ||
| 71 | */ | 92 | */ |
| 72 | public function export(InquiryLogic $logic) | 93 | public function export(InquiryLogic $logic) |
| 73 | { | 94 | { |
| 74 | - if(($this->param['type']??'') == 'other'){ | 95 | + if(!empty($this->param['form_id'])){ |
| 96 | + $data = $logic->getFormDataList(true); | ||
| 97 | + $field = InquiryForm::getField($this->param['form_id']); | ||
| 98 | + $map = [ | ||
| 99 | + 'submit_time' => '询盘发送时间', | ||
| 100 | + ]; | ||
| 101 | + foreach ($field as $v) { | ||
| 102 | + $map[$v] = InquiryForm::fieldMap($v); | ||
| 103 | + } | ||
| 104 | + $map['ip_address'] = '访问国家/地区(IP)'; | ||
| 105 | + $map['refer'] = '发送页面'; | ||
| 106 | + }elseif(($this->param['type']??'') == 'other'){ | ||
| 75 | $data = $logic->getOtherList(true); | 107 | $data = $logic->getOtherList(true); |
| 76 | $map = [ | 108 | $map = [ |
| 77 | 'submit_time' => '询盘发送时间', | 109 | 'submit_time' => '询盘发送时间', |
| 78 | 'email' => '邮箱', | 110 | 'email' => '邮箱', |
| 79 | 'ip_address' => '访问国家/地区(IP)', | 111 | 'ip_address' => '访问国家/地区(IP)', |
| 80 | - 'referer' => '发送页面', | 112 | + 'refer' => '发送页面', |
| 81 | ]; | 113 | ]; |
| 82 | }else{ | 114 | }else{ |
| 83 | $data = $logic->getApiList(true); | 115 | $data = $logic->getApiList(true); |
| @@ -95,6 +127,10 @@ class InquiryController extends BaseController | @@ -95,6 +127,10 @@ class InquiryController extends BaseController | ||
| 95 | $data = $data['list'] ?? []; | 127 | $data = $data['list'] ?? []; |
| 96 | foreach ($data as &$item){ | 128 | foreach ($data as &$item){ |
| 97 | $item['ip_address'] = "{$item['country']}({$item['ip']})"; | 129 | $item['ip_address'] = "{$item['country']}({$item['ip']})"; |
| 130 | + | ||
| 131 | + if(!empty($this->param['form_id'])){ | ||
| 132 | + $item = array_merge($item, $item['data']); | ||
| 133 | + } | ||
| 98 | } | 134 | } |
| 99 | 135 | ||
| 100 | //生成文件,发送到客户端 | 136 | //生成文件,发送到客户端 |
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Template; | @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Template; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; | 7 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; |
| 8 | +use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic; | ||
| 8 | use App\Models\Template\BModuleProject; | 9 | use App\Models\Template\BModuleProject; |
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| @@ -22,15 +23,14 @@ class BTemplateModuleController extends BaseController | @@ -22,15 +23,14 @@ class BTemplateModuleController extends BaseController | ||
| 22 | * @method :post | 23 | * @method :post |
| 23 | * @time :2023/6/29 11:33 | 24 | * @time :2023/6/29 11:33 |
| 24 | */ | 25 | */ |
| 25 | - public function lists(BTemplateModuleLogic $BTemplateModuleLogic){ | 26 | + public function lists(BTemplateModuleLogic $bTemplateModuleLogic,BTemplateModuleProjectLogic $bTemplateModuleProjectLogic){ |
| 26 | if(!isset($this->map['test_model'])){ | 27 | if(!isset($this->map['test_model'])){ |
| 27 | $this->map['test_model'] = ['in',[0,1]]; | 28 | $this->map['test_model'] = ['in',[0,1]]; |
| 28 | } | 29 | } |
| 29 | $data = []; | 30 | $data = []; |
| 30 | - $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); | 31 | + $list = $bTemplateModuleLogic->ModuleList($this->map,$this->order); |
| 31 | $data['list'] = $list; | 32 | $data['list'] = $list; |
| 32 | - $moduleProjectModel = new BModuleProject(); | ||
| 33 | - $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]); | 33 | + $module_list = $bTemplateModuleProjectLogic->ModuleList(['project_id'=>$this->user['project_id']]); |
| 34 | $data['module_list'] = $module_list; | 34 | $data['module_list'] = $module_list; |
| 35 | $this->response('success',Code::SUCCESS,$data); | 35 | $this->response('success',Code::SUCCESS,$data); |
| 36 | } | 36 | } |
| @@ -195,6 +195,9 @@ class ImageController extends Controller | @@ -195,6 +195,9 @@ class ImageController extends Controller | ||
| 195 | //保存路径 | 195 | //保存路径 |
| 196 | $url = $this->config['root'].$this->path; | 196 | $url = $this->config['root'].$this->path; |
| 197 | $image_type = $files->getClientOriginalExtension(); | 197 | $image_type = $files->getClientOriginalExtension(); |
| 198 | + if(strlen($image_type) > 7){ | ||
| 199 | + $this->response('不支持当前格式',Code::SYSTEM_ERROR); | ||
| 200 | + } | ||
| 198 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; | 201 | $fileName = uniqid().rand(10000,99999).'.'.$image_type; |
| 199 | //上传到cos | 202 | //上传到cos |
| 200 | if($this->upload_location == 1){ | 203 | if($this->upload_location == 1){ |
| @@ -22,6 +22,19 @@ class BTemplateModuleProjectLogic extends BaseLogic | @@ -22,6 +22,19 @@ class BTemplateModuleProjectLogic extends BaseLogic | ||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | + * @remark :获取左侧模块列表 | ||
| 26 | + * @name :ModuleList | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2023/6/29 13:35 | ||
| 30 | + */ | ||
| 31 | + public function ModuleList($map,$order = 'created_at',$filed = ['id','name','sort','status','image','html']){ | ||
| 32 | + $map['status'] = 0; | ||
| 33 | + $lists = $this->model->list($map,$order,$filed); | ||
| 34 | + return $this->success($lists); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 25 | * @remark :保存私有化左侧模块 | 38 | * @remark :保存私有化左侧模块 |
| 26 | * @name :moduleProjectSave | 39 | * @name :moduleProjectSave |
| 27 | * @author :lyh | 40 | * @author :lyh |
| @@ -284,21 +284,52 @@ class VisualizationLogic extends BaseLogic | @@ -284,21 +284,52 @@ class VisualizationLogic extends BaseLogic | ||
| 284 | $type = $this->getType($this->param['source'],$this->param['source_id']); | 284 | $type = $this->getType($this->param['source'],$this->param['source_id']); |
| 285 | try { | 285 | try { |
| 286 | if(in_array($type,$page_array)){//定制页面 | 286 | if(in_array($type,$page_array)){//定制页面 |
| 287 | + $this->saveVisualizationHtml(); | ||
| 288 | + }else{ | ||
| 289 | + $this->saveTemplateHtml(); | ||
| 290 | + } | ||
| 291 | + }catch (\Exception $e){ | ||
| 292 | + $this->fail('系统错误,请联系管理员'); | ||
| 293 | + } | ||
| 294 | + return $this->success(); | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + /** | ||
| 298 | + * @remark :保存定制界面 | ||
| 299 | + * @name :saveVisualizationHtml | ||
| 300 | + * @author :lyh | ||
| 301 | + * @method :post | ||
| 302 | + * @time :2023/12/5 15:42 | ||
| 303 | + */ | ||
| 304 | + public function saveVisualizationHtml(){ | ||
| 287 | $bTemplateModel = new BTemplate(); | 305 | $bTemplateModel = new BTemplate(); |
| 288 | $templateInfo = $bTemplateModel->read([ | 306 | $templateInfo = $bTemplateModel->read([ |
| 289 | - 'source'=>$this->param['source'], | ||
| 290 | - 'project_id'=>$this->user['project_id'], | ||
| 291 | - 'source_id'=>$this->param['source_id'], | ||
| 292 | - 'template_id'=>0 | 307 | + 'source'=>$this->param['source'], 'project_id'=>$this->user['project_id'], |
| 308 | + 'source_id'=>$this->param['source_id'], 'template_id'=>0 | ||
| 293 | ]); | 309 | ]); |
| 294 | if($templateInfo === false){ | 310 | if($templateInfo === false){ |
| 295 | $this->param['project_id'] = $this->user['project_id']; | 311 | $this->param['project_id'] = $this->user['project_id']; |
| 296 | $this->param['template_id'] = 0; | 312 | $this->param['template_id'] = 0; |
| 313 | +// $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'); | ||
| 314 | +// $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | ||
| 297 | $bTemplateModel->add($this->param); | 315 | $bTemplateModel->add($this->param); |
| 298 | }else{ | 316 | }else{ |
| 299 | - $bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]); | 317 | +// $param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'); |
| 318 | +// $param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | ||
| 319 | + $param['html'] = $this->param['html']; | ||
| 320 | + $bTemplateModel->edit($param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]); | ||
| 300 | } | 321 | } |
| 301 | - }else{ | 322 | + return $this->success(); |
| 323 | + } | ||
| 324 | + | ||
| 325 | + /** | ||
| 326 | + * @remark :非定制界面保存数据 | ||
| 327 | + * @name :saveTemplateHtml | ||
| 328 | + * @author :lyh | ||
| 329 | + * @method :post | ||
| 330 | + * @time :2023/12/5 15:44 | ||
| 331 | + */ | ||
| 332 | + public function saveTemplateHtml(){ | ||
| 302 | $bTemplateModel = new BTemplate(); | 333 | $bTemplateModel = new BTemplate(); |
| 303 | $templateInfo = $bTemplateModel->read([ | 334 | $templateInfo = $bTemplateModel->read([ |
| 304 | 'source'=>$this->param['source'], | 335 | 'source'=>$this->param['source'], |
| @@ -319,12 +350,6 @@ class VisualizationLogic extends BaseLogic | @@ -319,12 +350,6 @@ class VisualizationLogic extends BaseLogic | ||
| 319 | $this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']); | 350 | $this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']); |
| 320 | $this->homeOrProduct($this->param['source'],$this->param['source_id']); | 351 | $this->homeOrProduct($this->param['source'],$this->param['source_id']); |
| 321 | } | 352 | } |
| 322 | - }catch (\Exception $e){ | ||
| 323 | - $this->fail('系统错误,请联系管理员'); | ||
| 324 | - } | ||
| 325 | - return $this->success(); | ||
| 326 | - | ||
| 327 | - } | ||
| 328 | 353 | ||
| 329 | /** | 354 | /** |
| 330 | * @remark :通知首页更新 | 355 | * @remark :通知首页更新 |
| @@ -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\CustomModuleCategory; | 13 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | +use App\Models\RouteMap\RouteMap; | ||
| 14 | 15 | ||
| 15 | class CustomModuleCategoryLogic extends BaseLogic | 16 | class CustomModuleCategoryLogic extends BaseLogic |
| 16 | { | 17 | { |
| @@ -22,14 +23,65 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -22,14 +23,65 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 26 | + * @remark :添加/编辑获取分类列表 | ||
| 27 | + * @name :getCateList | ||
| 28 | + * @author :lyh | ||
| 29 | + * @method :post | ||
| 30 | + * @time :2023/12/5 17:12 | ||
| 31 | + */ | ||
| 32 | + public function getCateList(){ | ||
| 33 | + $this->param['status'] = 0; | ||
| 34 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 35 | + $str = []; | ||
| 36 | + //排序掉当前id下所有子集 | ||
| 37 | + $str = $this->getAllSub($this->param['id'],$str); | ||
| 38 | + $str[] = (int)$this->param['id']; | ||
| 39 | + $this->param['id'] = ['not in',$str]; | ||
| 40 | + } | ||
| 41 | + $menu = array(); | ||
| 42 | + $list = $this->model->list($this->param); | ||
| 43 | + if(!empty($list)){ | ||
| 44 | + foreach ($list as $k => $v){ | ||
| 45 | + if($v['pid'] == 0){ | ||
| 46 | + $v['sub'] = _get_child($v['id'],$list); | ||
| 47 | + $menu[] = $v; | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + return $this->success($menu); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :获取当前id下所有子集 | ||
| 56 | + * @name :getAllSub | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2023/10/18 15:10 | ||
| 60 | + */ | ||
| 61 | + public function getAllSub($id,&$str = []){ | ||
| 62 | + $list = $this->model->list(['pid'=>$id,'status'=>0],['id','pid']); | ||
| 63 | + if(!empty($list)){ | ||
| 64 | + foreach ($list as $v){ | ||
| 65 | + $str[] = $v['id']; | ||
| 66 | + $this->getAllSub($v['id'],$str); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + return $str; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 25 | * @remark :获取当前数据详情 | 73 | * @remark :获取当前数据详情 |
| 26 | * @name :getCustomModuleInfo | 74 | * @name :getCustomModuleInfo |
| 27 | * @author :lyh | 75 | * @author :lyh |
| 28 | * @method :post | 76 | * @method :post |
| 29 | * @time :2023/12/4 16:10 | 77 | * @time :2023/12/4 16:10 |
| 30 | */ | 78 | */ |
| 31 | - public function getCustomModuleCategoryInfo(){ | ||
| 32 | - | 79 | + public function categoryInfo(){ |
| 80 | + $info = $this->model->read($this->param); | ||
| 81 | + if($info === false){ | ||
| 82 | + $this->fail('当前数据不存在或已被删除'); | ||
| 83 | + } | ||
| 84 | + return $this->success($info); | ||
| 33 | } | 85 | } |
| 34 | 86 | ||
| 35 | /** | 87 | /** |
| @@ -39,8 +91,97 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -39,8 +91,97 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 39 | * @method :post | 91 | * @method :post |
| 40 | * @time :2023/12/4 15:47 | 92 | * @time :2023/12/4 15:47 |
| 41 | */ | 93 | */ |
| 42 | - public function customModuleCategorySave(){ | 94 | + public function categorySave(){ |
| 95 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 96 | + $this->categoryEdit(); | ||
| 97 | + }else{ | ||
| 98 | + $this->categoryAdd(); | ||
| 99 | + } | ||
| 100 | + return $this->success(); | ||
| 101 | + } | ||
| 43 | 102 | ||
| 103 | + /** | ||
| 104 | + * @remark :添加分类 | ||
| 105 | + * @name :categoryAdd | ||
| 106 | + * @author :lyh | ||
| 107 | + * @method :post | ||
| 108 | + * @time :2023/12/5 10:55 | ||
| 109 | + */ | ||
| 110 | + public function categoryAdd(){ | ||
| 111 | + try { | ||
| 112 | + $id = $this->model->addReturnId($this->param); | ||
| 113 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], $id, $this->user['project_id']); | ||
| 114 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route); | ||
| 115 | + $this->edit(['url' => $route], ['id' => $id]); | ||
| 116 | + }catch (\Exception $e){ | ||
| 117 | + $this->fail('系统错误,请联系管理员'); | ||
| 118 | + } | ||
| 119 | + return $this->success(); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * @remark :编辑分类 | ||
| 124 | + * @name :categoryEdit | ||
| 125 | + * @author :lyh | ||
| 126 | + * @method :post | ||
| 127 | + * @time :2023/12/5 10:55 | ||
| 128 | + */ | ||
| 129 | + public function categoryEdit(){ | ||
| 130 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], $this->param['id'], $this->user['project_id']); | ||
| 131 | + $this->editNewsRoute($this->param['id'],$route); | ||
| 132 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 133 | + if($rs === false){ | ||
| 134 | + $this->fail('系统错误,请连续管理员'); | ||
| 135 | + } | ||
| 136 | + return $this->success(); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * @remark :查看是否编辑路由 | ||
| 141 | + * @name :editCategoryRoute | ||
| 142 | + * @author :lyh | ||
| 143 | + * @method :post | ||
| 144 | + * @time :2023/9/7 11:05 | ||
| 145 | + */ | ||
| 146 | + public function editNewsRoute($id, $route) | ||
| 147 | + { | ||
| 148 | + //生成一条删除路由记录 | ||
| 149 | + $info = $this->model->read(['id' => $id], ['id', 'route']); | ||
| 150 | + if ($info['route'] != $route) { | ||
| 151 | + $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route); | ||
| 152 | + $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | ||
| 153 | + } | ||
| 154 | + return true; | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + /** | ||
| 158 | + * @name :(添加分类时处理子集分类)addProcessingSon | ||
| 159 | + * @author :lyh | ||
| 160 | + * @method :post | ||
| 161 | + * @time :2023/6/13 11:34 | ||
| 162 | + */ | ||
| 163 | + public function addProcessingSon($cate_id){ | ||
| 164 | + if(isset($this->param['pid']) && !empty($this->param['pid'])) { | ||
| 165 | + $this->param['pid'] = 0; | ||
| 166 | + } | ||
| 167 | + //判断为子分类时 | ||
| 168 | + if($this->param['pid'] != 0) { | ||
| 169 | + //查看当前上级分类下是否有其他分类 | ||
| 170 | + $cate_info = $this->model->read(['pid' => $this->param['pid'], 'id' => ['!=', $cate_id]]); | ||
| 171 | + if ($cate_info === false) { | ||
| 172 | + //查看当前上一级分类下是否有关联模块内容 | ||
| 173 | + $newsModel = new NewsModel(); | ||
| 174 | + $news_count = $newsModel->where('category_id','like', '%,' . $this->param['pid'] . ',%')->count(); | ||
| 175 | + if ($news_count > 0) { | ||
| 176 | + $replacement = ',' . $cate_id . ','; | ||
| 177 | + $old = ',' . $this->param['pid'] . ','; | ||
| 178 | + //更新所有商品到当前分类 | ||
| 179 | + $newsModel->where('category_id', 'like', '%' . $old . '%') | ||
| 180 | + ->update(['category_id' => DB::raw("REPLACE(category_id, '$old', '$replacement')")]); | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + return $this->success(); | ||
| 44 | } | 185 | } |
| 45 | 186 | ||
| 46 | /** | 187 | /** |
| @@ -50,7 +191,15 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -50,7 +191,15 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 50 | * @method :post | 191 | * @method :post |
| 51 | * @time :2023/12/4 15:47 | 192 | * @time :2023/12/4 15:47 |
| 52 | */ | 193 | */ |
| 53 | - public function customModuleCategoryDel(){ | ||
| 54 | - | 194 | + public function categoryDel(){ |
| 195 | + $info = $this->model->read(['pid' => $this->param['id']], ['id', 'route']); | ||
| 196 | + if($info === false){ | ||
| 197 | + $this->fail('当前分类拥有下级'); | ||
| 198 | + } | ||
| 199 | + $rs = $this->model->del($this->param); | ||
| 200 | + if($rs === false){ | ||
| 201 | + $this->fail('系统错误,请连续管理员'); | ||
| 202 | + } | ||
| 203 | + return $this->success(); | ||
| 55 | } | 204 | } |
| 56 | } | 205 | } |
| @@ -29,7 +29,11 @@ class CustomModuleContentLogic extends BaseLogic | @@ -29,7 +29,11 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 29 | * @time :2023/12/4 16:10 | 29 | * @time :2023/12/4 16:10 |
| 30 | */ | 30 | */ |
| 31 | public function getCustomModuleContentInfo(){ | 31 | public function getCustomModuleContentInfo(){ |
| 32 | - | 32 | + $info = $this->model->read($this->param); |
| 33 | + if($info === false){ | ||
| 34 | + $this->fail('当前数据不存在或已被删除'); | ||
| 35 | + } | ||
| 36 | + return $this->success($info); | ||
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | /** | 39 | /** |
| @@ -11,6 +11,8 @@ namespace App\Http\Logic\Bside\CustomModule; | @@ -11,6 +11,8 @@ 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\CustomModule; | 13 | use App\Models\CustomModule\CustomModule; |
| 14 | +use App\Models\CustomModule\CustomModuleCategory; | ||
| 15 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 14 | 16 | ||
| 15 | class CustomModuleLogic extends BaseLogic | 17 | class CustomModuleLogic extends BaseLogic |
| 16 | { | 18 | { |
| @@ -29,7 +31,11 @@ class CustomModuleLogic extends BaseLogic | @@ -29,7 +31,11 @@ class CustomModuleLogic extends BaseLogic | ||
| 29 | * @time :2023/12/4 16:10 | 31 | * @time :2023/12/4 16:10 |
| 30 | */ | 32 | */ |
| 31 | public function getCustomModuleInfo(){ | 33 | public function getCustomModuleInfo(){ |
| 32 | - | 34 | + $info = $this->model->read($this->param); |
| 35 | + if($info === false){ | ||
| 36 | + $this->fail('当前数据不存在或已被删除'); | ||
| 37 | + } | ||
| 38 | + return $this->success($info); | ||
| 33 | } | 39 | } |
| 34 | 40 | ||
| 35 | /** | 41 | /** |
| @@ -40,7 +46,42 @@ class CustomModuleLogic extends BaseLogic | @@ -40,7 +46,42 @@ class CustomModuleLogic extends BaseLogic | ||
| 40 | * @time :2023/12/4 15:47 | 46 | * @time :2023/12/4 15:47 |
| 41 | */ | 47 | */ |
| 42 | public function customModuleSave(){ | 48 | public function customModuleSave(){ |
| 49 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 50 | + $this->moduleEdit(); | ||
| 51 | + }else{ | ||
| 52 | + $this->moduleAdd(); | ||
| 53 | + } | ||
| 54 | + return $this->success(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @remark :新增 | ||
| 59 | + * @name :moduleAdd | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2023/12/5 9:39 | ||
| 63 | + */ | ||
| 64 | + public function moduleAdd(){ | ||
| 65 | + $rs = $this->model->add($this->param); | ||
| 66 | + if($rs === false){ | ||
| 67 | + $this->fail('系统错误,请联系管理员'); | ||
| 68 | + } | ||
| 69 | + return $this->success(); | ||
| 70 | + } | ||
| 43 | 71 | ||
| 72 | + /** | ||
| 73 | + * @remark :编辑 | ||
| 74 | + * @name :moduleEdit | ||
| 75 | + * @author :lyh | ||
| 76 | + * @method :post | ||
| 77 | + * @time :2023/12/5 9:39 | ||
| 78 | + */ | ||
| 79 | + public function moduleEdit(){ | ||
| 80 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 81 | + if($rs === false){ | ||
| 82 | + $this->fail('系统错误,请联系管理员'); | ||
| 83 | + } | ||
| 84 | + return $this->success(); | ||
| 44 | } | 85 | } |
| 45 | 86 | ||
| 46 | /** | 87 | /** |
| @@ -51,6 +92,21 @@ class CustomModuleLogic extends BaseLogic | @@ -51,6 +92,21 @@ class CustomModuleLogic extends BaseLogic | ||
| 51 | * @time :2023/12/4 15:47 | 92 | * @time :2023/12/4 15:47 |
| 52 | */ | 93 | */ |
| 53 | public function customModuleDel(){ | 94 | public function customModuleDel(){ |
| 54 | - | 95 | + //查看当前模块是否拥有数据 |
| 96 | + $contentModel = new CustomModuleContent(); | ||
| 97 | + $contentInfo = $contentModel->read(['module_id'=>$this->param['id']],['id']); | ||
| 98 | + if($contentInfo !== false){ | ||
| 99 | + $this->fail('当前模块拥有内容不允许删除'); | ||
| 100 | + } | ||
| 101 | + $categoryModel = new CustomModuleCategory(); | ||
| 102 | + $categoryInfo = $categoryModel->read(['module_id'=>$this->param['id']],['id']); | ||
| 103 | + if($categoryInfo !== false){ | ||
| 104 | + $this->fail('当前模块拥有分类不允许删除'); | ||
| 105 | + } | ||
| 106 | + $rs = $this->model->del($this->param); | ||
| 107 | + if($rs === false){ | ||
| 108 | + $this->fail('系统错误,请联系管理员'); | ||
| 109 | + } | ||
| 110 | + return $this->success(); | ||
| 55 | } | 111 | } |
| 56 | } | 112 | } |
| @@ -8,8 +8,9 @@ use App\Helper\Translate; | @@ -8,8 +8,9 @@ use App\Helper\Translate; | ||
| 8 | use App\Http\Logic\Aside\Project\ProjectLogic; | 8 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 9 | use App\Http\Logic\Bside\BaseLogic; | 9 | use App\Http\Logic\Bside\BaseLogic; |
| 10 | use App\Models\Domain\DomainInfo; | 10 | use App\Models\Domain\DomainInfo; |
| 11 | +use App\Models\Inquiry\InquiryForm; | ||
| 12 | +use App\Models\Inquiry\InquiryFormData; | ||
| 11 | use App\Models\Inquiry\InquiryOther; | 13 | use App\Models\Inquiry\InquiryOther; |
| 12 | -use App\Services\ProjectServer; | ||
| 13 | use Illuminate\Support\Facades\DB; | 14 | use Illuminate\Support\Facades\DB; |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| @@ -68,7 +69,6 @@ class InquiryLogic extends BaseLogic | @@ -68,7 +69,6 @@ class InquiryLogic extends BaseLogic | ||
| 68 | if($search){ | 69 | if($search){ |
| 69 | $map['email'] = ['like','%'.$search.'%']; | 70 | $map['email'] = ['like','%'.$search.'%']; |
| 70 | } | 71 | } |
| 71 | - ProjectServer::useProject($this->user['project_id']); | ||
| 72 | 72 | ||
| 73 | $data = (new InquiryOther())->lists($map,$page,$page_size,'id', | 73 | $data = (new InquiryOther())->lists($map,$page,$page_size,'id', |
| 74 | ['id', 'email', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), 'submit_time'] | 74 | ['id', 'email', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), 'submit_time'] |
| @@ -77,6 +77,27 @@ class InquiryLogic extends BaseLogic | @@ -77,6 +77,27 @@ class InquiryLogic extends BaseLogic | ||
| 77 | return $this->success($data); | 77 | return $this->success($data); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | + public function getFormDataList($export = false){ | ||
| 81 | + $page_size = $export ? 1000 : 20; | ||
| 82 | + $search = $this->request['search'] ?: ''; | ||
| 83 | + $page = $this->request['page'] ?: 1; | ||
| 84 | + $form_id = $this->request['form_id'] ?? ''; | ||
| 85 | + $field = InquiryForm::getField($form_id); | ||
| 86 | + $map = [ | ||
| 87 | + 'form_id' => $form_id | ||
| 88 | + ]; | ||
| 89 | + if($search){ | ||
| 90 | + foreach ($field as $v){ | ||
| 91 | + $map['data->' . $v] = $search; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + $fields = ['id', 'data', 'ip', 'country', 'domain', DB::raw('referer as refer'), DB::raw('status as read_status'), DB::raw('submit_at as submit_time')]; | ||
| 95 | + $lists = InquiryFormData::select($fields)->orderBy('id')->paginate($page_size, ['*'], 'page', $page); | ||
| 96 | + $data = $lists->toArray(); | ||
| 97 | + | ||
| 98 | + return $this->success($data); | ||
| 99 | + } | ||
| 100 | + | ||
| 80 | public function getInfo($id) | 101 | public function getInfo($id) |
| 81 | { | 102 | { |
| 82 | $project = (new ProjectLogic())->getProjectInfo($this->user['project_id']); | 103 | $project = (new ProjectLogic())->getProjectInfo($this->user['project_id']); |
| @@ -93,10 +114,22 @@ class InquiryLogic extends BaseLogic | @@ -93,10 +114,22 @@ class InquiryLogic extends BaseLogic | ||
| 93 | return $this->success(['trans_message' => $trans_message]); | 114 | return $this->success(['trans_message' => $trans_message]); |
| 94 | } | 115 | } |
| 95 | 116 | ||
| 117 | + public function getFormDataInfo($id, $form_id){ | ||
| 118 | + //修改状态为已读 | ||
| 119 | + if($this->request['read_status']){ | ||
| 120 | + (new InquiryFormData())->edit(['status' => 1], ['id' => $id, 'form_id' => $form_id]); | ||
| 121 | + } | ||
| 122 | + //翻译 | ||
| 123 | + $trans_message = ''; | ||
| 124 | + if($this->request['message']){ | ||
| 125 | + $trans_message = Translate::tran($this->request['message'], 'zh'); | ||
| 126 | + } | ||
| 127 | + return $this->success(['trans_message' => $trans_message]); | ||
| 128 | + } | ||
| 129 | + | ||
| 96 | public function getOtherInfo($id){ | 130 | public function getOtherInfo($id){ |
| 97 | //修改状态为已读 | 131 | //修改状态为已读 |
| 98 | if($this->request['read_status']){ | 132 | if($this->request['read_status']){ |
| 99 | - ProjectServer::useProject($this->user['project_id']); | ||
| 100 | (new InquiryOther())->edit(['status' => 1], ['id' => $id]); | 133 | (new InquiryOther())->edit(['status' => 1], ['id' => $id]); |
| 101 | } | 134 | } |
| 102 | return $this->success(['trans_message' => '']); | 135 | return $this->success(['trans_message' => '']); |
| @@ -120,11 +153,21 @@ class InquiryLogic extends BaseLogic | @@ -120,11 +153,21 @@ class InquiryLogic extends BaseLogic | ||
| 120 | if(!$ids){ | 153 | if(!$ids){ |
| 121 | $this->fail('ID不能为空'); | 154 | $this->fail('ID不能为空'); |
| 122 | } | 155 | } |
| 123 | - ProjectServer::useProject($this->user['project_id']); | ||
| 124 | (new InquiryOther())->del(['id'=>['in',$ids]]); | 156 | (new InquiryOther())->del(['id'=>['in',$ids]]); |
| 125 | return $this->success(); | 157 | return $this->success(); |
| 126 | } | 158 | } |
| 127 | 159 | ||
| 160 | + public function deleteFormData($ids, $map = []) | ||
| 161 | + { | ||
| 162 | + $ids = array_filter(Arr::splitFilterToArray($ids), 'intval'); | ||
| 163 | + if(!$ids){ | ||
| 164 | + $this->fail('ID不能为空'); | ||
| 165 | + } | ||
| 166 | + $map['id'] = ['in',$ids]; | ||
| 167 | + (new InquiryFormData())->del($map); | ||
| 168 | + return $this->success(); | ||
| 169 | + } | ||
| 170 | + | ||
| 128 | 171 | ||
| 129 | 172 | ||
| 130 | } | 173 | } |
| @@ -14,4 +14,6 @@ use App\Models\Base; | @@ -14,4 +14,6 @@ use App\Models\Base; | ||
| 14 | class CustomModule extends Base | 14 | class CustomModule extends Base |
| 15 | { | 15 | { |
| 16 | protected $table = 'gl_custom_module'; | 16 | protected $table = 'gl_custom_module'; |
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 17 | } | 19 | } |
| @@ -14,4 +14,6 @@ use App\Models\Base; | @@ -14,4 +14,6 @@ use App\Models\Base; | ||
| 14 | class CustomModuleCategory extends Base | 14 | class CustomModuleCategory extends Base |
| 15 | { | 15 | { |
| 16 | protected $table = 'gl_custom_module_category'; | 16 | protected $table = 'gl_custom_module_category'; |
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 17 | } | 19 | } |
| @@ -14,4 +14,6 @@ use App\Models\Base; | @@ -14,4 +14,6 @@ use App\Models\Base; | ||
| 14 | class CustomModuleContent extends Base | 14 | class CustomModuleContent extends Base |
| 15 | { | 15 | { |
| 16 | protected $table = 'gl_custom_module_content'; | 16 | protected $table = 'gl_custom_module_content'; |
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 17 | } | 19 | } |
| @@ -14,4 +14,6 @@ use App\Models\Base; | @@ -14,4 +14,6 @@ use App\Models\Base; | ||
| 14 | class CustomModuleExtend extends Base | 14 | class CustomModuleExtend extends Base |
| 15 | { | 15 | { |
| 16 | protected $table = 'gl_custom_module_extent'; | 16 | protected $table = 'gl_custom_module_extent'; |
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 17 | } | 19 | } |
app/Models/Inquiry/InquiryForm.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Inquiry; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | +use Illuminate\Support\Facades\Cache; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Class InquiryForm | ||
| 11 | + * @package App\Models\Inquiry | ||
| 12 | + * @author zbj | ||
| 13 | + * @date 2023/12/5 | ||
| 14 | + */ | ||
| 15 | +class InquiryForm extends Base | ||
| 16 | +{ | ||
| 17 | + use SoftDeletes; | ||
| 18 | + | ||
| 19 | + //设置关联表名 | ||
| 20 | + /** | ||
| 21 | + * @var mixed | ||
| 22 | + */ | ||
| 23 | + protected $connection = "custom_mysql"; | ||
| 24 | + protected $table = 'gl_inquiry_form'; | ||
| 25 | + | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 预设字段名称 | ||
| 29 | + * @author zbj | ||
| 30 | + * @date 2023/12/5 | ||
| 31 | + */ | ||
| 32 | + public static function fieldMap($field = ''){ | ||
| 33 | + $map = [ | ||
| 34 | + 'name' => '姓名', | ||
| 35 | + 'email' => '邮箱', | ||
| 36 | + 'phone' => '电话', | ||
| 37 | + 'mobile' => '电话', | ||
| 38 | + 'message' => '询盘内容', | ||
| 39 | + 'company' => '公司名称' | ||
| 40 | + ]; | ||
| 41 | + if($field){ | ||
| 42 | + return $map[$field] ?? $field; | ||
| 43 | + } | ||
| 44 | + return $map; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + public function getFieldAttribute($value) | ||
| 49 | + { | ||
| 50 | + return json_decode($value, true); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @author zbj | ||
| 55 | + * @date 2023/12/5 | ||
| 56 | + */ | ||
| 57 | + public static function getField($form_id){ | ||
| 58 | + $cache_key = 'inquiry_form_field_' . $form_id; | ||
| 59 | + $field = Cache::get($cache_key); | ||
| 60 | + if(!$field){ | ||
| 61 | + $field = self::where('id', $form_id)->value('field'); | ||
| 62 | + $field && Cache::set($cache_key, $field, 3600); | ||
| 63 | + } | ||
| 64 | + return $field; | ||
| 65 | + } | ||
| 66 | +} |
app/Models/Inquiry/InquiryFormData.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Inquiry; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class InquiryFormData | ||
| 10 | + * @package App\Models\Inquiry | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2023/12/4 | ||
| 13 | + */ | ||
| 14 | +class InquiryFormData extends Base | ||
| 15 | +{ | ||
| 16 | + use SoftDeletes; | ||
| 17 | + | ||
| 18 | + //设置关联表名 | ||
| 19 | + /** | ||
| 20 | + * @var mixed | ||
| 21 | + */ | ||
| 22 | + protected $connection = "custom_mysql"; | ||
| 23 | + protected $table = 'gl_inquiry_form_data'; | ||
| 24 | + | ||
| 25 | + public function getDataAttribute($value) | ||
| 26 | + { | ||
| 27 | + return json_decode($value, true); | ||
| 28 | + } | ||
| 29 | +} |
| @@ -38,6 +38,11 @@ class RouteMap extends Base | @@ -38,6 +38,11 @@ class RouteMap extends Base | ||
| 38 | 38 | ||
| 39 | const SOURCE_NAV = 'nav'; | 39 | const SOURCE_NAV = 'nav'; |
| 40 | 40 | ||
| 41 | + //自定义模块 | ||
| 42 | + const SOURCE_MODULE = 'module_'; | ||
| 43 | + | ||
| 44 | + //自定义模块分类 | ||
| 45 | + const SOURCE_MODULE_CATE = 'module_cate_'; | ||
| 41 | /** | 46 | /** |
| 42 | * 生成路由标识 | 47 | * 生成路由标识 |
| 43 | * @param $title | 48 | * @param $title |
| @@ -78,9 +83,17 @@ class RouteMap extends Base | @@ -78,9 +83,17 @@ class RouteMap extends Base | ||
| 78 | if(in_array($route, $fixed)){ | 83 | if(in_array($route, $fixed)){ |
| 79 | return true; | 84 | return true; |
| 80 | } | 85 | } |
| 86 | + $path = ''; | ||
| 87 | + if($source == self::SOURCE_NEWS){ | ||
| 88 | + $path = self::SOURCE_NEWS; | ||
| 89 | + }elseif ($source == self::SOURCE_BLOG){ | ||
| 90 | + $path = self::SOURCE_BLOG.'s'; | ||
| 91 | + } | ||
| 92 | + | ||
| 81 | $where = [ | 93 | $where = [ |
| 82 | 'project_id' => $project_id, | 94 | 'project_id' => $project_id, |
| 83 | 'route' => $route, | 95 | 'route' => $route, |
| 96 | + 'path' => $path, | ||
| 84 | ]; | 97 | ]; |
| 85 | $route = self::where($where)->first(); | 98 | $route = self::where($where)->first(); |
| 86 | if($route){ | 99 | if($route){ |
| @@ -271,6 +271,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -271,6 +271,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 271 | //精准询盘 | 271 | //精准询盘 |
| 272 | Route::prefix('inquiry')->group(function () { | 272 | Route::prefix('inquiry')->group(function () { |
| 273 | Route::get('/', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'index'])->name('inquiry'); | 273 | Route::get('/', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'index'])->name('inquiry'); |
| 274 | + Route::get('/form_list', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'form_list'])->name('inquiry_form_list'); | ||
| 274 | Route::get('/info', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'info'])->name('inquiry_info'); | 275 | Route::get('/info', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'info'])->name('inquiry_info'); |
| 275 | Route::any('/delete', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'delete'])->name('inquiry_delete'); | 276 | Route::any('/delete', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'delete'])->name('inquiry_delete'); |
| 276 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); | 277 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); |
| @@ -422,6 +423,28 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -422,6 +423,28 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 422 | Route::prefix('language')->group(function () { | 423 | Route::prefix('language')->group(function () { |
| 423 | Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists'); | 424 | Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists'); |
| 424 | }); | 425 | }); |
| 426 | + | ||
| 427 | + //自定义模板 | ||
| 428 | + Route::prefix('custom')->group(function () { | ||
| 429 | + Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists'); | ||
| 430 | + Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'save'])->name('custom_save'); | ||
| 431 | + Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'del'])->name('custom_del'); | ||
| 432 | + | ||
| 433 | + Route::prefix('category')->group(function () { | ||
| 434 | + Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'lists'])->name('custom_category_lists'); | ||
| 435 | + Route::any('/getCateList', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'getCateList'])->name('custom_category_getCateList'); | ||
| 436 | + Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'info'])->name('custom_category_info'); | ||
| 437 | + Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save'); | ||
| 438 | + Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del'); | ||
| 439 | + }); | ||
| 440 | + | ||
| 441 | + Route::prefix('content')->group(function () { | ||
| 442 | + Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'lists'])->name('custom_content_lists'); | ||
| 443 | + Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'info'])->name('custom_content_info'); | ||
| 444 | + Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'save'])->name('custom_content_save'); | ||
| 445 | + Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del'); | ||
| 446 | + }); | ||
| 447 | + }); | ||
| 425 | }); | 448 | }); |
| 426 | //无需登录验证的路由组 | 449 | //无需登录验证的路由组 |
| 427 | Route::group([], function () { | 450 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论