environment.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /** 登录接口 POST /api/login/account */
  2. import { request } from 'umi';
  3. import { projectObj } from '@/config/api';
  4. import UserStorage from '@/config/sagacare/sagacare_user';
  5. function getProjectId() {
  6. const id = projectObj.projectId;
  7. return id;
  8. }
  9. function commonParams() {
  10. var userObj = UserStorage.getInstance();
  11. const user = userObj.getUser();
  12. var pubname = 'sgadmin';
  13. return `openid=${user.id}&pubname=${pubname}&projectId=${getProjectId()}&userId=${
  14. user.id
  15. }&userName=${user.name}&userPhone=${user.phone}`;
  16. }
  17. export async function getMapList(body: any, options?: { [key: string]: any }) {
  18. return request<API.MapInfoRes>(
  19. `/sgadmin/duoduo-service/setup-service/map/queryMapInfo?${commonParams()}`,
  20. {
  21. method: 'POST',
  22. headers: {
  23. 'Content-Type': 'application/json',
  24. },
  25. ...(options || {}),
  26. data: body,
  27. },
  28. );
  29. }
  30. export async function getBuildingList(body: any, options?: { [key: string]: any }) {
  31. //debugger;
  32. return request<API.BuildFloorList>(
  33. `/sgadmin/duoduo-service/object-service/object/building/query?${commonParams()}`,
  34. {
  35. method: 'POST',
  36. headers: {
  37. 'Content-Type': 'application/json',
  38. },
  39. ...(options || {}),
  40. data: body,
  41. },
  42. );
  43. }
  44. export async function getFloorList(body: any, options?: { [key: string]: any }) {
  45. // debugger;
  46. return request<API.BuildFloorList>(
  47. `/sgadmin/duoduo-service/object-service/object/floor/query?${commonParams()}`,
  48. {
  49. method: 'POST',
  50. headers: {
  51. 'Content-Type': 'application/json',
  52. },
  53. ...(options || {}),
  54. data: body,
  55. },
  56. );
  57. }
  58. export async function queryDeviceTimeManage(params: any, options?: { [key: string]: any }) {
  59. // '/api3/duoduo-service/setup-service/deviceManage/getDeviceTimeManageData'
  60. return request<API.DeviceTimeType>(
  61. `/sgadmin/duoduo-service/setup-service/deviceManage/getDeviceTimeManageData?${commonParams()}`,
  62. {
  63. method: 'GET',
  64. params: {
  65. ...params,
  66. },
  67. ...(options || {}),
  68. },
  69. );
  70. }
  71. // chart
  72. export async function queryPropertyData(params: any, options?: { [key: string]: any }) {
  73. return request<API.DeviceTimeType>(
  74. `/sgadmin/duoduo-service/duoduoenv-service/spaceAdjust/queryPropertyData?${commonParams()}`,
  75. {
  76. method: 'GET',
  77. params: params,
  78. ...(options || {}),
  79. },
  80. );
  81. }
  82. // 有人无人
  83. export async function getSpaceAdjustArray(body: any, otherParam: any) {
  84. return request<API.DeviceTimeType>(`/sgadmin/server/space/queryAll?${commonParams()}`, {
  85. method: 'POST',
  86. headers: {
  87. 'Content-Type': 'application/json',
  88. },
  89. data: body,
  90. });
  91. }
  92. export async function queryEnvironmentParam(body: any, otherParam: { [key: string]: any }) {
  93. //api/duoduo-service/object-service/object/floor/queryParam
  94. return request<API.EnvironmentParam>(
  95. `/sgadmin/duoduo-service/object-service/object/floor/queryParam?endTime=${otherParam.endTime}&startTime=${otherParam.startTime}&param=${otherParam.param}`,
  96. {
  97. method: 'POST',
  98. headers: {
  99. 'Content-Type': 'application/json',
  100. },
  101. data: body,
  102. },
  103. );
  104. }
  105. export async function getSeasonType(params: any, options?: { [key: string]: any }) {
  106. return request<API.EnvironmentParam>(
  107. `/sgadmin/duoduo-service/custom-service/custom/getSeasonType`,
  108. {
  109. method: 'GET',
  110. headers: {
  111. 'Content-Type': 'application/json',
  112. },
  113. ...(options || {}),
  114. params: {
  115. ...params,
  116. },
  117. },
  118. );
  119. }
  120. export async function queryEquipStatistics(params: any, options?: { [key: string]: any }) {
  121. //
  122. return request<API.EnvironmentParam>(
  123. `/sgadmin/duoduo-service/object-service/object/equipment/queryEquipStatistics`,
  124. {
  125. method: 'GET',
  126. headers: {
  127. 'Content-Type': 'application/json',
  128. },
  129. ...(options || {}),
  130. params: {
  131. ...params,
  132. },
  133. },
  134. );
  135. }
  136. export async function querySpace(body: any, options?: { [key: string]: any }) {
  137. //
  138. return request<API.EnvironmentParam>(
  139. `/sgadmin/duoduo-service/object-service/object/space/query?${commonParams()}`,
  140. {
  141. method: 'POST',
  142. headers: {
  143. 'Content-Type': 'application/json',
  144. },
  145. ...(options || {}),
  146. data: body,
  147. },
  148. );
  149. }
  150. export async function checkToken(header: any, options?: { [key: string]: any }) {
  151. return request<API.EnvironmentParam>(`/sgadmin/duoduo-service/setup-service/user/zjCheckToken`, {
  152. method: 'GET',
  153. headers: {
  154. 'Content-Type': 'application/json',
  155. ...header,
  156. },
  157. ...(options || {}),
  158. });
  159. }
  160. //http://10.100.28.79/sgadmin/sso//auth/zjFreshCheckToken
  161. export async function reFreshCheckToken(header: any, options?: { [key: string]: any }) {
  162. return request<API.EnvironmentParam>(`/sgadmin/sso/auth/zjFreshCheckToken`, {
  163. method: 'GET',
  164. headers: {
  165. 'Content-Type': 'application/json',
  166. ...header,
  167. },
  168. ...(options || {}),
  169. });
  170. }