mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-02 07:50:37 +00:00
修复删除问题
This commit is contained in:
parent
320fd99637
commit
65ddd7a360
@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -158,7 +158,7 @@ class SystemRoute extends AuthController
|
||||
return app('json')->fail('缺少参数');
|
||||
}
|
||||
|
||||
$this->services->delete($id);
|
||||
$this->services->destroy($id);
|
||||
|
||||
return app('json')->success('删除成功');
|
||||
}
|
||||
|
||||
@ -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形数据
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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'];
|
||||
|
||||
@ -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
|
||||
];
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user