| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Services\Common;
- use App\Models\ConfigModel;
- use App\Services\BaseService;
- /**
- * 配置管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * Class ConfigService
- * @package App\Services\Common
- */
- class ConfigService extends BaseService
- {
- /**
- * 构造函数
- * @author laravel开发员
- * @since 2020/11/11
- * ConfigService constructor.
- */
- public function __construct()
- {
- $this->model = new ConfigModel();
- }
- /**
- * 获取配置列表
- * @return array
- * @since 2020/11/11
- * @author laravel开发员
- */
- public function getList()
- {
- $param = request()->all();
- // 查询条件
- $map = [];
- // 配置分组ID
- $configgroupId = getter($param, "configgroupId", 0);
- if ($configgroupId) {
- $map[] = ['config_group_id', '=', $configgroupId];
- }
- // 配置标题
- $title = getter($param, "title");
- if ($title) {
- $map[] = ['name', 'title', "%{$title}%"];
- }
- $list = $this->model->getList($map, [['sort', 'asc']]);
- return message("操作成功", true, $list);
- }
- /**
- * 编辑
- * @return array
- */
- public function edit()
- {
- $data = request()->all();
- $type = isset($data['type'])? $data['type'] : '';
- if($type == 'image'){
- if (strpos($data['value'], "temp")) {
- $data['value'] = save_image($data['value'], 'images');
- } else {
- $data['value'] = str_replace(IMG_URL, "", $data['value']);
- }
- }
- return parent::edit($data);
- }
- }
|