作者 lyh

gx

  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :AggregationSettingController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/10/23 11:06
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Setting;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\WebSetting\AggregationSetting;
  15 +
  16 +/**
  17 + * @remark :聚合页
  18 + * @name :AggregationSettingController
  19 + * @author :lyh
  20 + * @method :post
  21 + * @time :2023/10/23 11:06
  22 + */
  23 +class AggregationSettingController extends BaseController
  24 +{
  25 + /**
  26 + * @remark :获取聚合页设置详情
  27 + * @name :info
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2023/10/23 11:08
  31 + */
  32 + public function info(){
  33 + $aggSettingModel = new AggregationSetting();
  34 + $info = $aggSettingModel->read(['project_id'=>$this->user['project_id']]);
  35 + if($info === false){
  36 + $data = [
  37 + 'title'=>'',
  38 + 'content'=>'',
  39 + 'top_banner'=>json_encode([]),
  40 + 'foot_banner'=>json_encode([]),
  41 + 'project_id'=>$this->user['project_id']
  42 + ];
  43 + $aggSettingModel->add($data);
  44 + }
  45 + $info['top_banner'] = json_decode($info['top_banner']);
  46 + $info['foot_banner'] = json_decode($info['foot_banner']);
  47 + $this->response('success',Code::SUCCESS,$info);
  48 + }
  49 +
  50 + /**
  51 + * @remark :修改聚合页设置
  52 + * @name :edit
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2023/10/23 11:11
  56 + */
  57 + public function edit(){
  58 + $aggSettingModel = new AggregationSetting();
  59 + $this->param['top_banner'] = json_encode($this->param['top_banner']);
  60 + $this->param['foot_banner'] = json_encode($this->param['foot_banner']);
  61 + $rs = $aggSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
  62 + if($rs === false){
  63 + $this->response('系统错误请联系管理员',Code::SYSTEM_ERROR);
  64 + }
  65 + $this->response('success');
  66 + }
  67 +}
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2023/10/23 10:45 7 * @time :2023/10/23 10:45
8 */ 8 */
9 9
10 -namespace App\Models\Product; 10 +namespace App\Models\WebSetting;
11 11
12 use App\Models\Base; 12 use App\Models\Base;
13 13
@@ -31,6 +31,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -31,6 +31,11 @@ Route::middleware(['bloginauth'])->group(function () {
31 Route::any('/info', [\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'info'])->name('pageSetting_info'); 31 Route::any('/info', [\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'info'])->name('pageSetting_info');
32 Route::any('/edit',[\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'edit'])->name('pageSetting_edit'); 32 Route::any('/edit',[\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'edit'])->name('pageSetting_edit');
33 }); 33 });
  34 + //聚合页相关配置
  35 + Route::prefix('aggregation')->group(function () {
  36 + Route::any('/info', [\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'info'])->name('aggregation_info');
  37 + Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit');
  38 + });
34 //站内信 39 //站内信
35 Route::prefix('mail')->group(function () { 40 Route::prefix('mail')->group(function () {
36 Route::any('/', [\App\Http\Controllers\Bside\Mail\MailController::class, 'lists'])->name('mail_lists'); 41 Route::any('/', [\App\Http\Controllers\Bside\Mail\MailController::class, 'lists'])->name('mail_lists');