data_api.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. // Copyright 2019 getensh.com. All rights reserved.
  2. // Use of this source code is governed by getensh.com.
  3. package apis
  4. type DataApi struct {
  5. Id int64 `json:"data_api_id" description:"数据api id"`
  6. DataApiName string `json:"data_api_name" description:"数据api名"`
  7. DataApiType int `json:"data_api_type" description:"数据api类型"`
  8. DataApiDesc string `json:"data_api_desc" description:"数据API描述"`
  9. Version string `json:"version" description:"数据api版本"`
  10. IsRelease bool `json:"is_release" description:"是否发布"`
  11. ReleaseTime string `json:"release_time" description:"发布时间"`
  12. CreateTime string `json:"-"`
  13. UpdateTime string `json:"-"`
  14. }
  15. func (o *DataApi) TableName() string {
  16. return "t_gd_data_api"
  17. }
  18. type QueryType struct {
  19. Id int64 `json:"query_type_id" description:"数据api查询方式id"`
  20. DataApiId int64 `json:"data_api_id" description:"数据api"`
  21. IsFree bool `json:"is_free" description:"数据api查询方式是否免费"`
  22. QueryTypeName string `json:"query_type_name" description:"查询方式名"`
  23. CreateTime string `json:"-"`
  24. UpdateTime string `json:"-"`
  25. DataApiBaseApis []ManagementDataApiBaseApi `json:"data_api_base_apis" orm:"-" description:"数据api中基础api"`
  26. DayDataCombos []DataCombo `json:"day_data_combos" orm:"-"`
  27. TotalDataCombos []DataCombo `json:"total_data_combos" orm:"-"`
  28. FreeDataCombos []DataCombo `json:"free_data_combos" orm:"-"`
  29. UnitPrice float64 `json:"unit_price"`
  30. //DataCombos []DataCombo `json:"-" orm:"-" description:"数据api中数据套餐"`
  31. }
  32. func (o *QueryType) TableName() string {
  33. return "t_gd_data_api_query_type"
  34. }
  35. type BaseApiParamFilter struct {
  36. Name string `json:"name"`
  37. Value string `json:"value"`
  38. RuleId int `json:"rule_id"`
  39. }
  40. type ManagementDataApiBaseApi struct {
  41. Id int64 `json:"data_api_base_api_id" description:"数据api中基础api id"`
  42. Priority int `json:"priority" description:"数据api中基础api 优先级"`
  43. ApiId int64 `json:"api_id" description:"基础api id"`
  44. ApiName string `json:"api_name" orm:"-"`
  45. SaleName string `json:"sale_name" description:"销售名"`
  46. QueryTypeId int64 `json:"query_type_id" description:"查询方式id"`
  47. //ProviderApis string `json:"-"`
  48. //ProviderApiLimitGroup []ProviderLimitGroup `json:"provider_api_limit_group" orm:"-"`
  49. ProviderGroupList []BaseApiProviderGroupItem `json:"provider_group_list" orm:"-" description:""`
  50. RequestParams []ManagementBaseApiParam `json:"request_params" description:"请求参数" orm:"-"`
  51. ResponseParams []ManagementBaseApiParam `json:"response_params" description:"响应参数" orm:"-"`
  52. RequestParam string `json:"-" description:"请求参数json字符串"`
  53. ResponseParam string `json:"-" description:"响应参数json字符串"`
  54. CountType int `json:"count_type" description:"计数类型"`
  55. CountCode string `json:"count_code" description:"计数码"`
  56. ForceUpdate bool `json:"force_update" description:是否强更"`
  57. IsCrypto bool `json:"is_crypto" description:"是否加密"`
  58. CreateTime string `json:"-"`
  59. UpdateTime string `json:"-"`
  60. ReuseTime int `json:"reuse_time"`
  61. Filter string `json:"filter"`
  62. Filters []BaseApiParamFilter `json:"filters" orm:"-"`
  63. Router string `orm:"-" json:"router"`
  64. ApiType int `orm:"-" json:"api_type"`
  65. }
  66. func (o *ManagementDataApiBaseApi) TableName() string {
  67. return "t_gd_child_data_api"
  68. }
  69. type DataCombo struct {
  70. Id int64 `json:"combo_id" description:"查询方式套餐id"`
  71. QueryTypeId int64 `json:"query_type_id" description:"查询方式id"`
  72. Count int64 `json:"count" description:"次数"`
  73. Price float64 `json:"price" description:"价格"`
  74. Type int `json:"type" description:"计数类型" description:"1 总次数,2 按天"`
  75. TotalDay int `json:"total_day" description:"总天数"`
  76. //IsFree bool `json:"-" description:"是否免费"`
  77. CreateTime string `json:"-"`
  78. UpdateTime string `json:"-"`
  79. }
  80. func (o *DataCombo) TableName() string {
  81. return "t_gd_data_api_combo"
  82. }
  83. // 添加数据api
  84. type ManagementDataApiAddApiReq struct {
  85. DataApiName string `json:"data_api_name"`
  86. DataApiType int `json:"data_api_type"`
  87. Version string `json:"version"`
  88. DataApiDesc string `json:"data_api_desc"`
  89. }
  90. type ManagementDataApiAddApiReply struct {
  91. DataApiId int64 `json:"data_api_id"`
  92. }
  93. // 删除数据api
  94. type ManagementDataApiDeleteApiReq struct {
  95. DataApiId int64 `json:"data_api_id"`
  96. }
  97. type ManagementDataApiDeleteApiReply struct {
  98. }
  99. // 修改数据api
  100. type ManagementDataApiModifyApiReq struct {
  101. DataApiId int64 `json:"data_api_id"`
  102. DataApiName string `json:"data_api_name"`
  103. DataApiType int `json:"data_api_type"`
  104. Version string `json:"version"`
  105. DataApiDesc string `json:"data_api_desc"`
  106. }
  107. type ManagementDataApiModifyApiReply struct {
  108. }
  109. // 获取数据api列表
  110. type ManagementDataApiGetAllReq struct {
  111. PageSize int64 `json:"page_size"`
  112. PageNumber int64 `json:"page_number" description:""`
  113. Search string `json:"search"`
  114. IsAll bool `json:"is_all"`
  115. DataApiType string `json:"data_api_type"`
  116. MerchantId int64 `json:"merchant_id"`
  117. }
  118. type ManagementDataApiGetAllReply struct {
  119. Total int64 `json:"total" description:""`
  120. PageSize int64 `json:"page_size" description:"page大小"`
  121. PageNumber int64 `json:"page_number" description:""`
  122. DataApis []DataApi `json:"data_apis"`
  123. }
  124. // 获取数据api详情
  125. type ManagementDataApiGetApiInfoReq struct {
  126. DataApiId int64 `json:"data_api_id"`
  127. }
  128. type ManagementDataApiGetApiInfoReply struct {
  129. QueryTypes []QueryType `json:"query_types"`
  130. }
  131. // 发布数据api
  132. type ManagementDataApiReleaseApiReq struct {
  133. DataApiId int64 `json:"data_api_id"`
  134. Status int `json:"status"`
  135. }
  136. type ManagementDataApiReleaseApiReply struct {
  137. }
  138. type ManagementQueryTypeInfo struct {
  139. DataApiId int64 `json:"data_api_id"`
  140. QueryTypeName string `json:"query_type_name"`
  141. }
  142. // 添加数据api查询方式
  143. /*type ManagementDataApiAddQueryTypeReq struct {
  144. QueryTypeInfos []ManagementQueryTypeInfo `json:"query_type_infos"`
  145. }
  146. type ManagementAddQueryType struct {
  147. QueryTypeId int64 `json:"query_type_id" description:"数据api查询方式id"`
  148. QueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
  149. }
  150. type ManagementDataApiAddQueryTypeReply struct {
  151. ManagementAddQueryTypes []ManagementAddQueryType `json:"management_add_query_types"`
  152. }*/
  153. type DataApiQueryTypeInfo struct {
  154. QueryTypeId int64 `json:"query_type_id"`
  155. QueryTypeName string `json:"query_type_name" description:"数据api查询方式名"`
  156. }
  157. // 添加数据api查询方式
  158. type ManagementDataApiAddQueryTypeReq struct {
  159. DataApiId int64 `json:"data_api_id"`
  160. QueryTypes []DataApiQueryTypeInfo `json:"query_types"`
  161. }
  162. type ManagementDataApiAddQueryTypeReply struct {
  163. QueryTypes []DataApiQueryTypeInfo `json:"query_types"`
  164. }
  165. // 修改数据api查询方式
  166. type ManagementDataApiModifyQueryTypeReq struct {
  167. QueryTypeId int64 `json:"query_type_id"`
  168. QueryTypeName string `json:"query_type_name"`
  169. }
  170. type ManagementDataApiModifyQueryTypeReply struct {
  171. }
  172. // 删除数据api查询方式
  173. type ManagementDataApiRemoveQueryTypeReq struct {
  174. QueryTypeId int64 `json:"query_type_id"`
  175. }
  176. type ManagementDataApiRemoveQueryTypeReply struct {
  177. }
  178. // 获取数据api查询方式
  179. type ManagementDataApiGetQueryTypeReq struct {
  180. QueryTypeId int64 `json:"query_type_id"`
  181. }
  182. type ManagementDataApiGetQueryTypeReply struct {
  183. QueryTypeInfo QueryType `json:"query_type_info"`
  184. }
  185. type DataApiAddBaseApi struct {
  186. ApiId int64 `json:"api_id"`
  187. //Priority int `json:"priority" description:"优先级"`
  188. }
  189. // 数据api添加基础api
  190. type ManagementDataApiAddBaseApiReq struct {
  191. QueryTypeId int64 `json:"query_type_id"`
  192. BaseApiList []int64 `json:"base_api_list"`
  193. }
  194. type ManagementDataApiAddBaseApiReply struct {
  195. //DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  196. }
  197. // 数据api删除基础api
  198. type ManagementDataApiRemoveBaseApiReq struct {
  199. DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  200. }
  201. type ManagementDataApiRemoveBaseApiReply struct {
  202. }
  203. // 数据api修改基础api信息
  204. type ManagementDataApiModifyBaseApiReq struct {
  205. DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  206. ProviderApis string `json:"-"`
  207. SaleName string `json:"sale_name" description:"销售名"`
  208. ProviderGroupList []BaseApiProviderGroupItem `json:"provider_group_list"`
  209. //ProviderApiLimitGroup []ProviderLimitGroup `json:"provider_api_limit_group"`
  210. RequestParam []ManagementBaseApiParam `json:"request_params"`
  211. ResponseParam []ManagementBaseApiParam `json:"response_params"`
  212. CountCode string `json:"count_code"`
  213. CountType int `json:"count_type"`
  214. ForceUpdate bool `json:"force_update"`
  215. IsCrypto bool `json:"is_crypto"`
  216. ReuseTime int `json:"reuse_time"`
  217. Filters []BaseApiParamFilter `json:"filters"`
  218. }
  219. type ManagementDataApiModifyBaseApiReply struct {
  220. }
  221. // 数据api获取基础api
  222. type ManagementDataApiGetBaseApiReq struct {
  223. DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  224. //DataApiQueryTypeId int64 `json:"data_api_query_type_id"`
  225. }
  226. type ManagementDataApiGetBaseApiReply struct {
  227. DataApiBaseApis ManagementDataApiBaseApi `json:"data_api_base_apis" orm:"-"`
  228. }
  229. // 数据api添加数据套餐
  230. type ManagementDataApiAddDataCombo struct {
  231. ComboId int64 `json:"combo_id"`
  232. QueryTypeId int64 `json:"query_type_id"`
  233. Count int64 `json:"count"`
  234. Type int `json:"type" description:"1 总次数,2 按天"`
  235. TotalDay int `json:"total_day"`
  236. Price float64 `json:"price"`
  237. IsDelete bool `json:"is_delete"`
  238. }
  239. type ManagementDataApiAddDataComboReq struct {
  240. ManagementAddDataComboList []ManagementDataApiAddDataCombo `json:"management_add_data_combo_list"`
  241. }
  242. type ManagementDataApiAddDataComboReply struct {
  243. //ComboId int64 `json:"combo_id"`
  244. }
  245. // 数据api修改数据套餐
  246. type ManagementDataApiModifyDataComboReq struct {
  247. ComboId int64 `json:"combo_id"`
  248. Count int64 `json:"count"`
  249. //Type int `json:"type"`
  250. TotalDay int `json:"total_day"`
  251. Price float64 `json:"price"`
  252. //IsFree bool `json:"is_free"`
  253. }
  254. type ManagementDataApiModifyDataComboReply struct {
  255. }
  256. // 数据api删除数据套餐
  257. type ManagementDataApiRemoveDataComboReq struct {
  258. ComboId int64 `json:"combo_id"`
  259. }
  260. type ManagementDataApiRemoveDataComboReply struct {
  261. }
  262. // 获取数据api数据套餐
  263. type ManagementDataApiGetDataComboReq struct {
  264. ComboId int64 `json:"combo_id"`
  265. }
  266. type ManagementDataApiGetDataComboReply struct {
  267. Count int `json:"count"`
  268. Price float64 `json:"price"`
  269. Type int `json:"type"`
  270. TotalDay int `json:"total_day"`
  271. QueryTypeName string `json:"query_type_name"`
  272. }
  273. type ProviderLimitGroup struct {
  274. GroupId int `json:"group_id"`
  275. ProviderApiLimits []ProviderApiLimit `json:"provider_api_limits"`
  276. }
  277. // 数据api选择三方数据源接口
  278. type ProviderApiLimit struct {
  279. ThirdpartApiId int64 `json:"thirdpart_api_id" description:"三方api id"`
  280. PlatformName string `json:"platform_name" description:"三方平台名"`
  281. PlatformCode string `json:"platform_code" description:"三方平台码"`
  282. ThirdpartApiName string `json:"thirdpart_api_name" description:"三方api名称"`
  283. ThirdpartApiRouter string `json:"thirdpart_api_router" description:"三方api路由"`
  284. ThirdpartApiMethod string `json:"thirdpart_api_method" description:"三方api方法"`
  285. Enable bool `json:"enable" description:"是否启用"`
  286. DayCount int `json:"day_count" description:"每日调用量限额"`
  287. Count int `json:"count" description:"总调用量限额"`
  288. }
  289. /*type ManagementDataApiChooseProviderApiReq struct {
  290. DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  291. ProviderApiLimitGroup []ProviderLimitGroup `json:"provider_api_limit_group"`
  292. }
  293. type ManagementDataApiChooseProviderApiReply struct {
  294. }*/
  295. // 数据api中 api优先级调整
  296. /*type DataApiPriority struct {
  297. DataApiBaseApiId int64 `json:"data_api_base_api_id"`
  298. Priority int `json:"priority"`
  299. }
  300. type ManagementDataApiChangeBaseApiIndexReq struct {
  301. DataApiPriorityList []DataApiPriority `json:"data_api_priority_list"`
  302. }
  303. */
  304. type ManagementDataApiChangeBaseApiIndexReply struct {
  305. }
  306. // 获取数据api查询方式
  307. type ManagementDataApiQueryTypeList struct {
  308. QueryTypeId int64 `json:"query_type_id"`
  309. QueryTypeName string `json:"query_type_name"`
  310. }
  311. type ManagementDataApiGetQueryTypeListReq struct {
  312. DataApiId int64 `json:"data_api_id"`
  313. }
  314. type ManagementDataApiGetQueryTypeListReply struct {
  315. ManagementDataApiQueryTypeList []ManagementDataApiQueryTypeList `json:"query_type_list"`
  316. }
  317. // 设置查询方式数据套餐
  318. type ManagementDataApiSetFreeDataComboReq struct {
  319. QueryTypeId int64 `json:"query_type_id"`
  320. DataApiQueryTypeIsFree bool `json:"is_free"`
  321. UnitPrice float64 `json:"unit_price"`
  322. Count int64 `json:"count"`
  323. }
  324. type ManagementDataApiSetFreeDataComboReply struct {
  325. }
  326. type ManagementQueryTypeBaseApi struct {
  327. Priority int `json:"priority" description:"优先级"`
  328. DataApiBaseApiId int64 `json:"data_api_base_api_id" description:"数据api中基础api id"`
  329. ApiId int64 `json:"api_id"`
  330. ApiName string `json:"api_name"`
  331. SaleName string `json:"sale_name"`
  332. ApiType int `json:"api_type"`
  333. Router string `json:"router"`
  334. }
  335. type ManagementQueryTypeBaseApiListReq struct {
  336. QueryTypeId int64 `json:"query_type_id"`
  337. }
  338. type ManagementQueryTypeBaseApiListReply struct {
  339. ManagementQueryTypeBaseApiList []ManagementQueryTypeBaseApi `json:"management_query_type_base_api_list"`
  340. }
  341. type ManagementDataApiComboListReq struct {
  342. QueryTypeId int64 `json:"query_type_id"`
  343. }
  344. type DataApiComboListItem struct {
  345. ComboId int64 `json:"combo_id"`
  346. ComboDesc string `json:"combo_desc" description:"套餐描述"` // desc 改为 combodesc
  347. ComboType int `json:"combo_type" description:"套餐类型"`
  348. Count int `json:"count"`
  349. Price float64 `json:"price"`
  350. //Type int `json:"type"`
  351. }
  352. type ManagementDataApiComboListReply struct {
  353. //ComboList []string `json:"combo_list"`
  354. ComboList []DataApiComboListItem `json:"combo_list"`
  355. }
  356. type TGdDataApiProviderApiRelation struct {
  357. Id int64 `json:"id"`
  358. ChildDataApiId int64 `json:"child_data_api_id"`
  359. ProviderApiId int64 `json:"provider_api_id"`
  360. GroupNo int `json:"group_no"`
  361. GroupName string `json:"group_name"`
  362. Enable bool `json:"enable"`
  363. }
  364. type GetApiInfoReq struct {
  365. Id int64 `json:"id"`
  366. }
  367. type GetApiInfoReply struct {
  368. DataApiName string `json:"data_api_name" description:"数据api名"`
  369. DataApiType int `json:"data_api_type" description:"数据api类型"`
  370. DataApiDesc string `json:"data_api_desc" description:"数据API描述"`
  371. Version string `json:"version" description:"数据api版本"`
  372. IsRelease bool `json:"is_release" description:"是否发布"`
  373. }
  374. type GetDataComboFreeReq struct {
  375. QueryTypeId int64 `json:"query_type_id"`
  376. }
  377. type GetDataComboFreeReply struct {
  378. Count int64 `json:"count"`
  379. IsFree int `json:"is_free"`
  380. }
  381. type ManagementGetFilterRuleReq struct {
  382. }
  383. type FilterRule struct {
  384. RuleId int64 `orm:"column(id)" json:"rule_id"`
  385. RuleName string `orm:"column(name)" json:"rule_name"`
  386. RuleDesc string `orm:"column(desc)" json:"rule_desc"`
  387. EffectiveParam string `orm:"column(effective_param)" json:"effective_param"`
  388. }
  389. type ManagementGetFilterRuleReply struct {
  390. Rules []FilterRule `json:"rules"`
  391. }