正在显示
3 个修改的文件
包含
77 行增加
和
0 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :WebSettingImageController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/21 15:12 | ||
| 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\WebSettingImage; | ||
| 15 | + | ||
| 16 | +class WebSettingImageController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :网站背景图片列表 | ||
| 20 | + * @name :lists | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/9/21 15:12 | ||
| 24 | + */ | ||
| 25 | + public function lists(WebSettingImage $webSettingImage){ | ||
| 26 | + $list = $webSettingImage->list(); | ||
| 27 | + $this->response('success',Code::SUCCESS,$list); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @remark :保存数据 | ||
| 32 | + * @name :save | ||
| 33 | + * @author :lyh | ||
| 34 | + * @method :post | ||
| 35 | + * @time :2023/9/21 15:17 | ||
| 36 | + */ | ||
| 37 | + public function save(WebSettingImage $webSettingImage){ | ||
| 38 | + foreach ($this->param['data'] as $v){ | ||
| 39 | + if(isset($v['id']) && !empty($v['id'])){ | ||
| 40 | + $rs = $webSettingImage->edit($v,['id'=>$v['id']]); | ||
| 41 | + }else{ | ||
| 42 | + $v['project_id'] = $this->user['project_id']; | ||
| 43 | + $rs = $webSettingImage->add($v); | ||
| 44 | + } | ||
| 45 | + if($rs === false){ | ||
| 46 | + $this->response('系统错误请联系管理员'); | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + $this->response('success'); | ||
| 50 | + } | ||
| 51 | +} |
app/Models/WebSetting/WebSettingImage.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :WebSettingImage.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/21 15:13 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\WebSetting; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class WebSettingImage extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_web_setting_image'; | ||
| 17 | + | ||
| 18 | + //连接数据库 | ||
| 19 | + protected $connection = 'custom_mysql'; | ||
| 20 | +} |
| @@ -168,6 +168,12 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -168,6 +168,12 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 168 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'save'])->name('web_seo_save'); | 168 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'save'])->name('web_seo_save'); |
| 169 | }); | 169 | }); |
| 170 | 170 | ||
| 171 | + //其他设置 | ||
| 172 | + Route::prefix('image')->group(function () { | ||
| 173 | + Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingImageController::class, 'lists'])->name('web_image_list'); | ||
| 174 | + Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingImageController::class, 'save'])->name('web_image_save'); | ||
| 175 | + }); | ||
| 176 | + | ||
| 171 | }); | 177 | }); |
| 172 | //产品 | 178 | //产品 |
| 173 | Route::prefix('product')->group(function () { | 179 | Route::prefix('product')->group(function () { |
-
请 注册 或 登录 后发表评论