50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\Gen\GenApi\GenController;
|
|
|
|
use app\admin\controller\Gen\GenApi\GenApi;
|
|
use app\common\exception\Tool;
|
|
|
|
/**
|
|
* 后端前台接口生成类
|
|
*/
|
|
class Api extends GenApi
|
|
{
|
|
/**
|
|
* 生成前台控制器
|
|
*/
|
|
public function createApiController(): void
|
|
{
|
|
//创建前台控制器层模块目录
|
|
self::createModuleMkdir($this->api_con_module_path);
|
|
//模板文件字符串替换
|
|
$temp_str = Tool::strReplacePlus(
|
|
self::getTempStr($this->api_con_temp_path),
|
|
[
|
|
//实体类名
|
|
'{$className}' => $this->class_name,
|
|
//模块名
|
|
'{$moduleName}' => $this->module_name,
|
|
//业务名
|
|
'{$businessName}' => $this->business_name,
|
|
//方法名
|
|
'{$functionName}' => $this->function_name,
|
|
//查询列表显示字段
|
|
'{$queryFields}' => self::toFormTempStr($this->query_list_fields),
|
|
//排序字段
|
|
'{$orderField}' => $this->sort_field,
|
|
//排序类型
|
|
'{$orderMode}' => $this->sort_type,
|
|
//新增允许字段
|
|
'{$addAllowFields}' => $this->add_fields_temp,
|
|
//编辑允许字段
|
|
'{$editAllowFields}' => $this->edit_fields_temp,
|
|
//列表查询条件
|
|
'{$whereContent}' => $this->query_list_where_temp,
|
|
]
|
|
);
|
|
//文件写入
|
|
self::writeFile($this->api_con_path, $temp_str);
|
|
}
|
|
}
|