Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
8 个修改的文件
包含
127 行增加
和
12 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\Nav; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Enums\Common\Code; | ||
| 7 | +use App\Http\Controllers\Bside\BaseController; | ||
| 8 | +use App\Models\Nav\BNavGroup; | ||
| 9 | +use Illuminate\Http\Request; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * 导航组 | ||
| 13 | + * Class NavGroupController | ||
| 14 | + * @package App\Http\Controllers\Bside\Nav | ||
| 15 | + * @author zbj | ||
| 16 | + * @date 2023/10/9 | ||
| 17 | + */ | ||
| 18 | +class NavGroupController extends BaseController | ||
| 19 | +{ | ||
| 20 | + | ||
| 21 | + public function index(BNavGroup $nav_group){ | ||
| 22 | + $this->map['project_id'] = $this->user['project_id']; | ||
| 23 | + $lists = $nav_group->list($this->map, 'id', ['id', 'name'], 'asc'); | ||
| 24 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public function save(Request $request){ | ||
| 28 | + $request->validate([ | ||
| 29 | + 'name'=> ['required','max:100'], | ||
| 30 | + ],[ | ||
| 31 | + 'name.required' => '菜单组名称不能为空', | ||
| 32 | + 'name.max' => '菜单组名称不能超过100个字符' | ||
| 33 | + ]); | ||
| 34 | + if(empty($this->param['id'])){ | ||
| 35 | + $nav_group = new BNavGroup(); | ||
| 36 | + }else{ | ||
| 37 | + if(in_array($this->param['id'], [BNavGroup::DEFAULT_HEADER_ID,BNavGroup::DEFAULT_FOOTER_ID])){ | ||
| 38 | + $this->fail('系统内置菜单组不能修改'); | ||
| 39 | + } | ||
| 40 | + $nav_group = BNavGroup::find($this->param['id']); | ||
| 41 | + if(!$nav_group){ | ||
| 42 | + $this->fail('数据不存在或者已经删除'); | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + $nav_group->project_id = $this->user['project_id']; | ||
| 46 | + $nav_group->name = $this->param['name']; | ||
| 47 | + $nav_group->save(); | ||
| 48 | + | ||
| 49 | + $this->response('success'); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public function delete(Request $request){ | ||
| 53 | + $request->validate([ | ||
| 54 | + 'id'=>'required', | ||
| 55 | + ],[ | ||
| 56 | + 'id.required' => 'ID不能为空', | ||
| 57 | + ]); | ||
| 58 | + if(in_array($this->param['id'], [BNavGroup::DEFAULT_HEADER_ID,BNavGroup::DEFAULT_FOOTER_ID])){ | ||
| 59 | + $this->fail('系统内置菜单组不能删除'); | ||
| 60 | + } | ||
| 61 | + $nav_group = BNavGroup::find($this->param['id']); | ||
| 62 | + if(!$nav_group){ | ||
| 63 | + $this->response('数据不存在或者已经删除'); | ||
| 64 | + } | ||
| 65 | + $nav_group->delete(); | ||
| 66 | + | ||
| 67 | + $this->response('success'); | ||
| 68 | + } | ||
| 69 | +} |
| @@ -158,8 +158,6 @@ class ProjectLogic extends BaseLogic | @@ -158,8 +158,6 @@ class ProjectLogic extends BaseLogic | ||
| 158 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, | 158 | 'upload_max_size' => $param['upload_config']['upload_max_size'] ?? 5, |
| 159 | ]; | 159 | ]; |
| 160 | } | 160 | } |
| 161 | - | ||
| 162 | - | ||
| 163 | $this->model->edit($param,['id'=>$param['id']]); | 161 | $this->model->edit($param,['id'=>$param['id']]); |
| 164 | Common::del_user_cache($this->model->getTable(),$param['id']); | 162 | Common::del_user_cache($this->model->getTable(),$param['id']); |
| 165 | return $this->success(); | 163 | return $this->success(); |
| @@ -196,9 +194,6 @@ class ProjectLogic extends BaseLogic | @@ -196,9 +194,6 @@ class ProjectLogic extends BaseLogic | ||
| 196 | */ | 194 | */ |
| 197 | protected function saveProjectDeployBuild($deploy_build){ | 195 | protected function saveProjectDeployBuild($deploy_build){ |
| 198 | $deployBuildModel = new DeployBuild(); | 196 | $deployBuildModel = new DeployBuild(); |
| 199 | - if(isset($deploy_build['configuration']['build_status']) && ($deploy_build['configuration']['build_status'] == 0)){ | ||
| 200 | - | ||
| 201 | - } | ||
| 202 | $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); | 197 | $deploy_build['configuration'] = Arr::a2s(!empty($deploy_build['configuration']) ? $deploy_build['configuration'] : []); |
| 203 | $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); | 198 | $deployBuildModel->edit($deploy_build,['id'=>$deploy_build['id']]); |
| 204 | return $this->success(); | 199 | return $this->success(); |
| @@ -7,7 +7,6 @@ use App\Models\Service\Service as ServiceSettingModel; | @@ -7,7 +7,6 @@ use App\Models\Service\Service as ServiceSettingModel; | ||
| 7 | use App\Models\Template\Template; | 7 | use App\Models\Template\Template; |
| 8 | use App\Models\Template\Setting; | 8 | use App\Models\Template\Setting; |
| 9 | use Illuminate\Support\Facades\DB; | 9 | use Illuminate\Support\Facades\DB; |
| 10 | -use mysql_xdevapi\Exception; | ||
| 11 | 10 | ||
| 12 | class ATemplateLogic extends BaseLogic | 11 | class ATemplateLogic extends BaseLogic |
| 13 | { | 12 | { |
| @@ -141,7 +140,7 @@ class ATemplateLogic extends BaseLogic | @@ -141,7 +140,7 @@ class ATemplateLogic extends BaseLogic | ||
| 141 | ]; | 140 | ]; |
| 142 | $serviceSettingModel->insert($data); | 141 | $serviceSettingModel->insert($data); |
| 143 | DB::commit(); | 142 | DB::commit(); |
| 144 | - }catch (Exception $e){ | 143 | + }catch (\Exception $e){ |
| 145 | DB::rollBack(); | 144 | DB::rollBack(); |
| 146 | $this->fail('error'); | 145 | $this->fail('error'); |
| 147 | } | 146 | } |
| @@ -33,7 +33,7 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -33,7 +33,7 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 33 | * @time :2023/5/8 16:26 | 33 | * @time :2023/5/8 16:26 |
| 34 | */ | 34 | */ |
| 35 | public function setting_receiving_save(){ | 35 | public function setting_receiving_save(){ |
| 36 | -// try { | 36 | + try { |
| 37 | $this->model->del(['project_id'=>$this->user['project_id']]); | 37 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 38 | foreach ($this->param['data'] as $k => $v){ | 38 | foreach ($this->param['data'] as $k => $v){ |
| 39 | $v['project_id'] = $this->user['project_id']; | 39 | $v['project_id'] = $this->user['project_id']; |
| @@ -42,9 +42,9 @@ class WebSettingReceivingLogic extends BaseLogic | @@ -42,9 +42,9 @@ class WebSettingReceivingLogic extends BaseLogic | ||
| 42 | $this->param['data'][$k] = $v; | 42 | $this->param['data'][$k] = $v; |
| 43 | } | 43 | } |
| 44 | $this->model->insert($this->param['data']); | 44 | $this->model->insert($this->param['data']); |
| 45 | -// }catch (\Exception $e){ | ||
| 46 | -// $this->fail('error'); | ||
| 47 | -// } | 45 | + }catch (\Exception $e){ |
| 46 | + $this->fail('error'); | ||
| 47 | + } | ||
| 48 | return $this->success(); | 48 | return $this->success(); |
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| @@ -41,6 +41,9 @@ class WebSettingServiceLogic extends BaseLogic | @@ -41,6 +41,9 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 41 | //删除以前的数据 | 41 | //删除以前的数据 |
| 42 | $this->model->del(['project_id'=>$this->user['project_id']]); | 42 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 43 | foreach ($this->param['data'] as $k => $v){ | 43 | foreach ($this->param['data'] as $k => $v){ |
| 44 | + if(!isset($v['values']) || empty($v['values'])){ | ||
| 45 | + $v['values'] = ''; | ||
| 46 | + } | ||
| 44 | $v['project_id'] = $this->user['project_id']; | 47 | $v['project_id'] = $this->user['project_id']; |
| 45 | $v['created_at'] = date('Y-m-d H:i:s'); | 48 | $v['created_at'] = date('Y-m-d H:i:s'); |
| 46 | $v['updated_at'] = date('Y-m-d H:i:s'); | 49 | $v['updated_at'] = date('Y-m-d H:i:s'); |
| @@ -50,7 +53,7 @@ class WebSettingServiceLogic extends BaseLogic | @@ -50,7 +53,7 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 50 | DB::commit(); | 53 | DB::commit(); |
| 51 | }catch (\Exception $e){ | 54 | }catch (\Exception $e){ |
| 52 | DB::rollBack(); | 55 | DB::rollBack(); |
| 53 | - $this->fail('error'); | 56 | + $this->fail('系统错误,请联系管理员'); |
| 54 | } | 57 | } |
| 55 | return $this->success(); | 58 | return $this->success(); |
| 56 | } | 59 | } |
| @@ -32,6 +32,7 @@ class NavRequest extends FormRequest | @@ -32,6 +32,7 @@ class NavRequest extends FormRequest | ||
| 32 | public function rules() | 32 | public function rules() |
| 33 | { | 33 | { |
| 34 | $rule = [ | 34 | $rule = [ |
| 35 | + 'group_id' => ['required','integer'], | ||
| 35 | 'pid' => ['required','integer'], | 36 | 'pid' => ['required','integer'], |
| 36 | 'name' => ['required','max:100'], | 37 | 'name' => ['required','max:100'], |
| 37 | ]; | 38 | ]; |
| @@ -41,6 +42,8 @@ class NavRequest extends FormRequest | @@ -41,6 +42,8 @@ class NavRequest extends FormRequest | ||
| 41 | public function messages() | 42 | public function messages() |
| 42 | { | 43 | { |
| 43 | return [ | 44 | return [ |
| 45 | + 'group_id.required' => '未定义菜单组', | ||
| 46 | + 'group_id.integer' => '菜单组错误', | ||
| 44 | 'pid.required' => '上级选择错误', | 47 | 'pid.required' => '上级选择错误', |
| 45 | 'pid.gte' => '上级选择错误', | 48 | 'pid.gte' => '上级选择错误', |
| 46 | 'pid.integer' => '上级选择错误', | 49 | 'pid.integer' => '上级选择错误', |
app/Models/Nav/BNavGroup.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Nav; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | +use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class BNavGroup | ||
| 10 | + * @package App\Models\Nav | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2023/10/9 | ||
| 13 | + */ | ||
| 14 | +class BNavGroup extends Base | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + protected $table = 'gl_web_nav_group'; | ||
| 18 | + //连接数据库 | ||
| 19 | + protected $connection = 'custom_mysql'; | ||
| 20 | + use SoftDeletes; | ||
| 21 | + | ||
| 22 | + public $hidden = ['deleted_at']; | ||
| 23 | + | ||
| 24 | + const DEFAULT_HEADER_ID = 1; | ||
| 25 | + const DEFAULT_FOOTER_ID = 2; | ||
| 26 | + | ||
| 27 | +} |
app/Models/Template/BTemplateCommon.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :BTemplateCommon.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/10/13 11:45 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Template; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class BTemplateCommon extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_template_common'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | +} |
-
请 注册 或 登录 后发表评论