正在显示
19 个修改的文件
包含
186 行增加
和
73 行删除
| @@ -6,6 +6,9 @@ use App\Enums\Common\Code; | @@ -6,6 +6,9 @@ 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\Setting\ProjectCountryLogic; | 7 | use App\Http\Logic\Bside\Setting\ProjectCountryLogic; |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * @name:项目配置多语言设置 | ||
| 11 | + */ | ||
| 9 | class ProjectCountryController extends BaseController | 12 | class ProjectCountryController extends BaseController |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| @@ -6,6 +6,9 @@ use App\Enums\Common\Code; | @@ -6,6 +6,9 @@ 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\Setting\WebSettingLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingLogic; |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * @name:项目首页设置 | ||
| 11 | + */ | ||
| 9 | class WebSettingController extends BaseController | 12 | class WebSettingController extends BaseController |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| @@ -7,6 +7,9 @@ use App\Http\Controllers\Bside\BaseController; | @@ -7,6 +7,9 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 7 | use App\Http\Logic\Bside\Setting\WebSettingCountryLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingCountryLogic; |
| 8 | use App\Models\Project\Country as CountryModel; | 8 | use App\Models\Project\Country as CountryModel; |
| 9 | 9 | ||
| 10 | +/** | ||
| 11 | + * @name:多语言国家配置列 | ||
| 12 | + */ | ||
| 10 | class WebSettingCountryController extends BaseController | 13 | class WebSettingCountryController extends BaseController |
| 11 | { | 14 | { |
| 12 | /** | 15 | /** |
| @@ -6,6 +6,9 @@ use App\Enums\Common\Code; | @@ -6,6 +6,9 @@ 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\Setting\WebSettingFromLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingFromLogic; |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * @name:表单设置 | ||
| 11 | + */ | ||
| 9 | class WebSettingFromController extends BaseController | 12 | class WebSettingFromController extends BaseController |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| @@ -26,30 +29,7 @@ class WebSettingFromController extends BaseController | @@ -26,30 +29,7 @@ class WebSettingFromController extends BaseController | ||
| 26 | * @time :2023/4/28 14:41 | 29 | * @time :2023/4/28 14:41 |
| 27 | */ | 30 | */ |
| 28 | public function save(WebSettingFromLogic $webSettingFromLogic){ | 31 | public function save(WebSettingFromLogic $webSettingFromLogic){ |
| 29 | - if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 30 | - $this->request->validate([ | ||
| 31 | - 'id'=>'required' | ||
| 32 | - ],[ | ||
| 33 | - 'id.required' => 'ID不能为空' | ||
| 34 | - ]); | ||
| 35 | - } | ||
| 36 | $webSettingFromLogic->setting_from_save(); | 32 | $webSettingFromLogic->setting_from_save(); |
| 37 | $this->response('success'); | 33 | $this->response('success'); |
| 38 | } | 34 | } |
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * @name :(删除表单)del | ||
| 42 | - * @author :lyh | ||
| 43 | - * @method :post | ||
| 44 | - * @time :2023/5/4 13:38 | ||
| 45 | - */ | ||
| 46 | - public function del(WebSettingFromLogic $webSettingFromLogic){ | ||
| 47 | - $this->request->validate([ | ||
| 48 | - 'id'=>'required' | ||
| 49 | - ],[ | ||
| 50 | - 'id.required' => 'ID不能为空' | ||
| 51 | - ]); | ||
| 52 | - $webSettingFromLogic->setting_from_del(); | ||
| 53 | - $this->response('success'); | ||
| 54 | - } | ||
| 55 | } | 35 | } |
| @@ -6,6 +6,9 @@ use App\Enums\Common\Code; | @@ -6,6 +6,9 @@ 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\Setting\WebSettingHtmlLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingHtmlLogic; |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * @name:第三方代码设置 | ||
| 11 | + */ | ||
| 9 | class WebSettingHtmlController extends BaseController | 12 | class WebSettingHtmlController extends BaseController |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Bside\Setting; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Bside\BaseController; | ||
| 7 | +use App\Http\Logic\Bside\Setting\WebSettingReceivingLogic; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @name:项目收信设置 | ||
| 11 | + */ | ||
| 12 | +class WebSettingReceivingController extends BaseController | ||
| 13 | +{ | ||
| 14 | + /** | ||
| 15 | + * @name :(收信设置列表)lists | ||
| 16 | + * @author :lyh | ||
| 17 | + * @method :post | ||
| 18 | + * @time :2023/5/8 16:22 | ||
| 19 | + */ | ||
| 20 | + public function lists(WebSettingReceivingLogic $webSettingReceivingLogic){ | ||
| 21 | + $lists = $webSettingReceivingLogic->setting_receiving_lists(); | ||
| 22 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * @name :(更新)save | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2023/5/8 16:23 | ||
| 30 | + */ | ||
| 31 | + public function save(WebSettingReceivingLogic $webSettingReceivingLogic){ | ||
| 32 | + $lists = $webSettingReceivingLogic->setting_receiving_save(); | ||
| 33 | + $this->response('success'); | ||
| 34 | + } | ||
| 35 | +} |
| @@ -6,6 +6,9 @@ use App\Enums\Common\Code; | @@ -6,6 +6,9 @@ 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\Setting\WebSettingServiceLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingServiceLogic; |
| 8 | 8 | ||
| 9 | +/** | ||
| 10 | + * @name:客服设置 | ||
| 11 | + */ | ||
| 9 | class WebSettingServiceController extends BaseController | 12 | class WebSettingServiceController extends BaseController |
| 10 | { | 13 | { |
| 11 | /** | 14 | /** |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Http\Controllers\Bside\Setting; | 3 | namespace App\Http\Controllers\Bside\Setting; |
| 4 | 4 | ||
| 5 | +use App\Enums\Common\Code; | ||
| 5 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 6 | use App\Http\Logic\Bside\Setting\WebSettingTextLogic; | 7 | use App\Http\Logic\Bside\Setting\WebSettingTextLogic; |
| 7 | 8 |
| @@ -22,7 +22,7 @@ class WebSettingFromLogic extends BaseLogic | @@ -22,7 +22,7 @@ class WebSettingFromLogic extends BaseLogic | ||
| 22 | * @time :2023/5/4 13:43 | 22 | * @time :2023/5/4 13:43 |
| 23 | */ | 23 | */ |
| 24 | public function setting_from_info(){ | 24 | public function setting_from_info(){ |
| 25 | - $info = $this->model->read(['project_id'=>$this->user['project_id']]); | 25 | + $info = $this->model->list(['project_id'=>$this->user['project_id']],'created_at'); |
| 26 | if($info === false){ | 26 | if($info === false){ |
| 27 | $this->fail('当前数据不存在,或者已被删除'); | 27 | $this->fail('当前数据不存在,或者已被删除'); |
| 28 | } | 28 | } |
| @@ -39,10 +39,9 @@ class WebSettingFromLogic extends BaseLogic | @@ -39,10 +39,9 @@ class WebSettingFromLogic extends BaseLogic | ||
| 39 | public function setting_from_save(){ | 39 | public function setting_from_save(){ |
| 40 | try { | 40 | try { |
| 41 | //删除以前的数据 | 41 | //删除以前的数据 |
| 42 | - $param['project_id'] = ['in',$this->user['project_id']]; | ||
| 43 | - $this->model->del($param); | 42 | + $this->model->del(['project_id'=>$this->user['project_id']]); |
| 44 | //新增 | 43 | //新增 |
| 45 | - $this->model->add($this->param); | 44 | + $this->model->add($this->param['data']); |
| 46 | }catch (\Exception $e){ | 45 | }catch (\Exception $e){ |
| 47 | $this->fail('error'); | 46 | $this->fail('error'); |
| 48 | } | 47 | } |
| @@ -44,7 +44,6 @@ class WebSettingLogic extends BaseLogic | @@ -44,7 +44,6 @@ class WebSettingLogic extends BaseLogic | ||
| 44 | //查看数据是否存在 | 44 | //查看数据是否存在 |
| 45 | $info = $this->model->read(['project_id'=>$this->user['project_id']]); | 45 | $info = $this->model->read(['project_id'=>$this->user['project_id']]); |
| 46 | if($info === false){ | 46 | if($info === false){ |
| 47 | - $this->param['operator_id'] = $this->user['id']; | ||
| 48 | $this->param['project_id'] = $this->user['project_id']; | 47 | $this->param['project_id'] = $this->user['project_id']; |
| 49 | $rs = $this->model->add($this->param); | 48 | $rs = $this->model->add($this->param); |
| 50 | }else{ | 49 | }else{ |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\Setting; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\WebSetting\WebSettingReceiving; | ||
| 7 | +use App\Models\WebSetting\WebSettingText; | ||
| 8 | + | ||
| 9 | +class WebSettingReceivingLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + $this->model = new WebSettingReceiving(); | ||
| 15 | + $this->param = $this->requestAll; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @name :(列表数据)setting_receiving_lists | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/5/8 16:17 | ||
| 23 | + */ | ||
| 24 | + public function setting_receiving_lists(){ | ||
| 25 | + $lists = $this->model->list(['project_id'=>$this->user['project_id']]); | ||
| 26 | + return $this->success($lists); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @name :(设置收信账号)setting_receiving_save | ||
| 31 | + * @author :lyh | ||
| 32 | + * @method :post | ||
| 33 | + * @time :2023/5/8 16:26 | ||
| 34 | + */ | ||
| 35 | + public function setting_receiving_save(){ | ||
| 36 | + try { | ||
| 37 | + $this->model->del(['project_id'=>$this->user['project_id']]); | ||
| 38 | + foreach ($this->param['data'] as $k => $v){ | ||
| 39 | + $v['project_id'] = $this->user['project_id']; | ||
| 40 | + $this->param['data'][$k] = $v; | ||
| 41 | + } | ||
| 42 | + $this->model->add($this->param['data']); | ||
| 43 | + }catch (\Exception $e){ | ||
| 44 | + $this->fail('error'); | ||
| 45 | + } | ||
| 46 | + return $this->success(); | ||
| 47 | + } | ||
| 48 | +} |
| @@ -37,35 +37,15 @@ class WebSettingServiceLogic extends BaseLogic | @@ -37,35 +37,15 @@ class WebSettingServiceLogic extends BaseLogic | ||
| 37 | public function setting_service_save(){ | 37 | public function setting_service_save(){ |
| 38 | try { | 38 | try { |
| 39 | //删除以前的数据 | 39 | //删除以前的数据 |
| 40 | - $param['project_id'] = $this->user['project_id']; | ||
| 41 | - $this->model->del($param); | 40 | + $this->model->del(['project_id'=>$this->user['project_id']]); |
| 41 | + foreach ($this->param['data'] as $k => $v){ | ||
| 42 | + $v['project_id'] = $this->user['project_id']; | ||
| 43 | + $this->param['data'][$k] = $v; | ||
| 44 | + } | ||
| 42 | $this->model->add($this->param['data']); | 45 | $this->model->add($this->param['data']); |
| 43 | }catch (\Exception $e){ | 46 | }catch (\Exception $e){ |
| 44 | $this->fail('error'); | 47 | $this->fail('error'); |
| 45 | } | 48 | } |
| 46 | return $this->success(); | 49 | return $this->success(); |
| 47 | } | 50 | } |
| 48 | - | ||
| 49 | - | ||
| 50 | - /** | ||
| 51 | - * @name :(删除客服图片)setting_service_del | ||
| 52 | - * @author :lyh | ||
| 53 | - * @method :post | ||
| 54 | - * @time :2023/5/4 11:29 | ||
| 55 | - */ | ||
| 56 | - public function setting_service_del(){ | ||
| 57 | - DB::beginTransaction(); | ||
| 58 | - try { | ||
| 59 | - //获取当前图片资源 | ||
| 60 | - $image = new Image(); | ||
| 61 | - $info = $image->read(['hash'=>$this->param['hash']]); | ||
| 62 | - if($info !== false){ | ||
| 63 | - $image->del(['id'=>$info['id']]); | ||
| 64 | - } | ||
| 65 | - DB::commit(); | ||
| 66 | - }catch (\Exception $e){ | ||
| 67 | - DB::rollBack(); | ||
| 68 | - $this->fail('error'); | ||
| 69 | - } | ||
| 70 | - } | ||
| 71 | } | 51 | } |
| @@ -18,19 +18,29 @@ class WebSettingTextLogic extends BaseLogic | @@ -18,19 +18,29 @@ class WebSettingTextLogic extends BaseLogic | ||
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | + * @name :(查询设置详情)setting_read | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2023/5/8 15:56 | ||
| 25 | + */ | ||
| 26 | + public function setting_read(){ | ||
| 27 | + $web_setting = new WebSetting(); | ||
| 28 | + $setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting','anchor_is_enable','anchor_num']); | ||
| 29 | + return $setting_info; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + /** | ||
| 21 | * @name :(描文本详情)setting_text_lists | 33 | * @name :(描文本详情)setting_text_lists |
| 22 | * @author :lyh | 34 | * @author :lyh |
| 23 | * @method :post | 35 | * @method :post |
| 24 | * @time :2023/5/8 14:18 | 36 | * @time :2023/5/8 14:18 |
| 25 | */ | 37 | */ |
| 26 | public function setting_text_lists(){ | 38 | public function setting_text_lists(){ |
| 27 | - $lists = $this->model->list(['project_id'=>$this->user['project_id']],'created_at'); | ||
| 28 | - $web_setting = new WebSetting(); | ||
| 29 | - $setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting']); | ||
| 30 | - $lists['anchor_info'] = $setting_info; | ||
| 31 | - $anchor_text = config('setting.anchor_text'); | 39 | + $lists['data'] = $this->model->list(['project_id'=>$this->user['project_id']],'created_at',['key_words','url']); |
| 40 | + $lists['anchor_info'] = $this->setting_read(); | ||
| 41 | + $anchor_text = $this->model->anchor_text; | ||
| 32 | $lists['anchor_text'] = $anchor_text; | 42 | $lists['anchor_text'] = $anchor_text; |
| 33 | - $this->success($lists); | 43 | + return $this->success($lists); |
| 34 | } | 44 | } |
| 35 | 45 | ||
| 36 | /** | 46 | /** |
| @@ -40,12 +50,25 @@ class WebSettingTextLogic extends BaseLogic | @@ -40,12 +50,25 @@ class WebSettingTextLogic extends BaseLogic | ||
| 40 | * @time :2023/5/8 14:39 | 50 | * @time :2023/5/8 14:39 |
| 41 | */ | 51 | */ |
| 42 | public function setting_text_save(){ | 52 | public function setting_text_save(){ |
| 53 | + $web_setting = new WebSetting(); | ||
| 54 | + $setting_info = $this->setting_read(); | ||
| 55 | + if(count($this->param['data']) > $setting_info['anchor_num']){ | ||
| 56 | + $this->fail('超过最大设置限制'); | ||
| 57 | + } | ||
| 43 | DB::beginTransaction(); | 58 | DB::beginTransaction(); |
| 44 | try { | 59 | try { |
| 45 | //更新描文本设置 | 60 | //更新描文本设置 |
| 46 | - $web_setting = new WebSetting(); | ||
| 47 | - $web_setting->edit(['anchor_setting'=>$this->param['anchor_setting']],['project_id'=>$this->user['project_id']]); | 61 | + $data = [ |
| 62 | + 'anchor_setting'=>$this->param['anchor_setting'], | ||
| 63 | + 'anchor_is_enable'=>$this->param['anchor_is_enable'], | ||
| 64 | + 'anchor_num'=>$this->param['anchor_num'] | ||
| 65 | + ]; | ||
| 66 | + $web_setting->edit($data,['project_id'=>$this->user['project_id']]); | ||
| 48 | $this->model->del(['project_id'=>$this->user['project_id']]); | 67 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| 68 | + foreach ($this->param['data'] as $k => $v){ | ||
| 69 | + $v['project_id'] = $this->user['project_id']; | ||
| 70 | + $this->param['data'][$k] = $v; | ||
| 71 | + } | ||
| 49 | $this->model->add($this->param['data']); | 72 | $this->model->add($this->param['data']); |
| 50 | DB::commit(); | 73 | DB::commit(); |
| 51 | }catch (\Exception $e){ | 74 | }catch (\Exception $e){ |
| @@ -112,6 +112,17 @@ class Base extends Model | @@ -112,6 +112,17 @@ class Base extends Model | ||
| 112 | $info = $info->toArray(); | 112 | $info = $info->toArray(); |
| 113 | return $info; | 113 | return $info; |
| 114 | } | 114 | } |
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * @name :(获取数据条数)count | ||
| 118 | + * @author :lyh | ||
| 119 | + * @method :post | ||
| 120 | + * @time :2023/5/8 15:51 | ||
| 121 | + */ | ||
| 122 | + public function get_count($condition){ | ||
| 123 | + $query = $this->formatQuery($condition); | ||
| 124 | + $query->count(); | ||
| 125 | + } | ||
| 115 | /** | 126 | /** |
| 116 | * @name :新增 | 127 | * @name :新增 |
| 117 | * @return void | 128 | * @return void |
| @@ -7,4 +7,21 @@ use App\Models\Base; | @@ -7,4 +7,21 @@ use App\Models\Base; | ||
| 7 | class WebSettingText extends Base | 7 | class WebSettingText extends Base |
| 8 | { | 8 | { |
| 9 | protected $table = 'gl_web_setting_text'; | 9 | protected $table = 'gl_web_setting_text'; |
| 10 | + | ||
| 11 | + //定义常量参数 | ||
| 12 | + const TYPE_PAGE = 1; | ||
| 13 | + const TYPE_PRODUCT = 2; | ||
| 14 | + const TYPE_KEYWORD = 3; | ||
| 15 | + const TYPE_NEWS = 4; | ||
| 16 | + const TYPE_BLOG = 6; | ||
| 17 | + /** | ||
| 18 | + * @var :描文本设置 | ||
| 19 | + */ | ||
| 20 | + public $anchor_text = [ | ||
| 21 | + self::TYPE_PAGE => '单页面', | ||
| 22 | + self::TYPE_PRODUCT=>'产品页', | ||
| 23 | + self::TYPE_KEYWORD=>'关键词页', | ||
| 24 | + self::TYPE_NEWS=>'新闻页', | ||
| 25 | + self::TYPE_BLOG=>'博客页', | ||
| 26 | + ]; | ||
| 10 | } | 27 | } |
| @@ -136,6 +136,11 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -136,6 +136,11 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 136 | Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'lists'])->name('web_setting_text_lists'); | 136 | Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'lists'])->name('web_setting_text_lists'); |
| 137 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'save'])->name('web_setting_text_save'); | 137 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'save'])->name('web_setting_text_save'); |
| 138 | }); | 138 | }); |
| 139 | + //收信设置 | ||
| 140 | + Route::prefix('receiving')->group(function () { | ||
| 141 | + Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'lists'])->name('web_setting_receiving_lists'); | ||
| 142 | + Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'save'])->name('web_setting_receiving_save'); | ||
| 143 | + }); | ||
| 139 | 144 | ||
| 140 | }); | 145 | }); |
| 141 | //产品 | 146 | //产品 |
-
请 注册 或 登录 后发表评论