Преглед изворни кода

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

From-wh пре 2 година
родитељ
комит
d0f7e6cbfa
29 измењених фајлова са 24650 додато и 200 уклоњено
  1. 0 1
      .gitignore
  2. 1 1
      crmeb/app/adminapi/controller/Common.php
  3. 8 6
      crmeb/app/adminapi/controller/v1/notification/sms/SmsConfig.php
  4. 12 19
      crmeb/app/adminapi/controller/v1/setting/SystemConfig.php
  5. 49 0
      crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
  6. 2 0
      crmeb/app/adminapi/route/system.php
  7. 5 0
      crmeb/app/model/system/SystemCrud.php
  8. 1 1
      crmeb/app/services/order/StoreOrderComputedServices.php
  9. 122 90
      crmeb/app/services/system/SystemCrudServices.php
  10. 22 9
      crmeb/app/services/system/config/SystemConfigServices.php
  11. 2 5
      crmeb/app/services/yihaotong/SmsAdminServices.php
  12. 12 10
      crmeb/crmeb/services/SystemConfigService.php
  13. 3 2
      crmeb/crmeb/services/crud/Controller.php
  14. 13 11
      crmeb/crmeb/services/crud/Make.php
  15. 7 0
      crmeb/crmeb/services/crud/Model.php
  16. 8 8
      crmeb/crmeb/services/crud/Route.php
  17. 3 3
      crmeb/crmeb/services/crud/Service.php
  18. 3 4
      crmeb/crmeb/services/crud/ViewApi.php
  19. 3 3
      crmeb/crmeb/services/crud/ViewPages.php
  20. 2 1
      crmeb/crmeb/services/crud/ViewRouter.php
  21. 2 2
      crmeb/crmeb/services/crud/stubs/controller/CrudController.stub
  22. 2 2
      crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub
  23. 2 2
      crmeb/crmeb/services/crud/stubs/model/CrudModel.stub
  24. 2 2
      crmeb/crmeb/services/crud/stubs/service/CrudService.stub
  25. 2 2
      crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub
  26. 2 2
      crmeb/crmeb/services/upload/storage/Local.php
  27. 1 1
      crmeb/public/install/.env
  28. 24359 8
      crmeb/public/install/crmeb.sql
  29. 0 5
      crmeb/vendor/overtrue/wechat/src/Staff/Staff.php

+ 0 - 1
.gitignore

@@ -2,7 +2,6 @@
 /.idea
 *.log
 *.DS_Store
-/crmeb/.env
 /crmeb/runtime/cache
 /crmeb/runtime/log
 /crmeb/runtime/session

+ 1 - 1
crmeb/app/adminapi/controller/Common.php

@@ -402,7 +402,7 @@ class Common extends AuthController
                 'info' => ''
             ]);
         }
-        \crmeb\services\CacheService::clear();
+        $services->cacheDriver()->clear();
         return app('json')->success(100000);
     }
 

+ 8 - 6
crmeb/app/adminapi/controller/v1/notification/sms/SmsConfig.php

@@ -10,9 +10,9 @@
 // +----------------------------------------------------------------------
 namespace app\adminapi\controller\v1\notification\sms;
 
+use app\services\system\config\SystemConfigServices;
 use app\services\yihaotong\SmsAdminServices;
 use app\services\serve\ServeServices;
-use crmeb\services\CacheService;
 use app\adminapi\controller\AuthController;
 use think\facade\App;
 
@@ -64,7 +64,8 @@ class SmsConfig extends AuthController
      */
     public function is_login(ServeServices $services)
     {
-        $sms_info = CacheService::get('sms_account');
+        $configServices = app()->make(SystemConfigServices::class);
+        $sms_info = $configServices->cacheDriver()->get('sms_account');
         $data = ['status' => false, 'info' => ''];
         if ($sms_info) {
             try {
@@ -80,14 +81,14 @@ class SmsConfig extends AuthController
             }
             return app('json')->success($data);
         } else {
-            CacheService::clear();
+            $configServices->cacheDriver()->clear();
             $account = sys_config('sms_account');
             $password = sys_config('sms_token');
             //没有退出登录 清空这两个数据 自动登录
             if ($account && $password) {
                 $res = $services->user()->login($account, $password);
                 if ($res) {
-                    CacheService::set('sms_account', $account);
+                    $configServices->cacheDriver()->set('sms_account', $account);
                     $data['status'] = true;
                     $data['info'] = $account;
                 }
@@ -103,9 +104,10 @@ class SmsConfig extends AuthController
      */
     public function logout()
     {
-        CacheService::delete('sms_account');
+        $configServices = app()->make(SystemConfigServices::class);
+        $configServices->cacheDriver()->delete('sms_account');
         $this->services->updateSmsConfig('', '');
-        CacheService::clear();
+        $configServices->cacheDriver()->clear();
         return app('json')->success(100042);
     }
 

+ 12 - 19
crmeb/app/adminapi/controller/v1/setting/SystemConfig.php

@@ -12,7 +12,6 @@ namespace app\adminapi\controller\v1\setting;
 
 use app\adminapi\controller\AuthController;
 use app\Request;
-use app\services\order\StoreOrderServices;
 use app\services\system\config\SystemConfigServices;
 use app\services\system\config\SystemConfigTabServices;
 use think\facade\App;
@@ -38,8 +37,10 @@ class SystemConfig extends AuthController
 
     /**
      * 显示资源列表
-     *
      * @return \think\Response
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
     public function index()
     {
@@ -58,8 +59,11 @@ class SystemConfig extends AuthController
 
     /**
      * 显示创建资源表单页.
-     * @param $type
      * @return \think\Response
+     * @throws \FormBuilder\Exception\FormBuilderException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
     public function create()
     {
@@ -72,7 +76,6 @@ class SystemConfig extends AuthController
 
     /**
      * 保存新建的资源
-     *
      * @return \think\Response
      */
     public function save()
@@ -120,7 +123,7 @@ class SystemConfig extends AuthController
         } else {
             $this->services->save($data);
         }
-        \crmeb\services\CacheService::clear();
+        $this->services->cacheDriver()->clear();
         return app('json')->success(400284);
     }
 
@@ -186,13 +189,12 @@ class SystemConfig extends AuthController
         }
         $data['value'] = json_encode($data['value']);
         $this->services->update($id, $data);
