common.ts 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // API response type definitions
  2. export interface ApiResponse<T = unknown> {
  3. code: number
  4. data: T
  5. msg: string
  6. }
  7. /**
  8. * /base/consts/config 返回的 data 结构
  9. */
  10. export interface CommonAreaConstItem {
  11. code: string
  12. name: string
  13. }
  14. export interface BaseConstsConfig {
  15. commonAreaConsts?: CommonAreaConstItem[]
  16. /**
  17. * 汇率配置(示例):
  18. * [
  19. * { "IDR": 1000, "goldCoin": 1 },
  20. * { "IDR": 1, "bean": 1 },
  21. * { "diamond": 1, "IDR": 1 }
  22. * ]
  23. */
  24. commonCoinExchangeConsts?: Array<Record<string, number>>
  25. [key: string]: unknown
  26. }
  27. // Request config type
  28. export interface RequestConfig {
  29. method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
  30. headers?: Record<string, string>
  31. params?: Record<string, unknown>
  32. data?: unknown
  33. timeout?: number
  34. needAuth?: boolean
  35. }
  36. // Pagination request
  37. export interface PaginationParams {
  38. page: number
  39. pageSize: number
  40. }
  41. // Pagination response
  42. export interface PaginationResponse<T> {
  43. list: T[]
  44. total: number
  45. page: number
  46. pageSize: number
  47. }