作者 lyh

gx

<?php
/**
* @remark :
* @name :AggregationSettingController.php
* @author :lyh
* @method :post
* @time :2023/10/23 11:06
*/
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\WebSetting\AggregationSetting;
/**
* @remark :聚合页
* @name :AggregationSettingController
* @author :lyh
* @method :post
* @time :2023/10/23 11:06
*/
class AggregationSettingController extends BaseController
{
/**
* @remark :获取聚合页设置详情
* @name :info
* @author :lyh
* @method :post
* @time :2023/10/23 11:08
*/
public function info(){
$aggSettingModel = new AggregationSetting();
$info = $aggSettingModel->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$data = [
'title'=>'',
'content'=>'',
'top_banner'=>json_encode([]),
'foot_banner'=>json_encode([]),
'project_id'=>$this->user['project_id']
];
$aggSettingModel->add($data);
}
$info['top_banner'] = json_decode($info['top_banner']);
$info['foot_banner'] = json_decode($info['foot_banner']);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :修改聚合页设置
* @name :edit
* @author :lyh
* @method :post
* @time :2023/10/23 11:11
*/
public function edit(){
$aggSettingModel = new AggregationSetting();
$this->param['top_banner'] = json_encode($this->param['top_banner']);
$this->param['foot_banner'] = json_encode($this->param['foot_banner']);
$rs = $aggSettingModel->edit($this->param,['project_id'=>$this->user['project_id']]);
if($rs === false){
$this->response('系统错误请联系管理员',Code::SYSTEM_ERROR);
}
$this->response('success');
}
}
... ...
... ... @@ -7,7 +7,7 @@
* @time :2023/10/23 10:45
*/
namespace App\Models\Product;
namespace App\Models\WebSetting;
use App\Models\Base;
... ...
... ... @@ -31,6 +31,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'info'])->name('pageSetting_info');
Route::any('/edit',[\App\Http\Controllers\Bside\BCom\PageSettingController::class, 'edit'])->name('pageSetting_edit');
});
//聚合页相关配置
Route::prefix('aggregation')->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'info'])->name('aggregation_info');
Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit');
});
//站内信
Route::prefix('mail')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Mail\MailController::class, 'lists'])->name('mail_lists');
... ...