作者 lyh

gx

@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Controllers\Bside\Setting; 10 namespace App\Http\Controllers\Bside\Setting;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
  13 +use App\Helper\Arr;
13 use App\Http\Controllers\Bside\BaseController; 14 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\WebSetting\AggregationSetting; 15 use App\Models\WebSetting\AggregationSetting;
15 16
@@ -42,8 +43,6 @@ class AggregationSettingController extends BaseController @@ -42,8 +43,6 @@ class AggregationSettingController extends BaseController
42 ]; 43 ];
43 $aggSettingModel->add($data); 44 $aggSettingModel->add($data);
44 } 45 }
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); 46 $this->response('success',Code::SUCCESS,$info);
48 } 47 }
49 48
@@ -56,8 +55,12 @@ class AggregationSettingController extends BaseController @@ -56,8 +55,12 @@ class AggregationSettingController extends BaseController
56 */ 55 */
57 public function edit(){ 56 public function edit(){
58 $aggSettingModel = new AggregationSetting(); 57 $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']); 58 + if(isset($this->param['top_banner']) && !empty($this->param['top_banner'])){
  59 + $this->param['top_banner'] = Arr::a2s($this->param['top_banner']);
  60 + }
  61 + if(isset($this->param['foot_banner']) && !empty($this->param['foot_banner'])){
  62 + $this->param['foot_banner'] = Arr::a2s($this->param['foot_banner']);
  63 + }
61 $rs = $aggSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]); 64 $rs = $aggSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
62 if($rs === false){ 65 if($rs === false){
63 $this->response('系统错误请联系管理员',Code::SYSTEM_ERROR); 66 $this->response('系统错误请联系管理员',Code::SYSTEM_ERROR);
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Models\WebSetting; 10 namespace App\Models\WebSetting;
11 11
  12 +use App\Helper\Arr;
12 use App\Models\Base; 13 use App\Models\Base;
13 14
14 /** 15 /**
@@ -22,4 +23,40 @@ class AggregationSetting extends Base @@ -22,4 +23,40 @@ class AggregationSetting extends Base
22 { 23 {
23 //设置关联表名 24 //设置关联表名
24 protected $table = 'gl_product_attr'; 25 protected $table = 'gl_product_attr';
  26 +
  27 + /**
  28 + * @remark :顶部banner获取器
  29 + * @name :getGalleryAttribute
  30 + * @author :lyh
  31 + * @method :post
  32 + * @time :2023/7/21 11:11
  33 + */
  34 + public function getTopBannerAttribute($value){
  35 + if(!empty($value)){
  36 + $value = Arr::s2a($value);
  37 + foreach ($value as $k => $v){
  38 + $v = getImageUrl($v);
  39 + $value[$k] = $v;
  40 + }
  41 + }
  42 + return $value;
  43 + }
  44 +
  45 + /**
  46 + * @remark :底部banner获取器
  47 + * @name :getGalleryAttribute
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/7/21 11:11
  51 + */
  52 + public function getFootBannerAttribute($value){
  53 + if(!empty($value)){
  54 + $value = Arr::s2a($value);
  55 + foreach ($value as $k => $v){
  56 + $v = getImageUrl($v);
  57 + $value[$k] = $v;
  58 + }
  59 + }
  60 + return $value;
  61 + }
25 } 62 }