softwareInfo.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import axiosInstance from './interceptor';
  2. export interface SoftwareInfo {
  3. /** 平板探测器类型 - "Simulator": 模拟设备, "Physics": 物理设备 */
  4. FPD: string;
  5. /** 发生器类型 - "Simulator": 模拟设备, "Physics": 物理设备 */
  6. GEN: string;
  7. /** 当前系统语言,如 "zh_CN.UTF-8" */
  8. current_locale: string;
  9. /** 默认系统语言,如 "zh_CN.UTF-8" */
  10. default_locale: string;
  11. language: string[];
  12. product: string;
  13. guest: string; //目前只用于急诊访问数据
  14. sn: string;
  15. server: Record<
  16. string,
  17. {
  18. build: string;
  19. desc: string;
  20. submodule: string[];
  21. version: string;
  22. }
  23. >;
  24. }
  25. export interface SoftwareInfoResponse {
  26. code: string;
  27. description: string;
  28. solution: string;
  29. data: SoftwareInfo;
  30. }
  31. export async function fetchSoftwareInfo(): Promise<SoftwareInfo> {
  32. const response = await axiosInstance.get('/pub/software_info');
  33. if (response.data && response.data.code === '0x000000') {
  34. return response.data.data;
  35. }
  36. throw new Error('Failed to fetch software info');
  37. }