mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 14:01:07 +00:00
【程序目录】更新验证路径
This commit is contained in:
parent
08a1821b26
commit
101cb0b247
@ -64,6 +64,28 @@ class SystemCrud extends AuthController
|
||||
return app('json')->success($this->services->getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证路径
|
||||
* @param $data
|
||||
* @return bool
|
||||
* @author wuhaotian
|
||||
* @email 442384644@qq.com
|
||||
* @date 2024/2/19
|
||||
*/
|
||||
public function crudVerifyPath($data)
|
||||
{
|
||||
if (strpos($data['controller'], 'app/adminapi/controller/crud/') !== 0) return false;
|
||||
if (strpos($data['validate'], 'app/adminapi/validate/crud/') !== 0) return false;
|
||||
if (strpos($data['service'], 'app/services/crud/') !== 0) return false;
|
||||
if (strpos($data['dao'], 'app/dao/crud/') !== 0) return false;
|
||||
if (strpos($data['model'], 'app/model/crud/') !== 0) return false;
|
||||
if (strpos($data['route'], 'app/adminapi/route/crud/') !== 0) return false;
|
||||
if (strpos($data['router'], 'router/modules/crud/') !== 0) return false;
|
||||
if (strpos($data['api'], 'api/crud/') !== 0) return false;
|
||||
if (strpos($data['pages'], 'pages/crud/') !== 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response
|
||||
* @author 等风来
|
||||
@ -88,6 +110,7 @@ class SystemCrud extends AuthController
|
||||
if (!preg_match('/^[\x{4e00}-\x{9fa5}a-zA-Z]+$/u', $data['menuName'])) return app('json')->fail('菜单名称只能是中文或者英文');
|
||||
if (!preg_match('/^[\x{4e00}-\x{9fa5}a-zA-Z]+$/u', $data['modelName'])) return app('json')->fail('模块名称只能是中文或者英文');
|
||||
if (!preg_match('/^[a-zA-Z_]+$/u', $data['tableName'])) return app('json')->fail('表名称只能是英文和下划线组成');
|
||||
if (!$this->crudVerifyPath($data['filePath'])) return app('json')->fail('生成的文件位置有误,请检查后重新生成');
|
||||
|
||||
$fromField = $searchField = $hasOneField = $columnField = $tableIndex = [];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user