123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- {if condition="array_key_exists('select',$crud)"}
- # 查询{$menuName}
- 接口地址:/api/{$underLineName}/index
- 请求方式:get / post
- 请求数据:
- ```
- id | 指定ID,则只返回一条数据 | int |
- page | 第几页,默认1 | int |
- pagenum | 每页几条,默认20 | int,<=:1000 |
- ```
- 响应数据:(json格式)
- ```
- code int 状态,1代表成功,0代表失败
- msg string 消息
- time int 时间戳
- data json 返回数据
- ```
- {/if}
- {if condition="array_key_exists('create',$crud)"}
- # 新增{$menuName}
- 接口地址:/api/{$underLineName}/create
- 请求方式:get / post
- 请求数据:
- ```
- {volist name="$fieldsInfo" id="vo"}
- {php}
- $field_key = $vo['Field'];
- if(in_array($field_key,['id','create_time','update_time'])){
- continue;
- }
- if(!empty($vo['Comment'])){
- $comment = $vo['Comment'];
- $field_key.= " | " . $comment;
- }
- $field_val = "";
- if($vo['Default'] === null){
- $field_val.= "require";
- }
- if(startWith($vo["Type"],'int') || startWith($vo["Type"],'tinyint')){
- $field_val .= empty($field_val) ? "int" : ",int";
- }
- if(startWith($vo["Type"],'varchar')){
- $maxLen = str_replace(['varchar(',')'],['',''],$vo["Type"]);
- $field_val .= empty($field_val) ? "max:".$maxLen : ",max:".$maxLen;
- }
- {/php}
- {notempty name="$field_val"}
- {$field_key} | {$field_val} |
- {/notempty}
- {/volist}
- ```
- 响应数据:(json格式)
- ```
- code int 状态,1代表成功,0代表失败
- msg string 消息
- time int 时间戳
- data json 返回数据
- ```
- {/if}
- {if condition="array_key_exists('delete',$crud)"}
- # 删除{$menuName}
- 接口地址:/api/{$underLineName}/delete
- 请求方式:get / post
- 请求数据:
- ```
- id | 数据ID | int |
- ```
- 响应数据:(json格式)
- ```
- code int 状态,1代表成功,0代表失败
- msg string 消息
- time int 时间戳
- data json 返回数据
- ```
- {/if}
- {if condition="array_key_exists('update',$crud)"}
- # 修改{$menuName}
- 接口地址:/api/{$underLineName}/update
- 请求方式:get / post
- 请求数据:
- ```
- id | 数据ID | int |
- {volist name="$fieldsInfo" id="vo"}
- {php}
- $field_key = $vo['Field'];
- if(in_array($field_key,['id','create_time','update_time'])){
- continue;
- }
- if($vo['Default'] === null){
- continue;
- }
- if(!empty($vo['Comment'])){
- $comment = $vo['Comment'];
- $field_key.= " | " . $comment;
- }
- $field_val = "";
- if(startWith($vo["Type"],'int') || startWith($vo["Type"],'tinyint')){
- $field_val .= empty($field_val) ? "int" : ",int";
- }
- if(startWith($vo["Type"],'varchar')){
- $maxLen = str_replace(['varchar(',')'],['',''],$vo["Type"]);
- $field_val .= empty($field_val) ? "max:".$maxLen : ",max:".$maxLen;
- }
- {/php}
- {notempty name="$field_val"}
- {$field_key} | {$field_val} |
- {/notempty}
- {/volist}
- ```
- 响应数据:(json格式)
- ```
- code int 状态,1代表成功,0代表失败
- msg string 消息
- time int 时间戳
- data json 返回数据
- ```
- {/if}
|