platform.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. $config = array
  3. (
  4. 'source' => 'api/platform',
  5. 'list' => array
  6. (
  7. 'field' => array
  8. (
  9. 'id',
  10. 'name',
  11. 'host',
  12. ),
  13. 'data_button' => array
  14. (
  15. '设置' => 'edit',
  16. '加密' => array('route', array
  17. (
  18. 'path' => 'api_manage/platform_ssl',
  19. 'param' => array
  20. (
  21. 'set' => array('platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'),
  22. ),
  23. )),
  24. '签名' => array('route', array
  25. (
  26. 'path' => 'api_manage/platform_sign',
  27. 'param' => array
  28. (
  29. 'set' => array('platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'),
  30. ),
  31. )),
  32. '接口' => array('route', array
  33. (
  34. 'path' => 'api_manage/api',
  35. 'param' => array
  36. (
  37. 'set' => array('platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'),
  38. ),
  39. )),
  40. ),
  41. 'button' => array
  42. (
  43. '新增' => array('fastadd', 'name,host'),
  44. '定义格式转换' => array('route', array
  45. (
  46. 'path' => 'api_manage/format',
  47. 'param' => array
  48. (
  49. 'set' => array('menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'),
  50. ),
  51. )),
  52. ),
  53. 'search' => array
  54. (
  55. 'name',
  56. ),
  57. ),
  58. 'update' => array
  59. (
  60. 'desc' => "所有参数定义后均可以直接使用,也支持函数,参数值可以是变量、函数、字符串,如果函数中或者字符串中需要增加变量或者常量,请用{}隔开,默认常量:method请求方式,url请求完整地址,host主机域名,uri请求路径,time秒时间戳,timestamp毫秒时间戳,nonce随机值,notify请求回调地址,order_num请求订单号,sign签名信息,aad签名附加数据,query请求查询参数,query_json请求查询参数(json格式),body请求体参数,body_json请求体参数(json格式),header请求头参数,header_json请求头参数(json格式)",
  61. 'tab' => array
  62. (
  63. '基本设置' => 'name,host,api/platform_setting,api/platform_cert',
  64. '标准请求' => 'method,post_method,api/platform_request_header,api/platform_request_body',
  65. '标准响应' => 'response_type,api/platform_response_header,api/platform_response_body,api/platform_response_code',
  66. ),
  67. 'field' => array
  68. (
  69. 'name',
  70. 'host',
  71. 'method' => array
  72. (
  73. 'type' => 'radio',
  74. 'control' => true,
  75. ),
  76. 'post_method' => array
  77. (
  78. 'type' => 'radio',
  79. ),
  80. 'api/platform_setting' => array
  81. (
  82. 'name' => '账户参数',
  83. 'desc' => '设置账户需要的参数',
  84. 'where' => array('platform_id' => 'id'),
  85. ),
  86. 'api/platform_cert' => array
  87. (
  88. 'name' => '账户证书',
  89. 'desc' => '设置账户需要的证书',
  90. 'where' => array('platform_id' => 'id'),
  91. ),
  92. 'api/platform_request_body' => array
  93. (
  94. 'name' => '请求体设置',
  95. 'desc' => '设置平台标准请求体',
  96. 'where' => array('platform_id' => 'id'),
  97. ),
  98. 'api/platform_request_header' => array
  99. (
  100. 'name' => '请求头设置',
  101. 'desc' => '设置平台标准请求头',
  102. 'where' => array('platform_id' => 'id'),
  103. ),
  104. 'response_type' => 'radio',
  105. 'api/platform_response_body' => array
  106. (
  107. 'name' => '标准响应体',
  108. 'desc' => '设置平台标准响应体,填写后,将只保留填写后的响应体,格式:data[].name,不是列表则为data.name,如果填写了“数据字段”,这里仅返回“数据字段”里的数据',
  109. 'where' => array('platform_id' => 'id'),
  110. ),
  111. 'api/platform_response_header' => array
  112. (
  113. 'name' => '标准响应头',
  114. 'desc' => '设置平台标准响应头,不填写不保留响应头,格式:data[].name,不是列表则为data.name',
  115. 'where' => array('platform_id' => 'id'),
  116. ),
  117. 'api/platform_response_code' => array
  118. (
  119. 'name' => '响应状态码',
  120. 'desc' => '设置标准的响应状态码,也可以只设置成功值,其他值均为失败',
  121. 'where' => array('platform_id' => 'id'),
  122. ),
  123. 'api/platform_convert' => array
  124. (
  125. 'name' => '字段转换',
  126. 'where' => array('platform_id' => 'id'),
  127. 'desc' => '设置之后,所有平台过来的字段,都将按照这个转换规则进行转换',
  128. ),
  129. ),
  130. 'control' => array
  131. (
  132. 'post_method' => array
  133. (
  134. 'method' => 2,
  135. ),
  136. ),
  137. ),
  138. );
  139. $id = Dever::input('id');
  140. $load = Dever::input('load');
  141. if (($load == '/api_manage/platform' || $load == '/api_manage/api') && !$id) {
  142. $config['update']['desc'] = '';
  143. unset($config['update']['tab']);
  144. }
  145. return $config;