Quellcode durchsuchen

Merge branch 'dev_wf' of wufeng/fuse into version1.5

wufeng vor 2 Jahren
Ursprung
Commit
d3e7ed03db

+ 10 - 2
app/admin/config/validate_rules.php

@@ -13,7 +13,7 @@ return [
     ],
 
     //【启禁用】
-    'status'=>[
+    'status' => [
         'id' => 'require|number|gt:0',
         'status|状态' => 'require|number|in:' . CommonModel::$status_normal . ',' . CommonModel::$status_disable,
     ],
@@ -67,7 +67,7 @@ return [
         'weight|权重' => 'number|egt:0',
         'remark|备注' => 'max:255',
     ],
-    //添加视频
+    //编辑视频
     'videoEdit' => [
         'id' => 'require|number|gt:0',
         'video_name|视频名称' => 'require|max:255',
@@ -89,5 +89,13 @@ return [
         'title|卡类型' => 'require|max:255'
     ],
 
+    //【企业】
+    //添加
+    'CompanyAdd' => [
+        'title|企业名称' => 'require|max:255',
+        'contacts|联系人' => 'require|max:255',
+        'mobile|联系方式' => 'require|mobile',
+        'remark|备注' => 'max:255',
+    ],
 
 ];

+ 12 - 12
app/admin/controller/Card.php

@@ -12,7 +12,7 @@ class Card extends BaseController
 {
 
 //获取卡类型列表
-    public function cardList()
+    public function List()
     {
         $param = $this->request->only(['page' => 1, 'size' => 10, 'status' => '', 'title' => '',], 'post');
 
@@ -20,11 +20,11 @@ class Card extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return CardLogic::cardList($param);
+        return CardLogic::List($param);
     }
 
 //添加卡类型
-    public function cardAdd()
+    public function Add()
     {
         $param = $this->request->only(['title'], 'post');
 
@@ -32,19 +32,19 @@ class Card extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return CardLogic::cardAdd($param);
+        return CardLogic::Add($param);
 
     }
 
 //获取卡类型详情
-    public function cardRead()
+    public function Read()
     {
         $id = $this->request->post('id/d',0);
-        return CardLogic::cardRead($id);
+        return CardLogic::Read($id);
     }
 
 //编辑卡类型
-    public function cardEdit()
+    public function Edit()
     {
         $param = $this->request->only(['id','title'], 'post');
 
@@ -52,11 +52,11 @@ class Card extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return CardLogic::cardEdit($param);
+        return CardLogic::Edit($param);
     }
 
 //卡类型启禁用
-    public function cardChange()
+    public function Change()
     {
         $param = $this->request->only(['id','status'], 'post');
 
@@ -64,14 +64,14 @@ class Card extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return CardLogic::cardChange($param);
+        return CardLogic::Change($param);
     }
 
 //删除卡类型
-    public function cardDelete()
+    public function Delete()
     {
         $id = $this->request->post('id/d',0);
-        return CardLogic::cardDelete($id);
+        return CardLogic::Delete($id);
     }
 
 }

+ 78 - 0
app/admin/controller/Company.php

@@ -0,0 +1,78 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\admin\logic\CompanyLogic;
+use app\BaseController;
+use think\exception\ValidateException;
+use think\facade\Config;
+use think\facade\Validate;
+
+//企业
+class Company extends BaseController
+{
+
+    //获取企业列表
+    public function List()
+    {
+        $param = $this->request->only([
+            'page' => 1,
+            'size' => 10,
+            'title' => '',
+            'contacts' => '',
+            'mobile' => '',
+            'status' => '',
+        ], 'post');
+
+        return CompanyLogic::List($param);
+    }
+
+    //添加企业
+    public function Add()
+    {
+        $param = $this->request->only(['title', 'contacts', 'mobile', 'remark' => '',], 'post');
+
+        $val = Validate::rule(Config::get('validate_rules.CompanyAdd'));
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+
+        return CompanyLogic::Add($param);
+    }
+
+    //读取企业详情
+    public function Read()
+    {
+        $id = $this->request->post('id/d', 0);
+        return CompanyLogic::Read($id);
+    }
+
+    //编辑企业
+    public function Edit()
+    {
+        $param = $this->request->only(['id', 'title', 'contacts', 'mobile', 'remark' => '',], 'post');
+
+        $val = Validate::rule(array_merge(Config::get('validate_rules.CompanyAdd'), ['id' => 'require|number|gt:0']));
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+        return CompanyLogic::Edit($param);
+    }
+
+    //企业启禁用
+    public function Change()
+    {
+        $param = $this->request->only(['id', 'status'], 'post');
+
+        $val = Validate::rule(Config::get('validate_rules.status'));
+
+        if (!$val->check($param)) throw new ValidateException($val->getError());
+        return CompanyLogic::Change($param);
+    }
+
+    //删除企业
+    public function Delete()
+    {
+        $id = $this->request->post('id/d', 0);
+        return CompanyLogic::Delete($id);
+    }
+
+}

+ 10 - 10
app/admin/controller/Menu.php

@@ -14,13 +14,13 @@ class Menu extends BaseController
 {
 
     //获取菜单列表
-    public function menuList()
+    public function List()
     {
-        return MenuLogic::menuList();
+        return MenuLogic::List();
     }
 
     //添加菜单
-    public function menuAdd()
+    public function Add()
     {
         $param = $this->request->only([
             'menu_name',
@@ -37,11 +37,11 @@ class Menu extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return MenuLogic::menuAdd($param);
+        return MenuLogic::Add($param);
     }
 
     //编辑菜单
-    public function menuEdit()
+    public function Edit()
     {
 
         $param = $this->request->only([
@@ -61,19 +61,19 @@ class Menu extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return MenuLogic::menuEdit($param);
+        return MenuLogic::Edit($param);
     }
 
     //删除菜单
-    public function menuDel()
+    public function Delete()
     {
         $id = $this->request->post('id/d', 0);
 
-        return MenuLogic::menuDel($id);
+        return MenuLogic::Delete($id);
     }
 
     //启禁用菜单
-    public function menuStatus()
+    public function Status()
     {
         $param = $this->request->only(['id', 'status'], 'post');
 
@@ -81,6 +81,6 @@ class Menu extends BaseController
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
 
-        return MenuLogic::menuStatus($param);
+        return MenuLogic::Status($param);
     }
 }

+ 12 - 13
app/admin/controller/Video.php

@@ -13,7 +13,7 @@ class Video extends BaseController
 {
 
     //获取视频列表
-    public function videoList()
+    public function List()
     {
         $param = $this->request->only([
             'page' => 1,
@@ -24,11 +24,11 @@ class Video extends BaseController
             'video_url' => '',
         ], 'post');
 
-        return VideoLogic::videoList($param);
+        return VideoLogic::List($param);
     }
 
     //添加视频
-    public function videoAdd()
+    public function Add()
     {
 
         $param = $this->request->only([
@@ -42,18 +42,18 @@ class Video extends BaseController
         $val = Validate::rule(Config::get('validate_rules.videoAdd'));
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
-        return VideoLogic::videoAdd($param);
+        return VideoLogic::Add($param);
     }
 
     //读取视频详情
-    public function videoRead()
+    public function Read()
     {
         $id = $this->request->post('id/d', 0);
-        return VideoLogic::videoRead($id);
+        return VideoLogic::Read($id);
     }
 
     //编辑视频
-    public function videoEdit()
+    public function Edit()
     {
         $param = $this->request->only([
             'id',
@@ -67,26 +67,25 @@ class Video extends BaseController
         $val = Validate::rule(Config::get('validate_rules.videoEdit'));
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
-        return VideoLogic::videoEdit($param);
+        return VideoLogic::Edit($param);
     }
 
     //视频启禁用
-    public function videoChange()
+    public function Change()
     {
         $param = $this->request->only(['id', 'status',], 'post');
 
         $val = Validate::rule(Config::get('validate_rules.status'));
 
         if (!$val->check($param)) throw new ValidateException($val->getError());
-        return VideoLogic::videoChange($param);
+        return VideoLogic::Change($param);
     }
 
     //删除视频
-    public function videoDelete()
+    public function Delete()
     {
-        halt($this->request->uid,$this->request->uname,$this->request->roleid);
         $id = $this->request->post('id/d', 0);
-        return VideoLogic::videoDelete($id);
+        return VideoLogic::Delete($id);
     }
 
 }

+ 6 - 6
app/admin/logic/CardLogic.php

@@ -10,7 +10,7 @@ use think\response\Json;
 class CardLogic extends BaseLogic
 {
     //获取卡类型列表
-    public static function cardList(array $data = []): Json
+    public static function List(array $data = []): Json
     {
         $db = CardModel::where('is_del', CommonModel::$del_normal);
         if ($data['title'] != '') $db->whereLike('title', '%' . $data['title'] . '%');
@@ -29,7 +29,7 @@ class CardLogic extends BaseLogic
     }
 
     //添加卡类型
-    public static function cardAdd(array $data = []): Json
+    public static function Add(array $data = []): Json
     {
         $rs = CardModel::field('id')
             ->where(['is_del' => CommonModel::$del_normal, 'title' => $data['title']])
@@ -52,7 +52,7 @@ class CardLogic extends BaseLogic
     }
 
     //获取卡类型详情
-    public static function cardRead(int $id = 0): Json
+    public static function Read(int $id = 0): Json
     {
         $rs = CardModel::field(true)
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
@@ -62,7 +62,7 @@ class CardLogic extends BaseLogic
     }
 
     //编辑卡类型
-    public static function cardEdit(array $data = []): Json
+    public static function Edit(array $data = []): Json
     {
         $rs = CardModel::field('id,title')
             ->where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
@@ -91,7 +91,7 @@ class CardLogic extends BaseLogic
     }
 
     //卡类型启禁用
-    public static function cardChange(array $data = []): Json
+    public static function Change(array $data = []): Json
     {
         $where = [
             ['id', '=', $data['id']],
@@ -111,7 +111,7 @@ class CardLogic extends BaseLogic
     }
 
     //删除卡类型
-    public static function cardDelete(int $id = 0): Json
+    public static function Delete(int $id = 0): Json
     {
         $rs = CardModel::where(['id' => $id, 'is_del' => CommonModel::$del_normal])
             ->save(['is_del' => CommonModel::$del_deleted, 'updatetime' => date('Y-m-d H:i:s')]);

+ 136 - 0
app/admin/logic/CompanyLogic.php

@@ -0,0 +1,136 @@
+<?php
+
+namespace app\admin\logic;
+
+use app\model\CommonModel;
+use app\model\CompanyModel;
+use think\exception\ValidateException;
+use think\response\Json;
+
+class CompanyLogic extends BaseLogic
+{
+    //获取企业列表
+    public static function List(array $data = []): Json
+    {
+        $db = CompanyModel::where('is_del', CommonModel::$del_normal);
+        if ($data['status'] != '') $db->where('status', $data['status']);
+        if ($data['title']) $db->whereLike('title', '%' . $data['title'] . '%');
+        if ($data['contacts'] !== '') $db->whereLike('contacts', '%' . $data['contacts'] . '%');
+        if ($data['mobile'] != '') $db->whereLike('mobile', '%' . $data['mobile'] . '%');
+
+        $count = $db->count('id');
+
+        $list = $db
+            ->field('id,title,contacts,mobile,remark,status,addtime')
+            ->page($data['page'], $data['size'])
+            ->order(['addtime'=>'desc','id'=>'desc'])
+            ->select()
+            ->toArray();
+
+        return json_show(CommonModel::$success, '获取成功', ['list' => $list, 'count' => $count]);
+    }
+
+    //添加企业
+    public static function Add(array $data = []): Json
+    {
+        $rs = CompanyModel::field('id')
+            ->where(['is_del' => CommonModel::$del_normal, 'title' => $data['title']])
+            ->findOrEmpty()
+            ->isEmpty();
+
+        if (!$rs) throw new ValidateException('该企业名称已存在');
+
+        $data = array_merge($data, [
+            'is_del' => CommonModel::$del_normal,
+            'status' => CommonModel::$status_normal,
+            'createrid' => self::$uid,
+            'creater' => self::$uname,
+            'addtime' => date('Y-m-d H:i:s'),
+            'updaterid' => self::$uid,
+            'updater' => self::$uname,
+            'updatetime' => date('Y-m-d H:i:s'),
+        ]);
+
+        $res = CompanyModel::create($data)->save();
+
+        return $res ? json_show(CommonModel::$success, '企业新建成功') : json_show(CommonModel::$error_param, '企业新建失败');
+    }
+
+    //读取企业详情
+    public static function Read(int $id = 0): Json
+    {
+        $rs = CompanyModel::field(true)
+            ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty()
+            ->toArray();
+        return json_show(CommonModel::$success, '获取企业详情成功', $rs);
+    }
+
+    //编辑企业
+    public static function Edit(array $data = []): Json
+    {
+        $rs = CompanyModel::field('id,title')
+            ->where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
+            ->findOrEmpty();
+
+        if ($rs->isEmpty()) throw new ValidateException('该企业不存在');
+
+        //修改了企业名称,检查企业名称是否重复
+        if ($rs->title != $data['title']) {
+            $temp = CompanyModel::field('id')
+                ->where(['is_del' => CommonModel::$del_normal, 'title' => $data['title']])
+                ->findOrEmpty()
+                ->isEmpty();
+            if (!$temp) throw new ValidateException('该企业名称重复');
+        }
+
+        $data = array_merge($data, [
+            'updaterid' => self::$uid,
+            'updater' => self::$uname,
+            "updatetime" => date("Y-m-d H:i:s"),
+        ]);
+
+        $res = CompanyModel::where(['id' => $data['id']])->save($data);
+
+        return $res ? json_show(CommonModel::$success, '企业编辑成功') : json_show(CommonModel::$error_param, '企业编辑失败');
+
+    }
+
+    //企业启禁用
+    public static function Change(array $data = []): Json
+
+    {
+        $where = [
+            ['id', '=', $data['id']],
+            ['is_del', '=', CommonModel::$del_normal],
+            ['status', '<>', $data['status']],
+        ];
+        $rs = CompanyModel::field('id,status')
+            ->where($where)
+            ->findOrEmpty()
+            ->isEmpty();
+
+        if ($rs) throw new ValidateException('该企业不存在或重复操作');
+
+        $data = array_merge($data, [
+            'updaterid' => self::$uid,
+            'updater' => self::$uname,
+            "updatetime" => date("Y-m-d H:i:s"),
+        ]);
+
+        $res = CompanyModel::where($where)->save($data);
+
+        return $res ? json_show(CommonModel::$success, '更新成功') : json_show(CommonModel::$error_param, '更新失败');
+
+    }
+
+    //删除企业
+    public static function Delete(int $id = 0): Json
+    {
+        $rs = CompanyModel::where(['id' => $id, 'is_del' => CommonModel::$del_normal])
+            ->save(['is_del' => CommonModel::$del_deleted]);
+
+        return $rs ? json_show(CommonModel::$success, '企业删除成功') : json_show(CommonModel::$error_param, '企业不存在或重复删除');
+    }
+
+}

+ 0 - 329
app/admin/logic/IndexLogic.php

@@ -1,329 +0,0 @@
-<?php
-
-namespace app\api\logic;
-
-use app\model\CommonModel;
-use app\model\SupplierModel;
-use app\model\DevelopmentModel;
-use think\Exception;
-use think\facade\Cache;
-use think\facade\Config;
-use think\facade\Db;
-use think\helper\Str;
-
-class IndexLogic
-{
-
-    //刷新密钥
-    public static function refreshSecret(array $param = [])
-    {
-
-        $supplier = SupplierModel::alias('a')
-            ->field('a.id,a.code')
-            ->join('wsm_supplier_contact b', 'b.code=a.code')
-            ->where([
-                'a.name' => $param['supplierName'],
-                'a.legaler' => $param['legaler'],
-                'a.registercode' => $param['registercode'],
-                'b.contactor' => $param['contactor'],
-                'b.mobile' => $param['mobile'],
-                'a.is_del' => 0
-            ])
-            ->findOrEmpty()
-            ->toArray();
-
-        if (empty($supplier)) return json_show(CommonModel::$error_param, '相关供应商不存在');
-
-        $clientID = $supplier['code'];//clientID,暂时取用供应商编码字段
-        $clientSercert = Str::random(40, 5);//clientSercert,随机40个字符
-
-        $data = array_merge($param, [
-            'supplierNo' => $supplier['code'],
-            'clientID' => $clientID,
-            'clientSecret' => $clientSercert,
-        ]);
-
-        $id = DevelopmentModel::where('supplierNo', $supplier['code'])
-            ->value('id', 0);
-
-        if ($id) $res = DevelopmentModel::where('id', $id)->save($data); //更新
-        else {
-            $res = DevelopmentModel::create($data);
-            $id = $res->id;
-        } //新增
-
-        if ($res) {
-
-            Cache::set(Config::get('redis_key.development_clientID') . $clientID, json_encode(array_merge(['id' => $id], $data), JSON_UNESCAPED_UNICODE), 30 * 24 * 3600);
-
-            return json_show(CommonModel::$success, '刷新密钥成功', ['clientID' => $clientID, 'clientSecret' => $clientSercert]);
-
-        } else return json_show(CommonModel::$error_default, '刷新密钥失败');;
-
-
-    }
-
-    //修改开发信息中的推送地址
-    public static function updatePushUrl(array $param = [])
-    {
-
-        $res = DevelopmentModel::where('supplierNo', request()->development['supplierNo'])
-            ->save(['push_url' => implode(',', $param['push_url'])]);
-
-        return $res ? json_show(CommonModel::$success, '修改推送地址成功') : json_show(CommonModel::$error_default, '修改推送地址失败');
-
-    }
-
-    //获取推送记录
-    public static function getPushLog(array $param = [])
-    {
-
-        $res = Db::name('push_log')
-            ->where('supplierNo', request()->development['supplierNo']);
-
-        if ($param['push_url'] != '') $res->whereLike('push_url', '%' . $param['push_url'] . '%');
-        if ($param['type']) $res->where('type', $param['type']);
-        if ($param['start'] != '') $res->where('addtime', '>=', $param['start']);
-        if ($param['end'] != '') $res->where('addtime', '<=', $param['end']);
-
-        $count = $res->count('id');
-
-        $list = $res
-            ->page($param['page'], $param['size'])
-            ->order('id')
-            ->select()
-            ->toArray();
-
-        return json_show(CommonModel::$success, '获取推送记录成功', ['count' => $count, 'list' => $list]);
-
-    }
-
-
-    //获取上线平台列表
-//    public static function getPlatformList(string $keyword = '', int $page = 1, int $size = 15)
-//    {
-//
-//        $db = Db::connect('mysql_wsm')
-//            ->name('platform')
-//            ->where('is_del', 0);
-//
-//        if ($keyword != '') $db->whereLike('platform_name', '%' . $keyword . '%');
-//
-//        $count = $db->count('id');
-//
-//        $list = $db
-//            ->field('id platform_id,platform_code,platform_name,platform_type')
-//            ->order('id')
-//            ->page($page, $size)
-//            ->select()
-//            ->toArray();
-//
-//        return json_show(0, '请求成功', ['count' => $count, 'list' => $list]);
-//
-//    }
-
-    //获取分类列表
-    public static function getCatList(string $keyword = '', int $pid = 0)
-    {
-
-        $db = Db::connect('mysql_wsm')
-            ->name('cat')
-            ->where(['is_del' => 0, 'pid' => $pid]);
-
-        if ($keyword != '') $db->whereLike('cat_name', '%' . $keyword . '%');
-
-        $count = $db->count('id');
-
-        $list = $db
-            ->field('id cat_id,cat_name,level')
-            ->order('id')
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', ['count' => $count, 'list' => $list]);
-
-    }
-
-    //获取品牌列表
-    public static function getBrandList(string $keyword = '', int $page = 1, int $size = 15)
-    {
-
-        $db = Db::connect('mysql_wsm')
-            ->name('brand')
-            ->where('is_del', 0);
-
-        if ($keyword != '') $db->whereLike('brand_name', '%' . $keyword . '%');
-
-        $count = $db->count('id');
-
-        $list = $db
-            ->field('id brand_id,brand_name')
-            ->order('id')
-            ->page($page, $size)
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', ['count' => $count, 'list' => $list]);
-
-    }
-
-    //获取单位列表
-    public static function getUnitList(string $keyword = '', int $page = 1, int $size = 15)
-    {
-
-        $db = Db::connect('mysql_wsm')
-            ->name('unit')
-            ->where('is_del', 0);
-
-        if ($keyword != '') $db->whereLike('unit', '%' . $keyword . '%');
-
-        $count = $db->count('id');
-
-        $list = $db
-            ->field('id unit_id,unit unit_name')
-            ->order('id')
-            ->page($page, $size)
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', ['count' => $count, 'list' => $list]);
-
-    }
-
-    //获取规格标题列表
-    public static function getSpecsTitleList(string $keyword = '')
-    {
-
-        $db = Db::connect('mysql_wsm')
-            ->name('specs')
-            ->where('is_del', 0);
-
-        if ($keyword != '') $db->whereLike('spec_name', '%' . $keyword . '%');
-
-        $list = $db
-            ->field('id spec_id,spec_name')
-            ->order('addtime', 'desc')
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', $list);
-
-    }
-
-    //获取规格值列表
-    public static function getSpecsValueByTitleList(int $spec_id = 0)
-    {
-
-        $list = Db::connect('mysql_wsm')
-            ->name('spec_value')
-            ->field('spec_id ,id spec_value_id,spec_value')
-            ->where(['is_del' => 0, 'spec_id' => $spec_id])
-            ->order('id')
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', $list);
-
-    }
-
-    //创建规格值
-    public static function createSpec(array $param = [])
-    {
-        $url = env('WSM_DOMAIN') . 'abutment/createSpec';
-
-        $res = json_decode(curl_request($url, $param), true);
-
-        if (isset($res) && $res['code'] == CommonModel::$success) return json_show(CommonModel::$success, '创建规格值成功');
-        else throw new Exception($res['message']);
-
-    }
-
-    //获取省市区列表
-    public static function getAreaList(int $level = 1, string $pid_code = '', string $keyword = '')
-    {
-
-        switch ($level) {
-            case 1:
-                $list = Db::connect('mysql_wsm')
-                    ->name('province')
-                    ->field('province_code code,name');
-                break;
-            case 2:
-                $list = Db::connect('mysql_wsm')
-                    ->name('city')
-                    ->field('city_code code,name')
-                    ->where('province_code', $pid_code);
-                break;
-            case 3:
-                $list = Db::connect('mysql_wsm')
-                    ->name('area')
-                    ->field('area_code code,name')
-                    ->where('city_code', $pid_code);
-                break;
-        }
-
-        if ($keyword != '') $list->whereLike('name', '%' . $keyword . '%');
-
-        $data = $list->order('id')
-            ->select()
-            ->toArray();
-
-        return json_show(0, '获取成功', $data);
-    }
-
-    //获取业务公司编码
-    public static function getCompanyNoList(string $keyword = '')
-    {
-
-        $db = Db::connect('mysql_wsm')
-            ->name('business')->where('is_del', 0);
-
-        if ($keyword != '') $db->whereLike('company|companyNo', '%' . $keyword . '%');
-
-        $list = $db
-            ->field('companyNo,company')
-            ->order('id')
-            ->select()
-            ->toArray();
-
-        return json_show(0, '请求成功', $list);
-
-    }
-
-    //专属类型列表
-    public static function getExclusiveList(int $pid = 0, string $keyword = '')
-    {
-        $where = [['status', '=', 1], ['is_del', '=', 0], ['pid', '=', $pid]];
-        if ($keyword !== '') $where[] = ['name', 'like', '%' . $keyword . '%'];
-
-        $data = Db::connect('mysql_wsm')
-            ->name('exclusive')
-            ->field('id exclusive_id,name exclusive_name,level')
-            ->where($where)
-            ->select()
-            ->toArray();
-
-        return json_show(0, '获取成功', $data);
-
-    }
-
-    //上传图片
-    public static function uploadImg(array $files = [])
-    {
-
-        $url = env('WSM_DOMAIN') . 'abutment/uploadImg';
-
-//        halt($files->getPath().DIRECTORY_SEPARATOR.$files->getFilename(),$files->getType(),$files->getBasename());
-
-//        $data = array('file' => new \CURLFile(realpath($path)));
-
-        $res = curl_upload($url, $files);
-
-        halt('请求结果:', $res);
-        $res = json_decode(curl_request($url, ['image' => $files->getPath() . DIRECTORY_SEPARATOR . $files->getFilename()]), true);
-        halt($res);
-        if (isset($res) && $res['code'] == CommonModel::$success) return json_show(CommonModel::$success, '上传图片成功', $res['data']);
-        else throw new Exception($res['message']);
-    }
-
-}

+ 6 - 6
app/admin/logic/MenuLogic.php

@@ -7,11 +7,11 @@ use app\model\CommonModel;
 use think\facade\Db;
 use think\response\Json;
 
-class MenuLogic
+class MenuLogic extends BaseLogic
 {
 
     //获取菜单列表
-    public static function menuList(): Json
+    public static function List(): Json
     {
         //menu_action是一个视图
         $data = Db::name('menu_action')
@@ -46,7 +46,7 @@ class MenuLogic
     }
 
     //添加菜单
-    public static function menuAdd(array $data = []): Json
+    public static function Add(array $data = []): Json
     {
 
         $data = array_merge($data, [
@@ -62,7 +62,7 @@ class MenuLogic
     }
 
     //编辑菜单
-    public static function menuEdit(array $data = []): Json
+    public static function Edit(array $data = []): Json
     {
         $rs = AdminMenuModel::field('id')
             ->where(['id' => $data['id'], 'is_show' => AdminMenuModel::$show, 'status' => AdminMenuModel::$status_normal])
@@ -82,7 +82,7 @@ class MenuLogic
     }
 
     //删除菜单
-    public static function menuDel(int $id = 0): Json
+    public static function Delete(int $id = 0): Json
     {
         $rs = AdminMenuModel::field('id')
             ->where(['id' => $id, 'is_show' => AdminMenuModel::$show, 'status' => AdminMenuModel::$status_normal])
@@ -102,7 +102,7 @@ class MenuLogic
     }
 
     //启禁用菜单
-    public static function menuStatus(array $data = []): Json
+    public static function Status(array $data = []): Json
     {
         $rs = AdminMenuModel::field('id')
             ->where('id', $data['id'])

+ 1 - 1
app/admin/logic/VersionLogic.php

@@ -7,7 +7,7 @@ use app\model\VersionModel;
 use think\facade\Db;
 use think\response\Json;
 
-class VersionLogic
+class VersionLogic extends BaseLogic
 {
     public static function lastVersion(): Json
     {

+ 7 - 7
app/admin/logic/VideoLogic.php

@@ -7,10 +7,10 @@ use app\model\VideoModel;
 use think\exception\ValidateException;
 use think\response\Json;
 
-class VideoLogic
+class VideoLogic extends BaseLogic
 {
     //获取视频列表
-    public static function videoList(array $data = []): Json
+    public static function List(array $data = []): Json
     {
         $db = VideoModel::where('is_del', CommonModel::$del_normal);
         if ($data['status'] != '') $db->where('status', $data['status']);
@@ -31,7 +31,7 @@ class VideoLogic
     }
 
     //添加视频
-    public static function videoAdd(array $data = []): Json
+    public static function Add(array $data = []): Json
     {
 
         $rs = VideoModel::field('id')
@@ -58,7 +58,7 @@ class VideoLogic
     }
 
     //读取视频详情
-    public static function videoRead(int $id = 0): Json
+    public static function Read(int $id = 0): Json
     {
         $rs = VideoModel::field(true)
             ->where(['id' => $id, 'is_del' => CommonModel::$del_normal])
@@ -68,7 +68,7 @@ class VideoLogic
     }
 
     //编辑视频
-    public static function videoEdit(array $data = []): Json
+    public static function Edit(array $data = []): Json
     {
         $rs = VideoModel::field('id,video_name')
             ->where(['id' => $data['id'], 'is_del' => CommonModel::$del_normal])
@@ -98,7 +98,7 @@ class VideoLogic
     }
 
     //视频启禁用
-    public static function videoChange(array $data = []): Json
+    public static function Change(array $data = []): Json
 
     {
         $where = [
@@ -122,7 +122,7 @@ class VideoLogic
     }
 
     //删除视频
-    public static function videoDelete(int $id = 0): Json
+    public static function Delete(int $id = 0): Json
     {
         $rs = VideoModel::where(['id' => $id, 'is_del' => CommonModel::$del_normal])
             ->save(['is_del' => CommonModel::$del_deleted]);

+ 25 - 17
app/admin/route/app.php

@@ -11,24 +11,32 @@ Route::rule('versionList','Admin/Version/getList');//版本列表
 Route::rule('versionAdd','Admin/Version/create');//新建版本
 
 //【菜单】
-Route::rule('menuList', 'admin/Menu/menuList');//获取菜单列表
-Route::rule('menuAdd', 'admin/Menu/menuAdd');//添加菜单
-Route::rule('menuSave', 'admin/Menu/menuEdit');//编辑菜单
-Route::rule('menuDel', 'admin/Menu/menuDel');//删除菜单
-Route::rule('menuStatus', 'admin/Menu/menuStatus');//启禁用菜单
+Route::rule('menuList', 'admin/Menu/List');//获取菜单列表
+Route::rule('menuAdd', 'admin/Menu/Add');//添加菜单
+Route::rule('menuSave', 'admin/Menu/Edit');//编辑菜单
+Route::rule('menuDel', 'admin/Menu/Del');//删除菜单
+Route::rule('menuStatus', 'admin/Menu/Status');//启禁用菜单
 
 //【视频】
-Route::rule('videoList', 'admin/Video/videoList');//获取视频列表
-Route::rule('videoAdd', 'admin/Video/videoAdd');//添加视频
-Route::rule('videoRead', 'admin/Video/videoRead');//获取视频详情
-Route::rule('videoEdit', 'admin/Video/videoEdit');//编辑视频
-Route::rule('videoChange', 'admin/Video/videoChange');//视频启禁用
-Route::rule('videoDelete', 'admin/Video/videoDelete');//删除视频
+Route::rule('videoList', 'admin/Video/List');//获取视频列表
+Route::rule('videoAdd', 'admin/Video/Add');//添加视频
+Route::rule('videoRead', 'admin/Video/Read');//获取视频详情
+Route::rule('videoEdit', 'admin/Video/Edit');//编辑视频
+Route::rule('videoChange', 'admin/Video/Change');//视频启禁用
+Route::rule('videoDelete', 'admin/Video/Delete');//删除视频
 
 //【卡类型】
-Route::rule('cardList', 'admin/Card/cardList');//获取卡类型列表
-Route::rule('cardAdd', 'admin/Card/cardAdd');//添加卡类型
-Route::rule('cardRead', 'admin/Card/cardRead');//获取卡类型详情
-Route::rule('cardEdit', 'admin/Card/cardEdit');//编辑卡类型
-Route::rule('cardChange', 'admin/Card/cardChange');//卡类型启禁用
-Route::rule('cardDelete', 'admin/Card/cardDelete');//删除卡类型
+Route::rule('cardList', 'admin/Card/List');//获取卡类型列表
+Route::rule('cardAdd', 'admin/Card/Add');//添加卡类型
+Route::rule('cardRead', 'admin/Card/Read');//获取卡类型详情
+Route::rule('cardEdit', 'admin/Card/Edit');//编辑卡类型
+Route::rule('cardChange', 'admin/Card/Change');//卡类型启禁用
+Route::rule('cardDelete', 'admin/Card/Delete');//删除卡类型
+
+//【企业】
+Route::rule('companyList', 'admin/Company/List');//获取企业列表
+Route::rule('companyAdd', 'admin/Company/Add');//添加企业
+Route::rule('companyRead', 'admin/Company/Read');//获取企业详情
+Route::rule('companyEdit', 'admin/Company/Edit');//编辑企业
+Route::rule('companyChange', 'admin/Company/Change');//企业启禁用
+Route::rule('companyDelete', 'admin/Company/Delete');//删除企业

+ 11 - 0
app/model/CompanyModel.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace app\model;
+
+use think\Model;
+
+class CompanyModel extends Model
+{
+    protected $table = 'fc_company';
+    protected $pk = 'id';
+}