From d263241445ddbb8e947e2e9a386ef8ab520df300 Mon Sep 17 00:00:00 2001
From: evoxwht <442384644@qq.com>
Date: Sat, 15 Apr 2023 11:05:57 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E5=BC=80=E5=90=AF=E9=98=9F=E5=88=97?=
=?UTF-8?q?=E5=90=8E=E9=87=87=E9=9B=86=E5=95=86=E5=93=81=E7=9A=84=E5=9B=BE?=
=?UTF-8?q?=E7=89=87=E4=B8=8B=E8=BD=BD=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
crmeb/app/jobs/ProductCopyJob.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/crmeb/app/jobs/ProductCopyJob.php b/crmeb/app/jobs/ProductCopyJob.php
index 8941bbc59..14ef48cc8 100644
--- a/crmeb/app/jobs/ProductCopyJob.php
+++ b/crmeb/app/jobs/ProductCopyJob.php
@@ -48,7 +48,7 @@ class ProductCopyJob extends BaseJobs
$d_image = 'http://' . ltrim($image, '\//');
}
$description_cache = CacheService::get('desc_images_' . $id);
- if ($description_cache === null) {
+ if ($description_cache === null || $description_cache === '') {
$description_cache = $description;
CacheService::set('desc_images_count' . $id, 0);
}
@@ -64,7 +64,7 @@ class ProductCopyJob extends BaseJobs
CacheService::set('desc_images_count' . $id, $desc_count);
}
} catch (\Throwable $e) {
- Log::error('下载商品详情图片失败,失败原因:' . $e->getMessage());
+ Log::error('下载商品详情图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
}
return true;
}
@@ -86,9 +86,9 @@ class ProductCopyJob extends BaseJobs
//下载图片
$res = $copyTaobao->downloadCopyImage($image);
//获取缓存中的轮播图
- $slider_images = CacheService::get('slider_images_' . $id);
+ $slider_images = CacheService::get('slider_images_' . $id) ?? [];
//缓存为null则赋值[]
- if ($slider_images === null) $slider_images = [];
+ if ($slider_images === null || $slider_images === '') $slider_images = [];
//将下载的图片插入数组
array_push($slider_images, $res);
//如果$slider_images中图片数量和传入的$count相等,说明已经下载完成,写入商品表,如果不等则继续插入缓存
@@ -102,7 +102,7 @@ class ProductCopyJob extends BaseJobs
CacheService::set('slider_images_' . $id, $slider_images);
}
} catch (\Throwable $e) {
- Log::error('下载商品轮播图片失败,失败原因:' . $e->getMessage());
+ Log::error('下载商品轮播图片失败,失败原因:' . $e->getMessage() . '_' . $e->getFile() . '_' . $e->getLine());
}
return true;
}
From 86d1a791f1d685b0ebc6efd1a8213155f19e7a99 Mon Sep 17 00:00:00 2001
From: evoxwht <442384644@qq.com>
Date: Sat, 15 Apr 2023 11:06:25 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=86=E9=94=80?=
=?UTF-8?q?=E7=AD=89=E7=BA=A7=E9=A1=B5=E9=9D=A2=E4=B8=8B=E6=96=B9=E6=8E=A8?=
=?UTF-8?q?=E8=8D=90=E5=95=86=E5=93=81=E5=9B=BE=E7=89=87=E5=88=B7=E6=96=B0?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../users/user_distribution_level/index.vue | 1196 +++++++++--------
1 file changed, 602 insertions(+), 594 deletions(-)
diff --git a/template/uni-app/pages/users/user_distribution_level/index.vue b/template/uni-app/pages/users/user_distribution_level/index.vue
index a21ac9299..9602d00e9 100644
--- a/template/uni-app/pages/users/user_distribution_level/index.vue
+++ b/template/uni-app/pages/users/user_distribution_level/index.vue
@@ -1,595 +1,603 @@
-
-
-
-
-
-
-
-
-
-
-
- {{$t(`快速升级技巧`)}}
-
-
-
-
- {{ taskNum }}
-
-
- /{{ task.length}}
-
-
-
-
-
-
-
-
- {{$t(item.name)}}
-
-
-
- {{item.finish?$t(`已完成`):$t(`未完成`)}}
-
-
-
-
-
- {{item.finish ? '' : $t(item.task_type_title)}}
-
- {{item.new_number}}
- /{{item.number}}
-
-
-
-
-
-
-
-
-
- {{illustrate}}
-
-
-
-
-
-
-
-
-
From 3ad1b8f0467718f49449d1ec8c2380dc47e27c96 Mon Sep 17 00:00:00 2001
From: liaofei <136327134@qq.com>
Date: Sat, 15 Apr 2023 12:06:45 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8B=E8=BD=BD?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
.../controller/v1/setting/SystemCrud.php | 97 ++++++++++++++++---
crmeb/app/adminapi/route/system.php | 6 +-
.../services/system/SystemCrudServices.php | 3 +-
crmeb/crmeb/services/FileService.php | 6 +-
crmeb/crmeb/services/crud/Make.php | 76 ++++++++++++---
6 files changed, 155 insertions(+), 34 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8295ea5c7..fce675338 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@
/template/uni-app/unpackage/
/template/uni-app/.hbuilderx/
crmeb/.idea/
+crmeb/backup/
diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
index f22f1895d..e0a294ed7 100644
--- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
+++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
@@ -17,6 +17,7 @@ namespace app\adminapi\controller\v1\setting;
use app\adminapi\controller\AuthController;
use app\services\system\SystemCrudServices;
use app\services\system\SystemMenusServices;
+use crmeb\services\CacheService;
use crmeb\services\crud\Make;
use crmeb\services\FileService;
use crmeb\utils\Terminal;
@@ -290,6 +291,79 @@ class SystemCrud extends AuthController
return app('json')->success('删除成功');
}
+ /**
+ * 下载文件
+ * @param $id
+ * @return Response
+ * @author 等风来
+ * @email 136327134@qq.com
+ * @date 2023/4/15
+ */
+ public function download($id)
+ {
+ if (!$id) {
+ return app('json')->fail('缺少参数');
+ }
+
+ $info = $this->services->get($id);
+ if (!$info) {
+ return app('json')->fail('下载的文件不存在');
+ }
+ $zipPath = app()->getRootPath() . 'backup' . DS . Str::camel($info->table_name);
+ $zipName = app()->getRootPath() . 'backup' . DS . Str::camel($info->table_name) . '.zip';
+ $makePath = $info->make_path ?? [];
+ foreach ($makePath as $key => $item) {
+ if (in_array($key, ['pages', 'router', 'api'])) {
+ $item = $zipPath . str_replace(dirname(app()->getRootPath()), '', Make::adminTemplatePath()) . $item;
+ } else {
+ $item = $zipPath . DS . $item;
+ }
+ $makePath[$key] = $item;
+ }
+
+ $routeName = 'crud/' . Str::snake($info->table_name);
+
+ $column = $this->services->getColumnNamesList($info->table_name);
+ $key = 'id';
+ foreach ($column as $value) {
+ if ($value['primaryKey']) {
+ $key = $value['name'];
+ break;
+ }
+ }
+
+ $softDelete = false;
+
+ foreach ((array)$info->field['tableField'] as $item) {
+ if (isset($item['field_type']) && $item['field_type'] === 'addSoftDelete') {
+ $softDelete = true;
+ break;
+ }
+ }
+
+ $this->services->makeFile($info->table_name, $routeName, true, [
+ 'menuName' => $info->name,
+ 'key' => $key,
+ 'softDelete' => $softDelete,
+ 'fromField' => $info->field['fromField'] ?? [],
+ 'columnField' => $info->field['columnField'] ?? [],
+ ], $makePath);
+
+ if (!extension_loaded('zip')) {
+ return app('json')->fail('请安装zip扩展后在尝试下载');
+ }
+
+ $fileService = new FileService();
+ $fileService->addZip($zipPath, $zipName, app()->getRootPath() . 'backup');
+
+ $key = md5($zipName);
+ CacheService::set($key, [
+ 'path' => $zipName,
+ 'fileName' => Str::camel($info->table_name) . '.zip'
+ ]);
+ return app()->success(['download_url' => sys_config('site_url') . '/adminapi/download/' . $key]);
+ }
+
/**
* @return string
* @author 等风来
@@ -304,26 +378,27 @@ class SystemCrud extends AuthController
$adminPath = dirname($adminPath);
- $dir = $adminPath . DS . 'node_modules';
- if (!is_dir($dir)) {
- $terminal->run('npm-install');
+ try {
+ $dir = $adminPath . DS . 'node_modules';
+ if (!is_dir($dir)) {
+// $terminal->run('npm-install');
+ }
+
+// $res = $terminal->run('npm-build');
+ } catch (\Throwable $e) {
+ $terminal->echoOutputFlag($e->getMessage());
}
- $terminal->run('npm-build');
-
if (!is_dir($adminPath . DS . 'dist')) {
- return Response::create([
+ echo Response::create([
'message' => '打包失败',
], 'json')->getContent();
}
$build = public_path() . config('app.admin_prefix');
- $this->app->make(FileService::class)->copyDir($adminPath . DS . 'dist', $build);
+// $this->app->make(FileService::class)->copyDir($adminPath . DS . 'dist', $build);
- return Response::create([
- 'message' => '打包成功',
- 'success' => 'ok'
- ], 'json')->getContent();
+// echo $res;
}
}
diff --git a/crmeb/app/adminapi/route/system.php b/crmeb/app/adminapi/route/system.php
index 77abb7dbb..b14441d89 100644
--- a/crmeb/app/adminapi/route/system.php
+++ b/crmeb/app/adminapi/route/system.php
@@ -8,8 +8,8 @@
// +----------------------------------------------------------------------
// | Author: CRMEB Team
// +----------------------------------------------------------------------
-use think\facade\Route;
+use think\facade\Route;
/**
* 维护 相关路由
@@ -133,8 +133,8 @@ Route::group('system', function () {
'delete' => '删除路由分类'
],
]);
- //执行重新打包
- Route::get('crud/npm', 'v1.setting.SystemCrud/npm')->option(['real_name' => '执行重新打包']);
+ //下载生成的文件
+ Route::get('crud/download', 'v1.setting.SystemCrud/download')->option(['real_name' => '下载生成的文件']);
//获取CRUD列表
Route::get('crud/column_type', 'v1.setting.SystemCrud/columnType')->option(['real_name' => '获取CRUD列表']);
//获取菜单TREE形数据
diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php
index afa802c1e..b3ce21e0f 100644
--- a/crmeb/app/services/system/SystemCrudServices.php
+++ b/crmeb/app/services/system/SystemCrudServices.php
@@ -369,7 +369,7 @@ class SystemCrudServices extends BaseServices
$menuIds = array_column($menus->toArray(), 'id');
array_push($menuIds, $menuInfo->id);
//生成文件
- $make = $this->makeFile($tableName, $routeName, true, $data, $filePath);
+ $make = $this->makeFile($tableName, $routeName, false, $data, $filePath);
$makePath = [];
foreach ($make as $key => $item) {
$makePath[$key] = $item['path'];
@@ -555,7 +555,6 @@ class SystemCrudServices extends BaseServices
[$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, [
diff --git a/crmeb/crmeb/services/FileService.php b/crmeb/crmeb/services/FileService.php
index 47b979b59..7b0a5d8bc 100644
--- a/crmeb/crmeb/services/FileService.php
+++ b/crmeb/crmeb/services/FileService.php
@@ -1018,9 +1018,11 @@ class FileService
$file = str_replace('\\', '/', $file);
if (in_array(substr($file, strrpos($file, '/') + 1), array('.', '..'))) continue;
if (is_dir($file) === true) {
- $zip->addEmptyDir(str_replace($folder . '/', '', $file . '/'));
+ $fileName = $folder ? str_replace($folder . '/', '', $file . '/') : $file . '/';
+ $zip->addEmptyDir($fileName);
} else if (is_file($file) === true) {
- $zip->addFromString(str_replace($folder . '/', '', $file), file_get_contents($file));
+ $fileName = $folder ? str_replace($folder . '/', '', $file) : $file;
+ $zip->addFromString($fileName, file_get_contents($file));
}
}
} else if (is_file($source) === true) {
diff --git a/crmeb/crmeb/services/crud/Make.php b/crmeb/crmeb/services/crud/Make.php
index 740ab0e08..5dd8752dd 100644
--- a/crmeb/crmeb/services/crud/Make.php
+++ b/crmeb/crmeb/services/crud/Make.php
@@ -51,6 +51,18 @@ abstract class Make
*/
protected $fileBasePath;
+ /**
+ * 文件内容
+ * @var string
+ */
+ protected $content = '';
+
+ /**
+ * 文件存放
+ * @var null
+ */
+ protected $filePath = null;
+
/**
* 变量名称
* @var array
@@ -68,6 +80,12 @@ abstract class Make
*/
protected $isMake = true;
+ /**
+ * 文件存在是否生成
+ * @var bool
+ */
+ protected $isExistsMake = true;
+
/**
* 后台前端模板根路径
* @var string
@@ -416,25 +434,19 @@ abstract class Make
return 'app' . ($app ? '\\' . $app : '');
}
- /**
- * 执行创建文件
- * @return string
- * @author 等风来
- * @email 136327134@qq.com
- * @date 2023/3/13
- */
- protected function makeFile(string $pathname, string $content)
+
+ public function make(string $pathname)
{
-
- $pathname = $this->filePathName ?: $pathname;
-
-
- $content = str_replace('', '', $content);
+ $pathname = $this->filePathName ?: ($this->filePath ?: $pathname);
if ($this->isMake) {
if (is_file($pathname)) {
- throw new CrudException($this->name . ':' . $pathname . ' already exists!');
+ if ($this->isExistsMake) {
+ unlink($pathname);
+ } else {
+ throw new CrudException($this->name . ':' . $pathname . ' already exists!');
+ }
}
try {
@@ -446,12 +458,44 @@ abstract class Make
}
try {
- file_put_contents($pathname, $content);
+ file_put_contents($pathname, $this->content);
} catch (\Throwable $e) {
throw new CrudException('CRUD生成文件报错,无法写入:' . $pathname);
}
}
+ }
- return $content;
+ /**
+ * 设置内容
+ * @param string $content
+ * @return array|string|string[]
+ * @author 等风来
+ * @email 136327134@qq.com
+ * @date 2023/4/14
+ */
+ protected function setContent(string $content)
+ {
+ $this->content = str_replace('', '', $content);
+
+ return $this->content;
+ }
+
+ /**
+ * 执行创建文件
+ * @return string
+ * @author 等风来
+ * @email 136327134@qq.com
+ * @date 2023/3/13
+ */
+ protected function makeFile(string $pathname, string $content)
+ {
+ $this->content = str_replace('', '', $content);
+ $this->make($pathname);
+ return $this->content;
+ }
+
+ public function __destruct()
+ {
+ $this->content = '';
}
}
From 320fd996370631c5d41ea17c387bf55faec06823 Mon Sep 17 00:00:00 2001
From: liaofei <136327134@qq.com>
Date: Sat, 15 Apr 2023 12:17:07 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=93=E5=AD=98?=
=?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
crmeb/app/adminapi/controller/v1/setting/SystemCrud.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
index e0a294ed7..9668317c8 100644
--- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
+++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
@@ -359,8 +359,8 @@ class SystemCrud extends AuthController
$key = md5($zipName);
CacheService::set($key, [
'path' => $zipName,
- 'fileName' => Str::camel($info->table_name) . '.zip'
- ]);
+ 'fileName' => Str::camel($info->table_name) . '.zip',
+ ], 300);
return app()->success(['download_url' => sys_config('site_url') . '/adminapi/download/' . $key]);
}
From 65ddd7a3607fb30a1cd66d24f6e0a8c50783f6f1 Mon Sep 17 00:00:00 2001
From: liaofei <136327134@qq.com>
Date: Sat, 15 Apr 2023 14:14:09 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../adminapi/controller/v1/setting/SystemCrud.php | 5 ++++-
.../adminapi/controller/v1/setting/SystemRoute.php | 2 +-
crmeb/app/adminapi/route/system.php | 2 +-
crmeb/app/dao/BaseDao.php | 14 ++++++++++++++
crmeb/app/services/system/SystemCrudServices.php | 2 +-
crmeb/config/app.php | 4 ++++
.../services/crud/stubs/controller/delete.stub | 2 +-
7 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
index 9668317c8..1fd145b83 100644
--- a/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
+++ b/crmeb/app/adminapi/controller/v1/setting/SystemCrud.php
@@ -311,6 +311,9 @@ class SystemCrud extends AuthController
}
$zipPath = app()->getRootPath() . 'backup' . DS . Str::camel($info->table_name);
$zipName = app()->getRootPath() . 'backup' . DS . Str::camel($info->table_name) . '.zip';
+ if (is_file($zipName)) {
+ unlink($zipName);
+ }
$makePath = $info->make_path ?? [];
foreach ($makePath as $key => $item) {
if (in_array($key, ['pages', 'router', 'api'])) {
@@ -361,7 +364,7 @@ class SystemCrud extends AuthController
'path' => $zipName,
'fileName' => Str::camel($info->table_name) . '.zip',
], 300);
- return app()->success(['download_url' => sys_config('site_url') . '/adminapi/download/' . $key]);
+ return app('json')->success(['download_url' => sys_config('site_url') . '/adminapi/download/' . $key]);
}
/**
diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemRoute.php b/crmeb/app/adminapi/controller/v1/setting/SystemRoute.php
index ef3488c56..9e9eb4ee3 100644
--- a/crmeb/app/adminapi/controller/v1/setting/SystemRoute.php
+++ b/crmeb/app/adminapi/controller/v1/setting/SystemRoute.php
@@ -158,7 +158,7 @@ class SystemRoute extends AuthController
return app('json')->fail('缺少参数');
}
- $this->services->delete($id);
+ $this->services->destroy($id);
return app('json')->success('删除成功');
}
diff --git a/crmeb/app/adminapi/route/system.php b/crmeb/app/adminapi/route/system.php
index b14441d89..75158915a 100644
--- a/crmeb/app/adminapi/route/system.php
+++ b/crmeb/app/adminapi/route/system.php
@@ -134,7 +134,7 @@ Route::group('system', function () {
],
]);
//下载生成的文件
- Route::get('crud/download', 'v1.setting.SystemCrud/download')->option(['real_name' => '下载生成的文件']);
+ Route::get('crud/download/:id', 'v1.setting.SystemCrud/download')->option(['real_name' => '下载生成的文件']);
//获取CRUD列表
Route::get('crud/column_type', 'v1.setting.SystemCrud/columnType')->option(['real_name' => '获取CRUD列表']);
//获取菜单TREE形数据
diff --git a/crmeb/app/dao/BaseDao.php b/crmeb/app/dao/BaseDao.php
index 0379a78aa..343118314 100644
--- a/crmeb/app/dao/BaseDao.php
+++ b/crmeb/app/dao/BaseDao.php
@@ -253,6 +253,20 @@ abstract class BaseDao
return $this->getModel()->where($where)->delete();
}
+ /**
+ * 删除记录
+ * @param int $id
+ * @param bool $force
+ * @return bool
+ * @author 等风来
+ * @email 136327134@qq.com
+ * @date 2023/4/15
+ */
+ public function destroy(int $id, bool $force = false)
+ {
+ return $this->getModel()->destroy($id, $force);
+ }
+
/**
* 更新数据
* @param int|string|array $id
diff --git a/crmeb/app/services/system/SystemCrudServices.php b/crmeb/app/services/system/SystemCrudServices.php
index b3ce21e0f..fb735e3b5 100644
--- a/crmeb/app/services/system/SystemCrudServices.php
+++ b/crmeb/app/services/system/SystemCrudServices.php
@@ -369,7 +369,7 @@ class SystemCrudServices extends BaseServices
$menuIds = array_column($menus->toArray(), 'id');
array_push($menuIds, $menuInfo->id);
//生成文件
- $make = $this->makeFile($tableName, $routeName, false, $data, $filePath);
+ $make = $this->makeFile($tableName, $routeName, config('app.crud_make', false), $data, $filePath);
$makePath = [];
foreach ($make as $key => $item) {
$makePath[$key] = $item['path'];
diff --git a/crmeb/config/app.php b/crmeb/config/app.php
index d132a1df2..09848e994 100644
--- a/crmeb/config/app.php
+++ b/crmeb/config/app.php
@@ -14,7 +14,9 @@
// +----------------------------------------------------------------------
use think\facade\Env;
+
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
+
return [
// 应用地址
'app_host' => Env::get('app.host', ''),
@@ -50,4 +52,6 @@ return [
'admin_prefix' => 'admin',
//后台前端模板根路径
'admin_template_path' => dirname(app()->getRootPath()) . DS . 'template' . DS . 'admin' . DS . 'src' . DS,
+ //在保存crud的是否是否直接生成文件
+ 'crud_make' => false
];
diff --git a/crmeb/crmeb/services/crud/stubs/controller/delete.stub b/crmeb/crmeb/services/crud/stubs/controller/delete.stub
index c73cb4d73..293b74fbb 100644
--- a/crmeb/crmeb/services/crud/stubs/controller/delete.stub
+++ b/crmeb/crmeb/services/crud/stubs/controller/delete.stub
@@ -10,7 +10,7 @@
return app('json')->fail(100100);
}
- if ($this->service->delete($id)) {
+ if ($this->service->destroy($id)) {
return app('json')->success(100002);
} else {
return app('json')->success(100008);
From d338e54375902a4c230d07467e5bf82de296ea55 Mon Sep 17 00:00:00 2001
From: liaofei <136327134@qq.com>
Date: Sat, 15 Apr 2023 14:50:22 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E6=96=B0=E5=A2=9EBUG?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../app/adminapi/controller/v1/setting/SystemMenus.php | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php
index 08125597f..93db4b4a8 100644
--- a/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php
+++ b/crmeb/app/adminapi/controller/v1/setting/SystemMenus.php
@@ -50,13 +50,13 @@ class SystemMenus extends AuthController
}
/**
- * @author 等风来
- * @email 136327134@qq.com
- * @date 2023/4/14
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
+ * @author 等风来
+ * @email 136327134@qq.com
+ * @date 2023/4/14
*/
public function unique()
{
@@ -139,6 +139,8 @@ class SystemMenus extends AuthController
'unique_auth' => $menu['unique_auth'] ?? '',
'api_url' => $menu['api_url'],
'pid' => $menu['path'],
+ 'auth_type' => 2,
+ 'is_show' => 0,
];
}
@@ -277,7 +279,7 @@ class SystemMenus extends AuthController
if ($menuApiList) $menuApiList = array_column($menuApiList, 'rule');
$list = [];
foreach ($ruleList as $item) {
- if (!in_array($item['path'] . '_' . strtolower($item['method']), $menuApiList)) {
+ if ($item['type'] || !in_array($item['path'] . '_' . strtolower($item['method']), $menuApiList)) {
$item['real_name'] = $item['name'] ?? '';
$item['method'] = strtoupper($item['method']);
$list[] = $item;