mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-11-01 07:20:56 +00:00
Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev
This commit is contained in:
commit
f1ae59d215
@ -320,7 +320,7 @@ class SystemCrudServices extends BaseServices
|
||||
[
|
||||
'path' => $routeName,
|
||||
'method' => 'POST',
|
||||
'name' => $modelName . '保存数据接口',
|
||||
'name' => $modelName . '保存接口',
|
||||
'app_name' => 'adminapi',
|
||||
'cate_id' => $cateId,
|
||||
'unique_auth' => '',
|
||||
@ -338,7 +338,7 @@ class SystemCrudServices extends BaseServices
|
||||
[
|
||||
'path' => $routeName . '/<id>',
|
||||
'method' => 'PUT',
|
||||
'name' => $modelName . '修改数据接口',
|
||||
'name' => $modelName . '修改接口',
|
||||
'app_name' => 'adminapi',
|
||||
'cate_id' => $cateId,
|
||||
'unique_auth' => '',
|
||||
@ -347,13 +347,19 @@ class SystemCrudServices extends BaseServices
|
||||
[
|
||||
'path' => $routeName . '/<id>',
|
||||
'method' => 'DELETE',
|
||||
'name' => $modelName . '删除数据接口',
|
||||
'name' => $modelName . '删除接口',
|
||||
'app_name' => 'adminapi',
|
||||
'cate_id' => $cateId,
|
||||
'unique_auth' => '',
|
||||
'add_time' => date('Y-m-d H:i:s')
|
||||
],
|
||||
];
|
||||
$routeService = app()->make(SystemRouteServices::class);
|
||||
foreach ($ruleData as $key => $item) {
|
||||
if ($routeService->count(['method' => $item['method'], 'path' => $item['path']])) {
|
||||
unset($ruleData[$key]);
|
||||
}
|
||||
}
|
||||
app()->make(SystemRouteServices::class)->saveAll($ruleData);
|
||||
//记录权限加入菜单表
|
||||
$menuData = [];
|
||||
@ -538,7 +544,9 @@ class SystemCrudServices extends BaseServices
|
||||
]);
|
||||
//生成验证器
|
||||
$validate = app()->make(Validate::class);
|
||||
$validate->setFilePathName($filePath['validate'] ?? '')->setbasePath($basePath)->handle($tableName);
|
||||
$validate->setFilePathName($filePath['validate'] ?? '')->setbasePath($basePath)->handle($tableName, [
|
||||
'field' => $options['fromField'],
|
||||
]);
|
||||
//生成控制器
|
||||
$controller = app()->make(Controller::class);
|
||||
$controller->setFilePathName($filePath['controller'] ?? '')->setbasePath($basePath)->handle($tableName, [
|
||||
|
||||
@ -204,7 +204,13 @@ class SystemRouteServices extends BaseServices
|
||||
$cateId = $commmonId;
|
||||
} else {
|
||||
if (!isset($item['option']['cate_name'])) {
|
||||
$cateId = $id;
|
||||
if (strstr($item['rule'], '<MISS>') === false) {
|
||||
$rule = explode('/', $item['rule']);
|
||||
$cateId = $this->topCateId($app, $rule[0]);
|
||||
} else {
|
||||
//miss路由不写入
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$cateId = $this->topCateId($app, $item['option']['cate_name']);
|
||||
}
|
||||
|
||||
@ -148,6 +148,7 @@ class Service extends Make
|
||||
*/
|
||||
protected function getframeImageOnePhpContent(string $field, string $name, bool $required = false, string $icon = 'ios-add', string $width = '950px', string $height = '505px')
|
||||
{
|
||||
$name = addslashes($name);
|
||||
$requiredText = $required ? '->required()' : '';
|
||||
$content = <<<CONTENT
|
||||
\$rule[] = FormBuilder::frameImage('$field', '$name', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => '$field']), \$info['$field'] ?? '')->icon('$icon')->width('$width')->height('$height')->modal(['footer-hide' => true])$requiredText
|
||||
@ -170,6 +171,7 @@ CONTENT;
|
||||
*/
|
||||
protected function getframeImagesPhpContent(string $field, string $name, bool $required = false, string $icon = 'ios-images', int $maxLength = 10, string $width = '950px', string $height = '505px')
|
||||
{
|
||||
$name = addslashes($name);
|
||||
$requiredText = $required ? '->required()' : '';
|
||||
$content = <<<CONTENT
|
||||
\$rule[] = FormBuilder::frameImages('$field', '$name', url(config('app.admin_prefix', 'admin') . '/widget.images/index', ['fodder' => '$field', 'type' => 'many', 'maxLength' => $maxLength]), \$info['$field'] ?? [])->maxLength($maxLength)->icon('$icon')->width('$width')->height('$height')->modal(['footer-hide' => true])$requiredText
|
||||
|
||||
@ -38,6 +38,43 @@ class Validate extends Make
|
||||
return 'app' . DS . 'adminapi' . DS . 'validate' . DS . 'crud';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $options
|
||||
* @return Validate
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/4/23
|
||||
*/
|
||||
public function handle(string $name, array $options = [])
|
||||
{
|
||||
[$rule, $message] = $this->getRuleContent($options['field']);
|
||||
$this->value['rule-php'] = $rule;
|
||||
$this->value['message-php'] = $message;
|
||||
return parent::handle($name, $options); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $field
|
||||
* @return array
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/4/23
|
||||
*/
|
||||
protected function getRuleContent(array $field)
|
||||
{
|
||||
$content = [];
|
||||
$message = [];
|
||||
foreach ($field as $item) {
|
||||
$item['name'] = addslashes($item['name']);
|
||||
if ($item['required']) {
|
||||
$content[] = $this->tab(2) . '\'' . $item['field'] . '\'=>\'require\'';
|
||||
$message[] = $this->tab(2) . '\'' . $item['field'] . '.require\'=>\'' . $item['name'] . '必须填写\'';
|
||||
}
|
||||
}
|
||||
return [implode("\n", $content), implode("\n", $message)];
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板文件配置
|
||||
* @param string $type
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->option(['real_name' => '{%menus%}删除数据接口']);
|
||||
Route::delete('{%route%}/:id', 'crud.{%routePath%}{%controller%}/delete')->option(['real_name' => '{%menus%}删除接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->option(['real_name' => '{%menus%}保存数据接口']);
|
||||
Route::post('{%route%}', 'crud.{%routePath%}{%controller%}/save')->option(['real_name' => '{%menus%}保存接口']);
|
||||
|
||||
@ -1 +1 @@
|
||||
Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->option(['real_name' => '{%menus%}修改数据接口']);
|
||||
Route::put('{%route%}/:id', 'crud.{%routePath%}{%controller%}/update')->option(['real_name' => '{%menus%}修改接口']);
|
||||
|
||||
@ -33,14 +33,14 @@ class {%nameCamel%}Validate extends Validate
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
|
||||
{%rule-php%}
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
|
||||
{%message-php%}
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user