123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?php
- $platform_id = Dever::input('set')['platform_id'] ?? 0;
- if (!$platform_id) {
- $platform_id = Dever::input('field')['platform_id'] ?? 0;
- }
- $platform = include('platform.php');
- $config = array
- (
- 'list' => array
- (
- 'where' => array('platform_id' => $platform_id),
- 'field' => array
- (
- //'id',
- 'sort' => 'input',
- 'name',
- 'uri',
- 'env',
- 'platform_id',
- 'status' => array
- (
- 'type' => 'switch',
- 'show' => '{status}',
- 'active_value' => 1,
- 'inactive_value' => 2,
- ),
- ),
- 'data_button' => array
- (
- '设置' => array('edit', array('platform_id' => $platform_id)),
- '删除' => 'delete',
- ),
- 'button' => array
- (
- '新增' => array('fastadd', array('platform_id' => $platform_id, 'field' => 'name,env,platform_id,uri')),
- ),
- 'search' => array
- (
- 'platform_id' => array
- (
- 'type' => 'hidden',
- 'default' => $platform_id,
- ),
- 'name',
- 'uri',
- 'status',
- ),
- ),
- 'update' => array
- (
- 'end' => 'api/app.updateApi',
- 'desc' => $platform['update']['desc'],
- 'tab' => array
- (
- '基本设置' => 'name,env,api/api_setting',
- '请求地址' => 'uri,method,post_method,api/api_path,api/api_query',
- '请求参数' => 'api/api_request_header,api/api_request_body',
- '响应参数' => 'api/api_response_header,api/api_response_body',
-
- '存储设置' => 'api/api_save',
- '回调设置' => 'notify,api/api_notify,api/api_notify_body,api/api_notify_code',
- //'价格设置' => 'spec_type,api/sku,api/sku#',
- //'输入输出' => 'api/api_request_input,api/api_request_output',
- ),
- 'field' => array
- (
- 'name',
- 'env' => 'radio',
- 'platform_id' => array
- (
- 'desc' => '【提交后不能更改】',
- ),
- 'uri',
- 'api/api_path' => array
- (
- 'name' => '接口路径',
- 'where' => array('api_id' => 'id'),
- 'desc' => '填写接口上的路径path参数',
- ),
- 'api/api_query' => array
- (
- 'name' => '接口查询参数',
- 'where' => array('api_id' => 'id'),
- 'desc' => '填写接口上的query参数',
- ),
- 'api/api_setting' => array
- (
- 'name' => '基础参数',
- 'where' => array('api_id' => 'id'),
- 'desc' => '设置仅限该接口使用的参数,用于定义一些特殊的参数',
- ),
- 'method' => array
- (
- 'type' => 'radio',
- 'control' => true,
- ),
- 'post_method' => array
- (
- 'type' => 'radio',
- 'show' => false,
- ),
- 'api/api_request_body' => array
- (
- 'name' => '请求体',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_request_header' => array
- (
- 'name' => '请求头',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_response_body' => array
- (
- 'name' => '响应体',
- 'desc' => '填写后,平台中的标准响应体将失效,并且只保留填写后的响应体,格式:data[].name,不是列表则为data.name',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_response_header' => array
- (
- 'name' => '响应头',
- 'desc' => '填写后,平台中的标准响应头将失效,不填写不保留响应头,格式:data[].name,不是列表则为data.name',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_save' => array
- (
- 'name' => '存储设置',
- 'desc' => '用于将响应数据保存到数据表中,该数据表最好有api_id(int)和request_id(varchar)字段,用于区分是哪个接口哪次请求,当然也可以没有',
- 'where' => array('api_id' => 'id'),
- ),
- 'notify' => array
- (
- 'type' => 'radio',
- 'control' => true,
- ),
- /*
- #也可以这样设置
- 'api/api_notify#' => array
- (
- 'field' => 'sign_arg',
- 'name' => '签名参数',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_notify##' => array
- (
- 'field' => 'sign_id',
- 'name' => '签名',
- 'where' => array('api_id' => 'id'),
- ),*/
- 'api/api_notify' => array
- (
- 'name' => '基本设置',
- 'where' => array('api_id' => 'id'),
- 'default' => array(array()),
- # 默认使用表格形式展示,可以改成每行展示
- #'type' => 'line',
- ),
- 'api/api_notify_body' => array
- (
- 'name' => '参数设置',
- 'where' => array('api_id' => 'id'),
- ),
- 'api/api_notify_code' => array
- (
- 'name' => '状态码',
- 'where' => array('api_id' => 'id'),
- ),
- ),
- 'control' => array
- (
- 'post_method' => array
- (
- 'method' => 2,
- ),
- 'api/api_notify' => array
- (
- 'notify' => 1,
- ),
- 'api/api_notify_body' => array
- (
- 'notify' => 1,
- ),
- 'api/api_notify_code' => array
- (
- 'notify' => 1,
- ),
- ),
- ),
- );
- $id = Dever::input('id');
- if (!$id) {
- unset($config['update']['tab']);
- }
- return $config;
|