-        \crmeb\services\CacheService::clear();
+        $this->services->cacheDriver()->clear();
         return app('json')->success(100001);
     }
 
     /**
      * 删除指定资源
-     *
      * @param int $id
      * @return \think\Response
      */
@@ -201,7 +203,7 @@ class SystemConfig extends AuthController
         if (!$this->services->delete($id))
             return app('json')->fail(100008);
         else {
-            \crmeb\services\CacheService::clear();
+            $this->services->cacheDriver()->clear();
             return app('json')->success(100002);
         }
     }
@@ -218,7 +220,7 @@ class SystemConfig extends AuthController
             return app('json')->fail(100100);
         }
         $this->services->update($id, ['status' => $status]);
-        \crmeb\services\CacheService::clear();
+        $this->services->cacheDriver()->clear();
         return app('json')->success(100014);
     }
 
@@ -311,15 +313,6 @@ class SystemConfig extends AuthController
             return app('json')->fail(500029);
         }
 
-        //支付接口类型选择,如果有订单就不能再进行切换
-//        if (isset($post['pay_wechat_type'])) {
-//            /** @var StoreOrderServices $orderServices */
-//            $orderServices = app()->make(StoreOrderServices::class);
-//            if ($post['pay_wechat_type'] != -1 && $orderServices->count()) {
-//                return app('json')->fail('支付接口类型已经选择,不能再次进行切换,切换后会导致无法退款等问题。');
-//            }
-//        }
-
         if (isset($post['weixin_ckeck_file'])) {
             $from = public_path() . $post['weixin_ckeck_file'];
             $to = public_path() . array_reverse(explode('/', $post['weixin_ckeck_file']))[0];
@@ -345,7 +338,7 @@ class SystemConfig extends AuthController
                 $this->services->update($k, ['value' => json_encode($v)], 'menu_name');
             }
         }
-        \crmeb\services\CacheService::clear();
+        $this->services->cacheDriver()->clear();
         return app('json')->success(100001);
 
     }

+ 49 - 0
crmeb/app/adminapi/controller/v1/setting/SystemCrud.php

@@ -72,8 +72,13 @@ class SystemCrud extends AuthController
             ['fromField', []],
             ['columnField', []],
             ['filePath', []],
+            ['isTable', 0],
         ]);
 
+        if (!$data['tableName']) {
+            return app('json')->fail('缺少表名');
+        }
+
         $this->services->createCrud($data);
 
         return app('json')->success('创建成功');
@@ -96,6 +101,14 @@ class SystemCrud extends AuthController
             ['columnField', []],
         ], true);
 
+        if (!$tableName) {
+            return app('json')->fail('缺少表名');
+        }
+
+        if (in_array($tableName, SystemCrudServices::NOT_CRUD_TABANAME)) {
+            return app('json')->fail('不能生成系统自带数据表');
+        }
+
         $routeName = 'crud/' . Str::snake($tableName);
 
         $make = $this->services->makeFile($tableName, $routeName, false, [
@@ -123,6 +136,42 @@ class SystemCrud extends AuthController
         return app('json')->success(compact('makePath', 'tableField'));
     }
 
+    /**
+     * @param $id
+     * @return \think\Response
+     * @author 等风来
+     * @email 136327134@qq.com
+     * @date 2023/4/12
+     */
+    public function read($id)
+    {
+        if (!$id) {
+            return app('json')->fail('缺少参数');
+        }
+
+        $info = $this->services->get($id);
+        if (!$info) {
+            return app('json')->fail('查看的生成的文件不存在');
+        }
+
+        $routeName = 'crud/' . Str::snake($info->table_name);
+
+        $make = $this->services->makeFile($info->table_name, $routeName, false, [
+            'menuName' => $info->name,
+            'fromField' => $info->field['fromField'] ?? [],
+            'columnField' => $info->field['columnField'] ?? [],
+        ]);
+        
+        $data = [];
+        foreach ($make as $item) {
+            $item['name'] = pathinfo($item['path'])['basename'] ?? '';
+            $data[] = $item;
+        }
+
+        return app('json')->success($data);
+
+    }
+
     /**
      * 获取tree菜单
      * @return \think\Response

+ 2 - 0
crmeb/app/adminapi/route/system.php

@@ -141,6 +141,8 @@ Route::group('system', function () {
     Route::post('crud/file_path', 'v1.setting.SystemCrud/getFilePath')->option(['real_name' => '获取CRUD文件存放']);
     //删除CRUD
     Route::delete('crud/:id', 'v1.setting.SystemCrud/delete')->option(['real_name' => '删除CRUD']);
+    //查看CRUD
+    Route::get('crud/:id', 'v1.setting.SystemCrud/read')->option(['real_name' => '查看CRUD']);
     //获取CRUD列表
     Route::get('crud', 'v1.setting.SystemCrud/index')->option(['real_name' => '获取CRUD列表']);
     //保存生成CRUD

+ 5 - 0
crmeb/app/model/system/SystemCrud.php

@@ -35,4 +35,9 @@ class SystemCrud extends BaseModel
      * @var string
      */
     protected $pk = 'id';
+
+    public function getAddTimeAttr($value)
+    {
+        return date('Y-m-d H:i:s', $value);
+    }
 }

