123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- <?php
- $type = array
- (
- 1 => '获取',
- 2 => '更新',
- 3 => '删除',
- );
- $doc = 'token:<br />' . Dever\Http\Api::token() . '<br /><br />加密步骤:<br />a、将所有参数(包括公共请求参数和token)进行字符串字典序排序<br />b、将所有参数字符串拼接成一个字符串进行sha1加密,得到signature<br />c、将所有参数(不包括token)和signature一起传输过来即可';
- $request = array
- (
- 'time' => '时间戳(登录加密请忽略此参数)',
- 'nonce' => '唯一值(登录加密请忽略此参数)',
- 'signature' => '加密字符串',
- 'json' => '1(返回json格式数据)',
- 'dever_api_test' => 'test_yes(测试参数,请忽略)',
- );
- $html = '<br />公共请求参数:<br />'.Dever::table($request).'<br />';
- $response = array
- (
- 'status' => '1请求成功2请求失败',
- 'msg' => '提示信息',
- 'data' => '数据,详见下述输出参数',
- 'code' => '状态码,一般不定义',
- );
- $html .= '公共返回参数:<br />'.Dever::table($response).'<br />';
- 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|',
- ),
- ),
- );
|