base_apis.go 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. // Copyright 2019 utimes.cc. All rights reserved.
  2. // Use of this source code is governed by utimes.cc.
  3. package apis
  4. type ManagementBaseApiParam struct {
  5. Required bool `json:"required" description:"是否必选"`
  6. Name string `json:"name" description:"参数名字"`
  7. Mean string `json:"mean" description:"参数含义"`
  8. Type string `json:"type" description:"参数类型,整形、字符串等"`
  9. Example string `json:"example" description:"参数示例"`
  10. Selected bool `json:"selected" description:"是否选择"`
  11. In string `json:"in" description:"body 或query"`
  12. Child []ManagementBaseApiParam `json:"child"`
  13. Value string `json:"value"`
  14. }
  15. type ManagementApiProviderRelation struct {
  16. Id int64 `json:"id"`
  17. ApiId int64 `json:"api_id"`
  18. ProviderApiId int64 `json:"provider_api_id"`
  19. Priority int `json:"priority"`
  20. GroupNo int `json:"group_no"`
  21. GroupName string `json:"group_name"`
  22. OldGroupNo int `json:"-" orm:"-"`
  23. }
  24. func (o *ManagementApiProviderRelation) TableName() string {
  25. return "t_gd_api_provider_relation"
  26. }
  27. type ManagementBaseApiInfo struct {
  28. Type int `json:"type" description:"参数类型0:数据api,1:h5 api, 2:辅助api"`
  29. Name string `json:"name" description:"基础api名"`
  30. Method string `json:"method" description:"方法,GET POST等"`
  31. Router string `json:"router" description:"路由"`
  32. RequestParam []ManagementBaseApiParam `json:"request_param" description:"请求参数"`
  33. ResponseParam []ManagementBaseApiParam `json:"response_param" description:"响应参数"`
  34. ErrorCode []int `json:"error_code" description:"错误码数组"`
  35. ThresholdTimeout int `json:"threshold_timeout"`
  36. ThresholdFailRate float64 `json:"threshold_fail_rate"`
  37. ThresholdNorecordRate float64 `json:"threshold_norecord_rage"`
  38. Enable bool `json:"enable"`
  39. Comment string `json:"comment"`
  40. }
  41. type TGdApi struct {
  42. Id int64 `json:"id"`
  43. ApiType int `json:"api_type"`
  44. Name string `json:"name"`
  45. Method string `json:"method" description:"方法,GET POST等"`
  46. Router string `json:"router" description:"路由"`
  47. RequestParam string `json:"request_param" description:"请求参数"`
  48. ResponseParam string `json:"response_param" description:"响应参数"`
  49. //ProviderApiIds string `json:"provider_api_ids" description:"三方api列表 "`
  50. Enable bool `json:"enable"`
  51. ErrorCodeIds string `json:"error_code_ids"`
  52. CreateTime string `json:"create_time"`
  53. UpdateTime string `json:"update_time"`
  54. ThresholdTimeout int `json:"threshold_timeout"`
  55. ThresholdFailRate float64 `json:"threshold_fail_rate"`
  56. ThresholdNorecordRate float64 `json:"threshold_norecord_rate"`
  57. WarningEnable bool `json:"warning_enable"`
  58. Comment string `json:"comment"`
  59. IsShow bool `json:"is_show"`
  60. RateLimit int `json:"rate_limit" description:"并发限制"`
  61. }
  62. type ManagementAddBaseApiReq struct {
  63. BaseApiInfo ManagementBaseApiInfo `json:"base_api_info" description:""`
  64. }
  65. type ManagementAddBaseApiReply struct {
  66. ApiId int64 `json:"api_id" description:""`
  67. }
  68. type ManagementDelBaseApiReq struct {
  69. ApiId int64 `json:"api_id" description:""`
  70. }
  71. type ManagementDelBaseApiReply struct {
  72. }
  73. type ManagementUpdateBaseApiReq struct {
  74. ApiId int64 `json:"api_id" description:""`
  75. BaseApiInfo ManagementBaseApiInfo `json:"base_api_info" description:""`
  76. }
  77. type ManagementUpdateBaseApiReply struct {
  78. ApiId int64 `json:"api_id" description:""`
  79. }
  80. type ManagementBaseApiListItem struct {
  81. ApiId int64 `json:"api_id" description:""`
  82. Enable bool `json:"enable"`
  83. IsShow bool `json:"is_show"`
  84. OperationTime string `json:"operation_time" description:"操作时间"`
  85. Name string `json:"api_name" description:""`
  86. Type string `json:"api_type" description:""`
  87. Router string `json:"router"`
  88. Method string `json:"method"`
  89. RequestParam string `json:"request_param"`
  90. ResponseParam string `json:"response_param"`
  91. ThresholdTimeout int `json:"threshold_timeout"`
  92. ThresholdFailRate float64 `json:"threshold_fail_rate"`
  93. ThresholdNorecordRate float64 `json:"threshold_norecord_rate"`
  94. WarningEnable bool `json:"warning_enable"`
  95. RateLimit int `json:"rate_limit" description:"并发限制"`
  96. }
  97. type ManagementGetBaseApiListReq struct {
  98. ApiType int `json:"api_type"`
  99. PageNumber int `json:"page_number" description:""`
  100. Search string `json:"search"`
  101. IsAll bool `json:"is_all"`
  102. MerchantId int64 `json:"merchant_id"`
  103. }
  104. type ManagementGetBaseApiListReply struct {
  105. Total int `json:"total" description:""`
  106. PageNumber int `json:"page_number" description:""`
  107. PageSize int `json:"page_size" description:""`
  108. BaseApiItemList []ManagementBaseApiListItem `json:"base_api_item_list"`
  109. }
  110. type ManagementGetBaseApiInfoReq struct {
  111. ApiId int64 `json:"api_id" description:""`
  112. }
  113. type ManagementGetBaseApiInfoReply struct {
  114. BaseApiInfo ManagementBaseApiInfo `json:"base_api_info" description:""`
  115. }
  116. //api停启用
  117. type ManagementSetBaseApiStateReq struct {
  118. ApiId int64 `json:"api_id" description:""`
  119. Enable bool `json:"enable" description:""`
  120. }
  121. type ManagementSetBaseApiStateReply struct {
  122. }
  123. type ProviderGroupApiIdItem struct {
  124. GroupNo int `json:"group_no"`
  125. GroupName string `json:"group_name"`
  126. ProviderApiIdList []int64 `json:"provider_api_id_list"`
  127. }
  128. type ManagementAddBaseApiProviderReq struct {
  129. ApiId int64 `json:"api_id"`
  130. //ProviderApiIdList []int64 `json:"provider_api_id_list"`
  131. ProviderGroupList []ProviderGroupApiIdItem `json:"provider_group_list"`
  132. }
  133. type ManagementAddBaseApiProviderReply struct {
  134. }
  135. type ManagementGetBaseApiProviderListReq struct {
  136. ApiId int64 `json:"api_id" description:"基础api id"`
  137. //PageNumber int64 `json:"page_number" description:"当前页"`
  138. }
  139. type BaseApiProviderItem struct {
  140. ProviderApiId int64 `json:"provider_api_id"`
  141. Priority int `json:"priority" description:"优先级"`
  142. ThirdpartApiName string `json:"thirdpart_api_name" description:"数据源接口名称"`
  143. ThirdpartApiRouter string `json:"thirdpart_api_router" description:"数据源接口路径"`
  144. PlatformName string `json:"platform_name" description:"数据源平台名称"`
  145. Enable bool `json:"enable"`
  146. }
  147. type BaseApiProviderGroupItem struct {
  148. GroupNo int `json:"group_no"`
  149. GroupName string `json:"group_name"`
  150. ProviderApiList []BaseApiProviderItem `json:"provider_api_list" description:""`
  151. }
  152. type ManagementGetBaseApiProviderListReply struct {
  153. //Total int `json:"" description:""`
  154. //PageSize int `json:"" description:""`
  155. //PageNumber int `json:"" description:""`
  156. //List []BaseApiProviderItemList `json:"list" description:""`
  157. //ProviderApiList []BaseApiProviderItem `json:"provider_api_list" description:""`
  158. ProviderGroupList []BaseApiProviderGroupItem `json:"provider_group_list"`
  159. }
  160. type ManagementGetBaseApiIdReq struct {
  161. Method string `json:"method" description:"方法,GET POST等"`
  162. Router string `json:"router" description:"路由"`
  163. }
  164. type ManagementGetBaseApiIdReply struct {
  165. ApiId int64 `json:"api_id" description:""`
  166. }
  167. type ManagementGetBaseApiByRouterReq struct {
  168. Method string `json:"method" description:"方法,GET POST等"`
  169. Router string `json:"router" description:"路由"`
  170. AppKey string `json:"app_key"`
  171. ApiId int `json:"api_id"`
  172. MerchantId int `json:"merchant_id"`
  173. }
  174. type ManagementGetBaseApiByRouterReply struct {
  175. Data map[string]string `json:"data"`
  176. }
  177. type ManagementSetBaseApiThresholdReq struct {
  178. ApiId int64 `json:"api_id" in:"query" require:"true"`
  179. ThresholdTimeout int `json:"threshold_timeout" in:"query" require:"false"`
  180. ThresholdFailRate float64 `json:"threshold_fail_rate" in:"query" require:"false"`
  181. ThresholdNorecordRate float64 `json:"threshold_norecord_rate" in:"query" require:"false"`
  182. WarningEnable bool `json:"warning_enable"`
  183. RateLimit int `json:"rate_limit" description:"并发限制"`
  184. }
  185. type ManagementSetBaseApiThresholdReply struct {
  186. }
  187. type ManagementSetBaseApiShowInfoReq struct {
  188. ApiId int64 `json:"api_id" description:"api id" in:"path"`
  189. IsShow bool `json:"is_show"`
  190. }
  191. type ManagementSetBaseApiShowInfoReply struct {
  192. }