'获取',
2 => '更新',
3 => '删除',
);
$doc = 'token:
' . Dever\Http\Api::token() . '
加密步骤:
a、将所有参数(包括公共请求参数和token)进行字符串字典序排序
b、将所有参数字符串拼接成一个字符串进行sha1加密,得到signature
c、将所有参数(不包括token)和signature一起传输过来即可';
$request = array
(
'time' => '时间戳(登录加密请忽略此参数)',
'nonce' => '唯一值(登录加密请忽略此参数)',
'signature' => '加密字符串',
'json' => '1(返回json格式数据)',
'dever_api_test' => 'test_yes(测试参数,请忽略)',
);
$html = '
公共请求参数:
'.Dever::table($request).'
';
$response = array
(
'status' => '1请求成功2请求失败',
'msg' => '提示信息',
'data' => '数据,详见下述输出参数',
'code' => '状态码,一般不定义',
);
$html .= '公共返回参数:
'.Dever::table($response).'
';
return array
(
# 表名
'name' => 'api',
# 显示给用户看的名称
'lang' => '接口列表',
//'menu' => false,
'html' => $html,
'doc' => $doc,
'gettype' => $type,
# 数据结构
'struct' => array
(
'id' => array
(
'type' => 'int-11',
'name' => 'ID',
'default' => '',
'desc' => '',
'match' => 'is_numeric',
'order' => 'desc',
'list' => true,
),
'name' => array
(
'type' => 'varchar-30',
'name' => '接口名称',
'default' => '',
'desc' => '请输入接口名称',
'match' => 'is_string',
'update' => 'text',
'search' => 'order,fulltext',
'list' => true,
),
'type' => array
(
'type' => 'tinyint-1',
'name' => '接口类型',
'default' => '1',
'desc' => '请选择接口类型',
'match' => 'is_numeric',
'option' => $type,
//'update' => 'radio',
'search' => 'select',
'list' => true,
),
'project' => array
(
'type' => 'varchar-30',
'name' => '所属项目',
'default' => '',
'desc' => '请输入所属项目',
'match' => 'is_string',
),
'site' => array
(
'type' => 'varchar-500',
'name' => '接口地址',
'default' => '',
'desc' => '请输入接口地址',
'match' => 'is_string',
'update' => 'text',
'search' => 'fulltext',
'list' => 'Dever::load("manage/api.getHtml", "{name}", "{site}", {id}, "{project}")',
'modal' => '点此查看',
//'bind' => array('onclick', 'checking', array('url' => Dever::url("manage/api.load?json=1"))),
),
'reorder' => array
(
'type' => 'int-11',
'name' => '排序',
'default' => '1',
'desc' => '请输入排序',
'match' => 'option',
'update' => 'text',
'search' => 'order',
'list' => true,
'order' => 'desc',
'edit' => true,
),
'state' => array
(
'type' => 'tinyint-1',
'name' => '数据状态',
'default' => '1',
'desc' => '请选择状态',
'match' => 'is_numeric',
//'option' => $option,
//'update' => 'radio',
//'list' => true,
//'extend' => true,//扩展功能,该字段为虚拟字段,只在数据库中建立extend字段来保存 后续实现
),
'cdate' => array
(
'type' => 'int-11',
'name' => '录入时间',
'match' => array('is_numeric', DEVER_TIME),
'desc' => '',
# 只有insert时才生效
'insert' => true,
//'list' => 'date("Y-m-d H:i:s", {cdate})',
),
),
# 更新表结构
/*
'alter' => array
(
1 => array
(
array('update', 'request', 'request', 'text-255 请求'),
array('update', 'response', 'response', 'text-255 返回参数'),
),
'version' => 1,
),
*/
'manage' => array
(
# 后台banner
'banner' => array
(
'img' => '"http://css.selfimg.com.cn/vogue/mobile-v2/vip/images/index-logo.png"',
'name' => '"项目名称"',
),
'button' => array
(
'更新接口' => 'manage/api.update',
'加密说明' => 'modal|' . $doc,
'生成接口文档' => Dever::url('doc/view?type=api', 'manage'),
),
'delete' => false,
//'insert' => false,
'edit' => false,
),
# request 请求接口定义
'request' => array
(
'site' => array
(
'where' => array
(
'site' => 'yes',
'project' => 'yes',
),
'type' => 'one',
),
# 取所有
'all' => array
(
'type' => 'all',
'order' => array('reorder` desc,`id', 'desc'),
'col' => '*|id',
),
# 取所有
'getAll' => array
(
'type' => 'all',
'order' => array('reorder` desc,`id', 'desc'),
'col' => '*|project|id|',
),
),
);