platform.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. $config = [
  3. 'source' => 'api/platform',
  4. 'list' => [
  5. 'field' => [
  6. 'id',
  7. 'name',
  8. 'host',
  9. ],
  10. 'data_button' => [
  11. '设置' => 'edit',
  12. '加密' => ['route', [
  13. 'path' => 'api_manage/platform_ssl',
  14. 'param' => [
  15. 'set' => ['platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'],
  16. ],
  17. ]],
  18. '签名' => ['route', [
  19. 'path' => 'api_manage/platform_sign',
  20. 'param' => [
  21. 'set' => ['platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'],
  22. ],
  23. ]],
  24. '接口' => ['route', [
  25. 'path' => 'api_manage/api',
  26. 'param' => [
  27. 'set' => ['platform_id' => 'id', 'menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'],
  28. ],
  29. ]],
  30. ],
  31. 'button' => [
  32. '新增' => ['fastadd', 'name,host'],
  33. '定义格式转换' => ['route', [
  34. 'path' => 'api_manage/format',
  35. 'param' => [
  36. 'set' => ['menu' => 'api_manage/platform', 'parent' => 'api_manage/platform'],
  37. ],
  38. ]],
  39. ],
  40. 'search' => [
  41. 'name',
  42. ],
  43. ],
  44. 'update' => [
  45. '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格式)",
  46. 'tab' => [
  47. '基本设置' => 'name,host,api/platform_setting,api/platform_cert',
  48. '标准请求' => 'method,post_method,api/platform_request_header,api/platform_request_body',
  49. '标准响应' => 'response_type,api/platform_response_header,api/platform_response_body,api/platform_response_code',
  50. ],
  51. 'field' => [
  52. 'name',
  53. 'host',
  54. 'method' => [
  55. 'type' => 'radio',
  56. 'control' => true,
  57. ],
  58. 'post_method' => [
  59. 'type' => 'radio',
  60. ],
  61. 'api/platform_setting' => [
  62. 'name' => '账户参数',
  63. 'desc' => '设置账户需要的参数',
  64. 'where' => ['platform_id' => 'id'],
  65. ],
  66. 'api/platform_cert' => [
  67. 'name' => '账户证书',
  68. 'desc' => '设置账户需要的证书',
  69. 'where' => ['platform_id' => 'id'],
  70. ],
  71. 'api/platform_request_body' => [
  72. 'name' => '请求体设置',
  73. 'desc' => '设置平台标准请求体',
  74. 'where' => ['platform_id' => 'id'],
  75. ],
  76. 'api/platform_request_header' => [
  77. 'name' => '请求头设置',
  78. 'desc' => '设置平台标准请求头',
  79. 'where' => ['platform_id' => 'id'],
  80. ],
  81. 'response_type' => 'radio',
  82. 'api/platform_response_body' => [
  83. 'name' => '标准响应体',
  84. 'desc' => '设置平台标准响应体,填写后,将只保留填写后的响应体,格式:data[].name,不是列表则为data.name,如果填写了“数据字段”,这里仅返回“数据字段”里的数据',
  85. 'where' => ['platform_id' => 'id'],
  86. ],
  87. 'api/platform_response_header' => [
  88. 'name' => '标准响应头',
  89. 'desc' => '设置平台标准响应头,不填写不保留响应头,格式:data[].name,不是列表则为data.name',
  90. 'where' => ['platform_id' => 'id'],
  91. ],
  92. 'api/platform_response_code' => [
  93. 'name' => '响应状态码',
  94. 'desc' => '设置标准的响应状态码,也可以只设置成功值,其他值均为失败',
  95. 'where' => ['platform_id' => 'id'],
  96. ],
  97. 'api/platform_convert' => [
  98. 'name' => '字段转换',
  99. 'where' => ['platform_id' => 'id'],
  100. 'desc' => '设置之后,所有平台过来的字段,都将按照这个转换规则进行转换',
  101. ],
  102. ],
  103. 'control' => [
  104. 'post_method' => [
  105. 'method' => 2,
  106. ],
  107. ],
  108. ],
  109. ];
  110. $id = Dever::input('id');
  111. $load = Dever::input('load');
  112. if (($load == '/api_manage/platform' || $load == '/api_manage/api') && !$id) {
  113. $config['update']['desc'] = '';
  114. unset($config['update']['tab']);
  115. }
  116. return $config;