environment.ts 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. from: 'sagacare',
  26. ...(options || {}),
  27. data: body,
  28. },
  29. );
  30. }
  31. export async function getBuildingList(body: any, options?: { [key: string]: any }) {
  32. //debugger;
  33. return request<API.BuildFloorList>(
  34. `/sgadmin/duoduo-service/object-service/object/building/query?${commonParams()}`,
  35. {
  36. method: 'POST',
  37. headers: {
  38. 'Content-Type': 'application/json',
  39. },
  40. from: 'sagacare',
  41. ...(options || {}),
  42. data: body,
  43. },
  44. );
  45. }
  46. export async function getFloorList(body: any, options?: { [key: string]: any }) {
  47. // debugger;
  48. return request<API.BuildFloorList>(
  49. `/sgadmin/duoduo-service/object-service/object/floor/query?${commonParams()}`,
  50. {
  51. method: 'POST',
  52. headers: {
  53. 'Content-Type': 'application/json',
  54. },
  55. from: 'sagacare',
  56. ...(options || {}),
  57. data: body,
  58. },
  59. );
  60. }
  61. export async function queryDeviceTimeManage(params: any, options?: { [key: string]: any }) {
  62. // '/api3/duoduo-service/setup-service/deviceManage/getDeviceTimeManageData'
  63. return request<API.DeviceTimeType>(
  64. `/sgadmin/duoduo-service/setup-service/deviceManage/getDeviceTimeManageData?${commonParams()}`,
  65. {
  66. method: 'GET',
  67. from: 'sagacare',
  68. params: {
  69. ...params,
  70. },
  71. ...(options || {}),
  72. },
  73. );
  74. }
  75. // chart
  76. export async function queryPropertyData(params: any, options?: { [key: string]: any }) {
  77. return request<API.DeviceTimeType>(
  78. `/sgadmin/duoduo-service/duoduoenv-service/spaceAdjust/queryPropertyData?${commonParams()}`,
  79. {
  80. method: 'GET',
  81. from: 'sagacare',
  82. params: params,
  83. ...(options || {}),
  84. },
  85. );
  86. }
  87. // 有人无人
  88. export async function getSpaceAdjustArray(params: any) {
  89. return request<API.DeviceTimeType>(
  90. `/sgadmin/duoduo-service/object-service/object/equipment/queryFloorSpaceStatus?projectId=${getProjectId()}&floorId=${
  91. params.floorId
  92. }&equipType=bodySensor&booleanInfoCode=isPassengerPass&expireTime=5`,
  93. {
  94. from: 'sagacare',
  95. method: 'GET',
  96. headers: {
  97. 'Content-Type': 'application/json',
  98. },
  99. },
  100. );
  101. }
  102. export async function queryEnvironmentParam(body: any, otherParam: { [key: string]: any }) {
  103. //api/duoduo-service/object-service/object/floor/queryParam
  104. return request<API.EnvironmentParam>(
  105. `/sgadmin/duoduo-service/object-service/object/floor/queryParam?endTime=${otherParam.endTime}&startTime=${otherParam.startTime}&param=${otherParam.param}`,
  106. {
  107. method: 'POST',
  108. from: 'sagacare',
  109. headers: {
  110. 'Content-Type': 'application/json',
  111. },
  112. data: body,
  113. },
  114. );
  115. }
  116. export async function getSeasonType(params: any, options?: { [key: string]: any }) {
  117. return request<API.EnvironmentParam>(
  118. `/sgadmin/duoduo-service/custom-service/custom/getSeasonType`,
  119. {
  120. method: 'GET',
  121. from: 'sagacare',
  122. headers: {
  123. 'Content-Type': 'application/json',
  124. },
  125. ...(options || {}),
  126. params: {
  127. ...params,
  128. },
  129. },
  130. );
  131. }
  132. export async function queryEquipStatistics(params: any, options?: { [key: string]: any }) {
  133. ///sgadmin/duoduo-service/object-service/object/equipment/queryEquipStatistics
  134. return request<API.EnvironmentParam>(
  135. `/sgadmin/duoduo-service/object-service/object/equipment/queryEquipStatistics`,
  136. {
  137. method: 'GET',
  138. from: 'sagacare',
  139. headers: {
  140. 'Content-Type': 'application/json',
  141. },
  142. ...(options || {}),
  143. params: {
  144. ...params,
  145. },
  146. },
  147. );
  148. }
  149. export async function querySpace(body: any, options?: { [key: string]: any }) {
  150. //
  151. return request<API.EnvironmentParam>(
  152. `/sgadmin/duoduo-service/object-service/object/space/query?${commonParams()}`,
  153. {
  154. method: 'POST',
  155. from: 'sagacare',
  156. headers: {
  157. 'Content-Type': 'application/json',
  158. },
  159. ...(options || {}),
  160. data: body,
  161. },
  162. );
  163. }
  164. export async function checkToken(header: any, options?: { [key: string]: any }) {
  165. return request<API.EnvironmentParam>(`/sgadmin/duoduo-service/setup-service/user/zjCheckToken`, {
  166. method: 'GET',
  167. from: 'sagacare',
  168. headers: {
  169. 'Content-Type': 'application/json',
  170. ...header,
  171. },
  172. ...(options || {}),
  173. });
  174. }
  175. //http://10.100.28.79/sgadmin/sso//auth/zjFreshCheckToken
  176. export async function reFreshCheckToken(header: any, options?: { [key: string]: any }) {
  177. return request<API.EnvironmentParam>(`/sgadmin/sso/auth/zjFreshCheckToken`, {
  178. method: 'GET',
  179. from: 'sagacare',
  180. headers: {
  181. 'Content-Type': 'application/json',
  182. ...header,
  183. },
  184. ...(options || {}),
  185. });
  186. }
  187. export async function queryProjectId(body: any, options?: { [key: string]: any }) {
  188. return request<API.EnvironmentParam>(`/sgadmin/duoduo-service/setup-service/pjSet/query`, {
  189. method: 'POST',
  190. from: 'sagacare',
  191. headers: {
  192. 'Content-Type': 'application/json',
  193. },
  194. ...(options || {}),
  195. data: body,
  196. });
  197. }
  198. // 项目拥有的设备
  199. export async function queryProjectEquipType() {
  200. return request<API.EnvironmentParam>(
  201. `/sgadmin/duoduo-service/object-service/object/equipment/queryProjectEquipType?${commonParams()}`,
  202. {
  203. from: 'sagacare',
  204. method: 'GET',
  205. headers: {
  206. 'Content-Type': 'application/json',
  207. },
  208. },
  209. );
  210. }
  211. export const getUserInfo = (uid: string) => {
  212. return request(`/user/${uid}`, {
  213. method: 'get',
  214. });
  215. };