+ 1 - 1
crmeb/app/services/order/StoreOrderComputedServices.php

@@ -480,7 +480,7 @@ class StoreOrderComputedServices extends BaseServices
                 $tempId = $item['productInfo']['temp_id'] ?? 0;
                 $tempPostage = $truePostageArr[$tempId] ?? 0;
                 $tempNumber = $temp_num[$tempId]['number'] ?? 0;
-                if (!$tempId || !$tempPostage || !$tempNumber) continue;
+                if (!$tempId || !$tempPostage) continue;
                 $type = $temp_num[$tempId]['type'];
 
 

+ 122 - 90
crmeb/app/services/system/SystemCrudServices.php

@@ -42,6 +42,18 @@ use Phinx\Db\Adapter\MysqlAdapter;
 class SystemCrudServices extends BaseServices
 {
 
+    //不能生成的系统自带表
+    const NOT_CRUD_TABANAME = [
+        'system_config', 'system_attachment', 'system_attachment_category', 'system_config_tab',
+        'system_admin', 'eb_system_city', 'system_log', 'system_menus', 'system_notice',
+        'system_notice_admin', 'system_notification', 'system_role', 'system_route',
+        'system_route_cate', 'system_storage', 'system_timer', 'system_user_level',
+        'system_crud', 'wechat_key', 'user_label_relation', 'user_brokerage_frozen',
+        'user_brokerage', 'store_product_cate', 'store_bargain_user_help', 'shipping_templates_region',
+        'shipping_templates_no_delivery', 'shipping_templates_free', 'other_order_status', 'lang_code',
+        'lang_country', 'app_version',
+    ];
+
     /**
      * SystemCrudServices constructor.
      * @param SystemCrudDao $dao
@@ -60,7 +72,7 @@ class SystemCrudServices extends BaseServices
     public function getList()
     {
         [$page, $limit] = $this->getPageValue();
-        $list = $this->dao->selectList([], '*', $page, $limit, 'id desc');
+        $list = $this->dao->selectList([], 'add_time,id,name,table_name', $page, $limit, 'id desc');
         $count = $this->dao->count();
 
         return compact('list', 'count');
@@ -151,10 +163,14 @@ class SystemCrudServices extends BaseServices
         $filePath = $data['filePath'];
 
         //创建数据库
-        if ($tableField) {
+        if ($tableField && !$data['isTable']) {
             $this->makeDatebase($tableName, $tableComment, $tableField);
         }
 
+        if (in_array($tableName, self::NOT_CRUD_TABANAME)) {
+            throw new ValidateException('不能生成系统自带数据表');
+        }
+
         //读取表结构
         $column = $this->getColumnNamesList($tableName);
         if (!$column) {
@@ -164,16 +180,19 @@ class SystemCrudServices extends BaseServices
         $routeName = 'crud/' . Str::snake($tableName);
         $uniqueAuth = $routeName . '-index-list';
 
-        $make = $this->makeFile($tableName, $routeName, true, $data, $filePath);
-        $makePath = [];
-        foreach ($make as $key => $item) {
-            $makePath[$key] = $item['path'];
+        foreach ($filePath as $k => $i) {
+            if (in_array($k, ['pages', 'router', 'api'])) {
+                $filePath[$k] = Make::adminTemplatePath() . $i;
+            } else {
+                $filePath[$k] = app()->getRootPath() . $i;
+            }
         }
+
         //创建菜单
         if (!$data['menuName']) {
             $data['menuName'] = $tableName;
         }
-        $data = [
+        $dataMenu = [
             'pid' => $data['pid'],
             'menu_name' => $data['menuName'],
             'menu_path' => '',
@@ -183,81 +202,94 @@ class SystemCrudServices extends BaseServices
             'unique_auth' => $uniqueAuth,
             'is_header' => $data['pid'] ? 0 : 1,
         ];
-        $menuInfo = app()->make(SystemMenusServices::class)->save($data);
-        //写入路由权限
-        $cateId = app()->make(SystemRouteServices::class)->topCateId('adminapi');
-        $ruleData = [
-            [
-                'path' => $routeName,
-                'method' => 'GET',
-                'name' => $data['menuName'] . '列表接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/create',
-                'method' => 'GET',
-                'name' => $data['menuName'] . '获取创建表单接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName,
-                'method' => 'POST',
-                'name' => $data['menuName'] . '保存数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>/edit',
-                'method' => 'GET',
-                'name' => $data['menuName'] . '获取修改表单接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>',
-                'method' => 'PUT',
-                'name' => $data['menuName'] . '修改数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-            [
-                'path' => $routeName . '/<id>',
-                'method' => 'DELETE',
-                'name' => $data['menuName'] . '删除数据接口',
-                'app_name' => 'adminapi',
-                'cate_id' => $cateId,
-                'add_time' => date('Y-m-d H:i:s')
-            ],
-        ];
-        app()->make(SystemRouteServices::class)->saveAll($ruleData);
-        //记录权限加入菜单表
-        $menuData = [];
-        foreach ($ruleData as $item) {
-            $menuData[] = [
-                'pid' => $menuInfo->id,
-                'method' => $item['method'],
-                'api_url' => $item['path'],
-                'name' => $item['name'],
-                'is_del' => 0,
+
+        $res = $this->transaction(function () use ($filePath, $tableName, $routeName, $data, $dataMenu) {
+            $menuInfo = app()->make(SystemMenusServices::class)->save($dataMenu);
+            //写入路由权限
+            $cateId = app()->make(SystemRouteServices::class)->topCateId('adminapi');
+            $ruleData = [
+                [
+                    'path' => $routeName,
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '列表接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/create',
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '获取创建表单接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName,
+                    'method' => 'POST',
+                    'name' => $data['menuName'] . '保存数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>/edit',
+                    'method' => 'GET',
+                    'name' => $data['menuName'] . '获取修改表单接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>',
+                    'method' => 'PUT',
+                    'name' => $data['menuName'] . '修改数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
+                [
+                    'path' => $routeName . '/<id>',
+                    'method' => 'DELETE',
+                    'name' => $data['menuName'] . '删除数据接口',
+                    'app_name' => 'adminapi',
+                    'cate_id' => $cateId,
+                    'add_time' => date('Y-m-d H:i:s')
+                ],
             ];
-        }
-        app()->make(SystemMenusServices::class)->saveAll($menuData);
-        //记录crud生成
-        $res = $this->dao->save([
-            'pid' => $data['pid'],
-            'name' => $data['menuName'],
-            'table_name' => $tableName,
-            'field' => json_encode($data),
-            'make_path' => json_encode($makePath),
-            'add_time' => time()
-        ]);
+            app()->make(SystemRouteServices::class)->saveAll($ruleData);
+            //记录权限加入菜单表
+            $menuData = [];
+            foreach ($ruleData as $item) {
+                $menuData[] = [
+                    'pid' => $menuInfo->id,
+                    'method' => $item['method'],
+                    'api_url' => $item['path'],
+                    'name' => $item['name'],
+                    'is_del' => 0,
+                ];
+            }
+            app()->make(SystemMenusServices::class)->saveAll($menuData);
+
+            $make = $this->makeFile($tableName, $routeName, true, $data, $filePath);
+            $makePath = [];
+            foreach ($make as $key => $item) {
+                $makePath[$key] = $item['path'];
+            }
+
+            //记录crud生成
+            $res = $this->dao->save([
+                'pid' => $data['pid'],
+                'name' => $data['menuName'],
+                'table_name' => $tableName,
+                'field' => json_encode($data),
+                'make_path' => json_encode($makePath),
+                'add_time' => time()
+            ]);
+
+            return $res;
+        });
+
         return $res->toArray();
     }
 
@@ -323,41 +355,41 @@ class SystemCrudServices extends BaseServices
         $options['columnField'] = is_array($options['columnField']) ? $options['columnField'] : [];
         //生成控制器
         $controller = app()->make(Controller::class);
-        [$controllerContent, $controllerPath] = $controller->setFilePathName($filePath['controller'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$controllerContent, $controllerPath] = $controller->setFilePathName($filePath['controller'] ?? '')->isMake($isMake)->handle($tableName);
         //生成模型
         $model = app()->make(Model::class);
-        [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$modelContent, $modelPath] = $model->setFilePathName($filePath['model'] ?? '')->isMake($isMake)->handle($tableName);
         //生成dao
         $dao = app()->make(Dao::class);
-        [$daoContent, $daoPath] = $dao->setFilePathName($filePath['dao'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$daoContent, $daoPath] = $dao->setFilePathName($filePath['dao'] ?? '')->isMake($isMake)->handle($tableName);
         //生成路由
         $route = app()->make(Route::class);
-        [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$routeContent, $routePath] = $route->setFilePathName($filePath['route'] ?? '')->isMake($isMake)->handle($tableName, [
             'menus' => $options['menuName'],
             'route' => $routeName
         ]);
         //生成service
         $service = app()->make(Service::class);
-        [$serviceContent, $servicePath] = $service->setFilePathName($filePath['service'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$serviceContent, $servicePath] = $service->setFilePathName($filePath['service'] ?? '')->isMake($isMake)->handle($tableName, [
             'field' => $options['fromField'],
         ]);
         //生成验证器
         $validate = app()->make(Validate::class);
-        [$validateContent, $validatePath] = $validate->setFilePathName($filePath['validate'] ?? '')->isMake($isMake)->handle($tableName, '/');
+        [$validateContent, $validatePath] = $validate->setFilePathName($filePath['validate'] ?? '')->isMake($isMake)->handle($tableName);
         //生成前台路由
         $viewRouter = app()->make(ViewRouter::class);
-        [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$routerContent, $routerPath] = $viewRouter->setFilePathName($filePath['router'] ?? '')->isMake($isMake)->handle($tableName, [
             'route' => $routeName,
         ]);
         //生成前台接口
         $viewApi = app()->make(ViewApi::class);
-        [$apiContent, $apiPath] = $viewApi->setFilePathName($filePath['api'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$apiContent, $apiPath] = $viewApi->setFilePathName($filePath['api'] ?? '')->isMake($isMake)->handle($tableName, [
             'route' => $routeName,
         ]);
 
         //生成前台页面
         $viewPages = app()->make(ViewPages::class);
-        [$pagesContent, $pagesPath] = $viewPages->setFilePathName($filePath['pages'] ?? '')->isMake($isMake)->handle($tableName, '/', [
+        [$pagesContent, $pagesPath] = $viewPages->setFilePathName($filePath['pages'] ?? '')->isMake($isMake)->handle($tableName, [
             'field' => $options['columnField']
         ]);
 

+ 22 - 9
crmeb/app/services/system/config/SystemConfigServices.php

@@ -185,6 +185,7 @@ class SystemConfigServices extends BaseServices
     /**
      * SystemConfigServices constructor.
      * @param SystemConfigDao $dao
+     * @param FormBuilder $builder
      */
     public function __construct(SystemConfigDao $dao, FormBuilder $builder)
     {
@@ -192,6 +193,12 @@ class SystemConfigServices extends BaseServices
         $this->builder = $builder;
     }
 
+    /**
+     * @return array|int[]|string[]
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/04/12
+     */
     public function getSonConfig()
     {
         $sonConfig = [];
@@ -214,6 +221,7 @@ class SystemConfigServices extends BaseServices
      * @param string $configName
      * @param null $default
      * @return mixed|null
+     * @throws \ReflectionException
      */
     public function getConfigValue(string $configName, $default = null)
     {
@@ -225,6 +233,7 @@ class SystemConfigServices extends BaseServices
      * 获取全部配置
      * @param array $configName
      * @return array
+     * @throws \ReflectionException
      */
     public function getConfigAll(array $configName = [])
     {
@@ -575,14 +584,12 @@ class SystemConfigServices extends BaseServices
 
     /**
      * 获取系统配置表单
-     * @param int $id
-     * @param array $formData
+     * @param $data
+     * @param bool $control
+     * @param array $controle_two
      * @return array
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \FormBuilder\Exception\FormBuilderException
      */
-
     public function formTypeShine($data, $control = false, $controle_two = [])
     {
 
@@ -813,6 +820,7 @@ class SystemConfigServices extends BaseServices
 
     /**
      * 系统配置form表单创建
+     * @param $url
      * @param int $tabId
      * @return array
      * @throws \FormBuilder\Exception\FormBuilderException
@@ -982,6 +990,10 @@ class SystemConfigServices extends BaseServices
      * @param int $type
      * @param int $tab_id
      * @return array
+     * @throws \FormBuilder\Exception\FormBuilderException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
     public function createFormRule(int $type, int $tab_id): array
     {
@@ -1115,7 +1127,8 @@ class SystemConfigServices extends BaseServices
         }
     }
 
-    /**保存平台电子面单打印信息
+    /**
+     * 保存平台电子面单打印信息
      * @param array $data
      * @return bool
      */
@@ -1132,7 +1145,7 @@ class SystemConfigServices extends BaseServices
         foreach ($data as $key => $value) {
             $this->dao->update(['menu_name' => 'config_export_' . $key], ['value' => json_encode($value)]);
         }
-        \crmeb\services\CacheService::clear();
+        $this->cacheDriver()->clear();
         return true;
     }
 
@@ -1149,7 +1162,7 @@ class SystemConfigServices extends BaseServices
             if ($banner) {
                 $banner = array_column($banner, 'pic');
                 $this->dao->update(['menu_name' => 'spread_banner'], ['value' => json_encode($banner)]);
-                \crmeb\services\CacheService::clear();
+                $this->cacheDriver()->clear();
             }
         }
         return $banner;

+ 2 - 5
crmeb/app/services/yihaotong/SmsAdminServices.php

@@ -15,7 +15,6 @@ namespace app\services\yihaotong;
 use app\dao\system\config\SystemConfigDao;
 use app\services\BaseServices;
 use crmeb\exceptions\AdminException;
-use crmeb\services\CacheService;
 use crmeb\services\HttpService;
 use crmeb\services\sms\Sms;
 
@@ -47,7 +46,7 @@ class SmsAdminServices extends BaseServices
         return $this->transaction(function () use ($account, $password) {
             $this->dao->update('sms_account', ['value' => json_encode($account)], 'menu_name');
             $this->dao->update('sms_token', ['value' => json_encode($password)], 'menu_name');
-            CacheService::clear();
+            $this->cacheDriver()->clear();
         });
     }
 
@@ -70,7 +69,6 @@ class SmsAdminServices extends BaseServices
             throw new AdminException(400462, ['msg' => $status['msg']]);
         }
         $this->updateSmsConfig($account, $password);
-        CacheService::clear();
         return $status;
     }
 
