Sfoglia il codice sorgente

Weenier utc项目部署 06231

wesmiler 3 anni fa
parent
commit
baca5b02a1

+ 36 - 0
app/Http/Controllers/Admin/CityController.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Http\Controllers\Admin;
+
+use App\Services\Common\CityService;
+
+/**
+ * 城市管理-控制器
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class CityController
+ * @package App\Http\Controllers
+ */
+class CityController extends Backend
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * CityController constructor.
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->service = new CityService();
+    }
+}

+ 0 - 165
app/Http/Controllers/Backend.php

@@ -1,165 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Http\Controllers;
-
-use App\Helpers\Jwt;
-use App\Models\UserModel;
-use Illuminate\Support\Facades\Session;
-
-/**
- * 后台控制器基类
- * @author laravel开发员
- * @since 2020/11/10
- * Class Backend
- * @package App\Http\Controllers
- */
-class Backend extends BaseController
-{
-    // 模型
-    protected $model;
-    // 服务
-    protected $service;
-    // 校验
-    protected $validate;
-    // 登录ID
-    protected $userId;
-    // 登录信息
-    protected $userInfo;
-
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/10
-     * Backend constructor.
-     */
-    public function __construct()
-    {
-        parent::__construct();
-        // 初始化配置
-        $this->initConfig();
-
-        // 登录检测中间件
-        $this->middleware('user.login');
-
-        // 初始化登录信息
-        $this->middleware(function ($request, $next) {
-            // 请求头信息
-            $token = $request->headers->get('Authorization');
-            $token = str_replace("Bearer ", null, $token);
-            // JWT解密token
-            $jwt = new Jwt();
-            $userId = $jwt->verifyToken($token);
-
-            // 登录验证
-            $this->initLogin($userId);
-
-            return $next($request);
-        });
-    }
-
-    /**
-     * 初始化配置
-     * @author laravel开发员
-     * @since 2020/11/10
-     */
-    public function initConfig()
-    {
-        // 请求参数
-        $this->param = \request()->input();
-
-        // 分页基础默认值
-        defined('PERPAGE') or define('PERPAGE', isset($this->param['limit']) ? $this->param['limit'] : 20);
-        defined('PAGE') or define('PAGE', isset($this->param['page']) ? $this->param['page'] : 1);
-    }
-
-    /**
-     * 登录验证
-     * @param $userId 用户ID
-     * @return
-     * @author laravel开发员
-     * @since 2020/8/31
-     */
-    public function initLogin($userId)
-    {
-        // 登录用户ID
-        $this->userId = $userId;
-
-        // 登录用户信息
-        if ($userId) {
-            $adminModel = new UserModel();
-            $userInfo = $adminModel->getInfo($this->userId);
-            $this->userInfo = $userInfo;
-        }
-
-    }
-
-    /**
-     * 获取数据列表
-     * @return mixed
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function index()
-    {
-        $result = $this->service->getList();
-        return $result;
-    }
-
-    /**
-     * 获取数据详情
-     * @return mixed
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function info()
-    {
-        $result = $this->service->info();
-        return $result;
-    }
-
-    /**
-     * 添加或编辑
-     * @return mixed
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function edit()
-    {
-        $result = $this->service->edit();
-        return $result;
-    }
-
-    /**
-     * 删除数据
-     * @return mixed
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function delete()
-    {
-        $result = $this->service->delete();
-        return $result;
-    }
-
-    /**
-     * 设置状态
-     * @return mixed
-     * @since 2020/11/21
-     * @author laravel开发员
-     */
-    public function status()
-    {
-        $result = $this->service->status();
-        return $result;
-    }
-
-}

+ 0 - 71
app/Services/CityService.php

@@ -1,71 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
-// +----------------------------------------------------------------------
-// | 版权所有 2017~2021 LARAVEL研发中心
-// +----------------------------------------------------------------------
-// | 官方网站: http://www.laravel.cn
-// +----------------------------------------------------------------------
-// | Author: laravel开发员 <laravel.qq.com>
-// +----------------------------------------------------------------------
-
-namespace App\Services;
-
-use App\Models\CityModel;
-
-/**
- * 城市管理-服务类
- * @author laravel开发员
- * @since 2020/11/11
- * Class CityService
- * @package App\Services
- */
-class CityService extends BaseService
-{
-    /**
-     * 构造函数
-     * @author laravel开发员
-     * @since 2020/11/11
-     * CityService constructor.
-     */
-    public function __construct()
-    {
-        $this->model = new CityModel();
-    }
-
-    /**
-     * 获取城市列表
-     * @return array
-     * @since 2020/11/11
-     * @author laravel开发员
-     */
-    public function getList()
-    {
-        $param = request()->all();
-
-        // 查询条件
-        $map = [];
-        // 上级ID
-        $pid = intval(getter($param, 'pid', 0));
-        if (!$pid) {
-            $map[] = ['pid', '=', 0];
-        } else {
-            $map[] = ['pid', '=', $pid];
-        }
-        // 城市名称
-        $name = getter($param, "name");
-        if ($name) {
-            $map[] = ['name', 'like', "%{$name}%"];
-        }
-        $list = $this->model->getList($map, [['sort', 'asc']]);
-        if (!empty($list)) {
-            foreach ($list as &$val) {
-                if ($val['level'] <= 2) {
-                    $val['hasChildren'] = true;
-                }
-            }
-        }
-        return message("操作成功", true, $list);
-    }
-
-}

+ 36 - 0
app/Services/Common/ConfigGroupService.php

@@ -0,0 +1,36 @@
+<?php
+// +----------------------------------------------------------------------
+// | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
+// +----------------------------------------------------------------------
+// | 版权所有 2017~2021 LARAVEL研发中心
+// +----------------------------------------------------------------------
+// | 官方网站: http://www.laravel.cn
+// +----------------------------------------------------------------------
+// | Author: laravel开发员 <laravel.qq.com>
+// +----------------------------------------------------------------------
+
+namespace App\Services\Common;
+
+use App\Models\ConfigGroupModel;
+use App\Services\BaseService;
+
+/**
+ * 配置分组-服务类
+ * @author laravel开发员
+ * @since 2020/11/11
+ * Class ConfigGroupService
+ * @package App\Services\Common
+ */
+class ConfigGroupService extends BaseService
+{
+    /**
+     * 构造函数
+     * @author laravel开发员
+     * @since 2020/11/11
+     * ConfigGroupService constructor.
+     */
+    public function __construct()
+    {
+        $this->model = new ConfigGroupModel();
+    }
+}