index.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. // API 响应类型
  2. export interface ApiResponse<T = any> {
  3. code: number
  4. message: string
  5. data: T
  6. timestamp?: number
  7. traceId?: string
  8. }
  9. // 分页参数
  10. export interface PageParams {
  11. pageNum: number
  12. pageSize: number
  13. }
  14. // 分页响应
  15. export interface PageResult<T = any> {
  16. total: number
  17. rows: T[]
  18. }
  19. // 登录参数
  20. export interface LoginParams {
  21. username: string
  22. password: string
  23. }
  24. // 登录响应
  25. export interface LoginResponse {
  26. token: string
  27. tokenType: string
  28. expiresIn: number
  29. refreshToken?: string
  30. admin: AdminInfo
  31. }
  32. // 管理员信息
  33. export interface AdminInfo {
  34. id: number
  35. username: string
  36. nickname: string
  37. role: string
  38. lastLoginAt?: string
  39. }
  40. // 用户信息 (兼容旧代码)
  41. export interface UserInfo {
  42. id: number
  43. username: string
  44. nickname: string
  45. role: string
  46. lastLoginAt?: string
  47. }
  48. // 通道信息 (Controller 用)
  49. export interface ChannelDTO {
  50. channelId: string
  51. name: string
  52. rtspUrl: string
  53. defaultView: boolean
  54. status: 'ONLINE' | 'OFFLINE'
  55. cameraId: string
  56. }
  57. // 摄像头信息 (Controller 用)
  58. export interface CameraDTO {
  59. cameraId: string
  60. name: string
  61. machineId: string
  62. status: 'ONLINE' | 'OFFLINE'
  63. capability: 'switch_only' | 'ptz_enabled'
  64. ptzSupported: boolean
  65. channels: ChannelDTO[]
  66. }
  67. // 通道详情 (Admin 用)
  68. export interface ChannelInfoDTO {
  69. id: number
  70. channelId: string
  71. name: string
  72. rtspUrl: string
  73. defaultView: boolean
  74. status: 'ONLINE' | 'OFFLINE'
  75. }
  76. // 摄像头详情 (Admin 用)
  77. export interface CameraInfoDTO {
  78. id: number
  79. cameraId: string
  80. name: string
  81. ip: string
  82. port: number
  83. username: string
  84. brand: string
  85. capability: 'switch_only' | 'ptz_enabled'
  86. status: 'ONLINE' | 'OFFLINE'
  87. machineId: string
  88. machineName: string
  89. enabled: boolean
  90. channels: ChannelInfoDTO[]
  91. createdAt: string
  92. updatedAt: string
  93. }
  94. // 添加摄像头请求
  95. export interface CameraAddRequest {
  96. cameraId: string
  97. name: string
  98. ip: string
  99. port?: number
  100. username?: string
  101. password?: string
  102. brand?: string
  103. capability?: 'switch_only' | 'ptz_enabled'
  104. machineId?: string
  105. channels?: ChannelAddRequest[]
  106. }
  107. // 添加通道请求
  108. export interface ChannelAddRequest {
  109. channelId: string
  110. name: string
  111. rtspUrl?: string
  112. defaultView?: boolean
  113. }
  114. // 更新摄像头请求
  115. export interface CameraUpdateRequest {
  116. id: number
  117. name?: string
  118. ip?: string
  119. port?: number
  120. username?: string
  121. password?: string
  122. brand?: string
  123. capability?: 'switch_only' | 'ptz_enabled'
  124. machineId?: string
  125. enabled?: boolean
  126. channels?: ChannelUpdateRequest[]
  127. }
  128. // 更新通道请求
  129. export interface ChannelUpdateRequest {
  130. id?: number
  131. channelId?: string
  132. name?: string
  133. rtspUrl?: string
  134. defaultView?: boolean
  135. }
  136. // 切换通道请求
  137. export interface SwitchChannelRequest {
  138. machineId: string
  139. channelId: string
  140. }
  141. // 机器信息
  142. export interface MachineDTO {
  143. id: number
  144. machineId: string
  145. name: string
  146. location: string
  147. description: string
  148. enabled: boolean
  149. cameraCount: number
  150. createdAt: string
  151. updatedAt: string
  152. }
  153. // 添加机器请求
  154. export interface MachineAddRequest {
  155. machineId: string
  156. name: string
  157. location?: string
  158. description?: string
  159. }
  160. // 更新机器请求
  161. export interface MachineUpdateRequest {
  162. id: number
  163. name?: string
  164. location?: string
  165. description?: string
  166. enabled?: boolean
  167. }
  168. // 仪表盘统计
  169. export interface DashboardStatsDTO {
  170. machineTotal: number
  171. machineEnabled: number
  172. cameraTotal: number
  173. cameraOnline: number
  174. cameraOffline: number
  175. channelTotal: number
  176. }
  177. // 修改密码请求
  178. export interface ChangePasswordRequest {
  179. oldPassword: string
  180. newPassword: string
  181. }
  182. // PTZ 动作类型
  183. export type PTZAction = 'up' | 'down' | 'left' | 'right' | 'zoom_in' | 'zoom_out' | 'stop'
  184. // 兼容旧代码的类型别名
  185. export type CameraDevice = CameraInfoDTO
  186. export type CameraChannel = ChannelInfoDTO
  187. // 播放响应 (保留用于视频播放)
  188. export interface PlayResponse {
  189. streamId: string
  190. flv: string
  191. ws_flv?: string
  192. rtsp?: string
  193. rtmp?: string
  194. hls?: string
  195. rtc?: string
  196. mediaServerId?: string
  197. deviceId?: string
  198. channelId?: string
  199. }
  200. // 录像记录 (保留用于视频回放)
  201. export interface RecordItem {
  202. name?: string
  203. start: number
  204. end: number
  205. secrecy?: number
  206. type?: string
  207. }