@@ -120,8 +118,7 @@ class SmsAdminServices extends BaseServices
                         $sms->use($v['id'], $v['templateid']);
                 }
             }
-            CacheService::clear();
-            CacheService::set('sms_account', $account);
+            $this->cacheDriver()->set('sms_account', $account);
             return true;
         } else {
             return false;

+ 12 - 10
crmeb/crmeb/services/SystemConfigService.php

@@ -24,16 +24,17 @@ class SystemConfigService
 
     /**
      * 获取单个配置效率更高
-     * @param $key
-     * @param string $default
+     * @param string $key
+     * @param $default
      * @param bool $isCaChe 是否获取缓存配置
      * @return bool|mixed|string
      */
     public static function get(string $key, $default = '', bool $isCaChe = false)
     {
-        $callable = function () use ($key) {
-            /** @var SystemConfigServices $service */
-            $service = app()->make(SystemConfigServices::class);
+        /** @var SystemConfigServices $service */
+        $service = app()->make(SystemConfigServices::class);
+
+        $callable = function () use ($service, $key) {
             return $service->getConfigValue($key);
         };
 
@@ -41,7 +42,7 @@ class SystemConfigService
             if ($isCaChe) {
                 return $callable();
             }
-            return CacheService::remember(self::CACHE_SYSTEM . ':' . $key, $callable);
+            return $service->cacheDriver()->remember(self::CACHE_SYSTEM . ':' . $key, $callable);
         } catch (\Throwable $e) {
             return $default;
         }
@@ -55,16 +56,17 @@ class SystemConfigService
      */
     public static function more(array $keys, bool $isCaChe = false)
     {
-        $callable = function () use ($keys) {
-            /** @var SystemConfigServices $service */
-            $service = app()->make(SystemConfigServices::class);
+        /** @var SystemConfigServices $service */
+        $service = app()->make(SystemConfigServices::class);
+
+        $callable = function () use ($service, $keys) {
             return Arr::getDefaultValue($keys, $service->getConfigAll($keys));
         };
         try {
             if ($isCaChe)
                 return $callable();
 
-            return CacheService::remember(self::CACHE_SYSTEM . ':' . md5(implode(',', $keys)), $callable);
+            return $service->cacheDriver()->remember(self::CACHE_SYSTEM . ':' . md5(implode(',', $keys)), $callable);
         } catch (\Throwable $e) {
             return Arr::getDefaultValue($keys);
         }

+ 3 - 2
crmeb/crmeb/services/crud/Controller.php

@@ -49,8 +49,9 @@ class Controller extends Make
      * @email 136327134@qq.com
      * @date 2023/3/13
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
+        $path = $options['path'] ?? '';
         $contentPhp = '';
         $var = ["{%date%}"];
         $fieldPhp = [$this->value['date']];
@@ -98,7 +99,7 @@ class Controller extends Make
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
 
     /**

+ 13 - 11
crmeb/crmeb/services/crud/Make.php

@@ -219,9 +219,9 @@ abstract class Make
      * @email 136327134@qq.com
      * @date 2023/3/13
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
-
+        $path = $options['path'] ?? '';
         [$nameData, $content] = $this->getStubContent($name);
 
         $this->value['name'] = $nameData;
@@ -236,7 +236,7 @@ abstract class Make
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
 
     /**
@@ -343,14 +343,15 @@ abstract class Make
      */
     protected function getfolderPath(string $path)
     {
+        $path = $path ?: $this->filePathName;
+        $path = str_replace([$this->basePath, $this->baseDir], '', $path);
         $path = ltrim(str_replace('\\', '/', $path), '/');
         $pathArr = explode('/', $path);
-        $count = count($pathArr);
-        $res = $pathArr[$count - 1] ?? null;
-        if ($pathArr && $res && $res == $this->name) {
-            return '';
+        array_pop($pathArr);
+        if ($pathArr) {
+            return '\\' . implode('\\', $pathArr);
         } else {
-            return '\\' . $res;
+            return '';
         }
     }
 
@@ -421,14 +422,15 @@ abstract class Make
 
         $pathname = $this->filePathName ?: $pathname;
 
-        if (is_file($pathname)) {
-            throw new CrudException($this->name . ':' . $pathname . ' already exists!');
-        }
 
         $content = str_replace('', '', $content);
 
         if ($this->isMake) {
 
+            if (is_file($pathname)) {
+                throw new CrudException($this->name . ':' . $pathname . ' already exists!');
+            }
+            
             try {
                 if (!is_dir(dirname($pathname))) {
                     mkdir(dirname($pathname), 0755, true);

+ 7 - 0
crmeb/crmeb/services/crud/Model.php

@@ -40,6 +40,13 @@ class Model extends Make
         return 'app' . DS . 'model' . DS . 'crud';
     }
 
+    protected function getFilePathName(string $path, string $name): string
+    {
+        $path = ltrim(str_replace('\\', '/', $path), '/');
+
+        return $this->getBasePath($path) . $name . '.' . $this->fileMime;
+    }
+
     /**
      * 模板文件
      * @param string $type

+ 8 - 8
crmeb/crmeb/services/crud/Route.php

@@ -36,12 +36,12 @@ class Route extends Make
 
     /**
      * @param string $name
-     * @param string $path
      * @param array $options
      * @return mixed|void
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
+        $path = $options['path'] ?? '';
         $action = $options['action'] ?? [];
         $route = $options['route'] ?? '';
         $controller = $options['controller'] ?? '';
@@ -67,14 +67,14 @@ class Route extends Make
 
         $routeContent = "";
         foreach ($action as $item) {
-            $routeContent .= $this->getStub($item) . "\r\n";
+            $routeContent .= file_get_contents($this->getStub($item)) . "\r\n";
         }
 
         if ($var && $value) {
             $routeContent = str_replace($var, $value, $routeContent);
         }
 
-        $content = $this->getStub();
+        $content = file_get_contents($this->getStub());
 
         $this->value['content-php'] = $routeContent;
 
@@ -82,16 +82,16 @@ class Route extends Make
 
         $filePath = $this->getFilePathName($path, strtolower($name));
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
 
     /**
-     * @author 等风来
-     * @email 136327134@qq.com
-     * @date 2023/4/11
      * @param string $path
      * @param string $name
      * @return string
+     * @author 等风来
+     * @email 136327134@qq.com
+     * @date 2023/4/11
      */
     protected function getFilePathName(string $path, string $name): string
     {

+ 3 - 3
crmeb/crmeb/services/crud/Service.php

@@ -36,15 +36,15 @@ class Service extends Make
 
     /**
      * @param string $name
-     * @param string $path
      * @param array $options
      * @return mixed|void
      * @author 等风来
      * @email 136327134@qq.com
      * @date 2023/3/23
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
+        $path = $options['path'] ?? '';
 
         $this->value['use-php'] = $this->getDaoClassName($name, $path);
 
@@ -92,7 +92,7 @@ class Service extends Make
 
         $filePath = $this->getFilePathName($path, $this->value['nameCamel']);
 
-        return [$this->makeFile($filePath, $contentStr), $filePath];
+        return [$this->makeFile($filePath, $contentStr), $this->filePathName ?: $filePath];
     }
 
     /**

+ 3 - 4
crmeb/crmeb/services/crud/ViewApi.php

@@ -60,16 +60,15 @@ class ViewApi extends Make
 
     /**
      * @param string $name
-     * @param string $path
      * @param array $options
      * @return array
      * @author 等风来
      * @email 136327134@qq.com
      * @date 2023/4/4
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
-
+        $path = $options['path'] ?? '';
         $action = $options['action'] ?? [];
         if (!$action) {
             $action = ['index', 'create', 'save', 'edit', 'update'];
@@ -103,7 +102,7 @@ class ViewApi extends Make
 
         $content = $this->makeFile($filePath, $contentStr);
 
-        return [$content, $filePath];
+        return [$content, $this->filePathName ?: $filePath];
     }
 
     /**

+ 3 - 3
crmeb/crmeb/services/crud/ViewPages.php

@@ -66,20 +66,20 @@ class ViewPages extends Make
      * @email 136327134@qq.com
      * @date 2023/4/3
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
         $field = $options['field'] ?? [];
 
         $columnStr = [];
         foreach ($field as $item) {
-            $columnStr[] = "{\n\"title:\"{$item['name']},\n\"key:\"{$item['field']}\n}";
+            $columnStr[] = $this->tab() . "{\ntitle:\"{$item['name']}\",\nkey:\"{$item['field']}\"\n}";
         }
         $this->value['auth'] = Str::snake($name);
         $this->value['content-vue'] = "\n" . implode(',', $columnStr);
         $this->value['pathApiJs'] = $options['pathApiJs'] ?? '';
         $this->value['nameCamel'] = Str::snake($name, '-');
 
-        return parent::handle($name, $path, $options);
+        return parent::handle($name, $options);
     }
 
     /**

+ 2 - 1
crmeb/crmeb/services/crud/ViewRouter.php

@@ -66,8 +66,9 @@ class ViewRouter extends Make
      * @email 136327134@qq.com
      * @date 2023/4/4
      */
-    public function handle(string $name, string $path, array $options = [])
+    public function handle(string $name, array $options = [])
     {
+        $path = $options['path'] ?? '';
         [$nameData, $content] = $this->getStubContent($name);
 
         $menus = $options['menus'] ?? $name;

+ 2 - 2
crmeb/crmeb/services/crud/stubs/controller/CrudController.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  */
 
-namespace app\adminapi\controller\v1{%path%};
+namespace app\adminapi\controller\crud{%path%};
 
 use app\adminapi\controller\AuthController;
 use think\facade\App;
@@ -24,7 +24,7 @@ use think\facade\App;
 /**
  * Class {%nameCamel%}
  * @date {%date%}
- * @package app\adminapi\controller\v1{%path%}
+ * @package app\adminapi\controller\crud{%path%}
  */
 class {%nameCamel%} extends AuthController
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/dao/CrudDao.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  */
 
-namespace app\dao{%path%};
+namespace app\dao\crub{%path%};
 
 
 use app\dao\BaseDao;
@@ -24,7 +24,7 @@ use app\dao\BaseDao;
 /**
  * Class {%nameCamel%}Dao
  * @date {%date%}
- * @package app\dao{%path%}
+ * @package app\dao\crub{%path%}
  */
 class {%nameCamel%}Dao extends BaseDao
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/model/CrudModel.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  */
 
-namespace app\model{%path%};
+namespace app\model\crud{%path%};
 
 
 use crmeb\basic\BaseModel;
@@ -24,7 +24,7 @@ use crmeb\basic\BaseModel;
 /**
  * Class {%nameCamel%}
  * @date {%date%}
- * @package app\model{%path%}
+ * @package app\model\crud{%path%}
  */
 class {%nameCamel%} extends BaseModel
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/service/CrudService.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  */
 
-namespace app\services{%path%};
+namespace app\services\crub{%path%};
 
 use app\services\BaseServices;
 use think\exception\ValidateException;
@@ -25,7 +25,7 @@ use think\exception\ValidateException;
 /**
  * Class CrudService
  * @date {%date%}
- * @package app\services{%path%}
+ * @package app\services\crub{%path%}
  */
 class {%nameCamel%}Service extends BaseServices
 {

+ 2 - 2
crmeb/crmeb/services/crud/stubs/validate/crudValidate.stub

@@ -16,7 +16,7 @@
  * @date {%time%}
  */
 
-namespace app\adminapi\validate{%path%};
+namespace app\adminapi\validate\crub{%path%};
 
 
 use think\Validate;
@@ -24,7 +24,7 @@ use think\Validate;
 /**
  * Class CrudValidate
  * @date {%date%}
- * @package app\adminapi\validate{%path%}
+ * @package app\adminapi\validate\crub{%path%}
  */
 class {%nameCamel%}Validate extends Validate
 {

+ 2 - 2
crmeb/crmeb/services/upload/storage/Local.php

@@ -313,7 +313,7 @@ class Local extends BaseUpload
         $savePath = public_path() . $filePath;
         try {
             $Image = Image::open(app()->getRootPath() . 'public' . $filePath);
-            $Image->water($watermark_image, $waterConfig['watermark_position'] ?: 1, $waterConfig['watermark_opacity'])->save($savePath);
+            $Image->water($watermark_image, $waterConfig['watermark_position'] ?: 1, (int)$waterConfig['watermark_opacity'])->save($savePath);
         } catch (\Throwable $e) {
             throw new AdminException($e->getMessage());
         }
@@ -344,7 +344,7 @@ class Local extends BaseUpload
             if (strlen($waterConfig['watermark_text_color']) > 7) {
                 $waterConfig['watermark_text_color'] = substr($waterConfig['watermark_text_color'], 0, 7);
             }
-            $Image->text($waterConfig['watermark_text'], $waterConfig['watermark_text_font'], $waterConfig['watermark_text_size'], $waterConfig['watermark_text_color'], $waterConfig['watermark_position'], [$waterConfig['watermark_x'], $waterConfig['watermark_y'], $waterConfig['watermark_text_angle']])->save($savePath);
+            $Image->text($waterConfig['watermark_text'], $waterConfig['watermark_text_font'], (float)$waterConfig['watermark_text_size'], $waterConfig['watermark_text_color'], $waterConfig['watermark_position'], [$waterConfig['watermark_x'], $waterConfig['watermark_y'], $waterConfig['watermark_text_angle']])->save($savePath);
         } catch (\Throwable $e) {
             throw new AdminException($e->getMessage() . $e->getLine());
         }

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
crmeb/public/install/.env


Разлика између датотеке није приказан због своје велике величине
+ 24359 - 8
crmeb/public/install/crmeb.sql


+ 0 - 5
crmeb/vendor/overtrue/wechat/src/Staff/Staff.php

@@ -105,11 +105,6 @@ class Staff extends AbstractAPI
      */
     public function delete($account)
     {
-        // XXX: 微信那帮搞技术的都 TM 是 SB,url上的文本居然不 TM urlencode,
-        // 这里客服账号因为有 @ 符,而微信不接收urlencode的账号。。
-        // 简直是日了...
-        // #222
-        // PS: 如果你是微信做接口的,奉劝你们,尊重技术,不会别乱搞,笨不是你们的错,你们出来坑人就是大错特错。
         $accessTokenField = sprintf('%s=%s', $this->accessToken->getQueryName(), $this->accessToken->getToken());
         $url = sprintf(self::API_DELETE.'?%s&kf_account=%s', $accessTokenField, $account);