1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = url => {
if (!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '');
}
};
export const API = {
AUTHORIZATION_TOKEN: '/PandaCore/Identity/AuthorizationToken', // 授权验证,不需要走网关加前缀
GET_GATEWAY_CONFIG: '/PandaOMS/OMS/HostManager/GetGateWay',
GET_CONFIG: '/PandaOMS/OMS/WebSite/GetConfig',
GENERATE_TOKEN: '/PandaCore/GCK/BussinessAuth/GenerateToken',
GENERATE_IOT_TOKEN: '/PandaCore/GCK/BussinessAuth/GenerateTokenGCK',
GENERATE_QRCODE: 'cityinterface/rest/services.svc/generatetokenByqrcode',
GENERATE_TOKEN_CHANGE: '/cityinterface/rest/services.svc/generatetokenquick',
GET_WEB_SITE_CONFIG: '/PandaOMS/OMS/WebSite/GetWebSiteConfig',
// GET_WEB_SITE_CONFIG: '/CityInterface/rest/services.svc/GetWebSiteConfig',
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
GET_GATEWAY_USER_INFO: '/PandaCore/GCK/Basis/GetUserInfo',
GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo',
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
GET_CITY:
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER:
'/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
CHANGE_PASSWORD: 'cityinterface/rest/services.svc/changepassword',
IOT_CHANGE_PASSWORD:
'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK',
FILE_DOWNLOAD: '/cityinterface/rest/services/filedownload.svc/download',
GET_VERSION: '/CityInterface/rest/services/OMs.svc/U_GetVersion',
UPDATE_AVATAR: '/CityInterface/rest/services/OMs.svc/U_EditUser',
UPLOAD_FILE_URL:
'/cityinterface/rest/services/filedownload.svc/uploadfile/个人信息/{path}/{filename}',
AVATAR_FILE_URL: '/cityinterface/rest/services/filedownload.svc/download',
GET_SENSOR_TYPE: '/PandaCore/GCK/Sensor/GetSensorType', // 获取传感器类型
GET_SYSTEM_CONFIGURATION: '/PandaCore/GCK/Common/SysConfiguration', // 获取系统配置
GET_INFO_QYWX: '/CityInterface/rest/services/OA.svc/WeChatScanQRCode',
PV_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SavePVLogInfo',
LOGIN_LOGS:
'CityInterface/rest/Services/IOTPlatform.svc/WisdomOMS/SaveLoginInfo',
GET_PAGE_PART_INFO:
'/CityInterface/rest/services/CountyProduct.svc/AccountManage/GetHomePagePartInfo',
SAVE_Page_PART_INFO:
'/CityInterface/rest/services/CountyProduct.svc/AccountManage/SaveHomePage',
GET_TOKEN_QYWX: '/CityInterface/rest/services/portal.svc/OMManage/WeChatScanQRCode',
VALID_DEFAULT_PWD: '/PandaCore/GCK/BussinessAuth/ValidToken', // 校验是否是默认密码
GET_InOnLine:'/PandaEnergy/GZshuiwuju/GuangZhou/InOnLine', //广州登陆接口
};
const services = {
getInOnLine :{
url:API.GET_InOnLine,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
authorizationToken: {
url: API.AUTHORIZATION_TOKEN,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getWateWayConfig: {
url: API.GET_GATEWAY_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
queryConfig: {
url: API.GET_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
generatetokenByqrcode: {
url: API.GENERATE_QRCODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getWebSiteConfig: {
url: API.GET_WEB_SITE_CONFIG,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getUserInfo: {
url: () =>
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getOA: {
url: API.GET_OA,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getInfo: {
url: () => window.location.origin.replace(/^(http|https):\/\//, '') === 'mis.panda-water.cn' ? API.GET_INFO_QYWX : API.GET_TOKEN_QYWX,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
writeLogs: {
url: API.GET_LOGS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
getCity: {
url: API.GET_CITY,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
generateTokenQuick: {
url: API.GENERATE_TOKEN_CHANGE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getAllGroupsInfoForUser: {
url: API.GET_ALL_GROUPS_INFO_FORUSER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getWeather: {
url: API.GET_WEATHER,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
sendMessVerificationCode: {
url: API.SEND_MESSAGE_CODE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getVersion: {
url: API.GET_VERSION,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
updateAvatar: {
url: API.UPDATE_AVATAR,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
generateToken: {
url: () =>
window.globalConfig &&
(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ||
window.globalConfig.loginTemplate === '新春 - 智联.html')
? API.GENERATE_IOT_TOKEN
: API.GENERATE_TOKEN,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
changePassword: {
url: () =>
window.globalConfig &&
(window.globalConfig.loginTemplate === 'Dark - IOTMultiLogin.html' ||
window.globalConfig.loginTemplate === '新春 - 智联.html')
? API.IOT_CHANGE_PASSWORD
: API.CHANGE_PASSWORD,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
// Sensor 指标管理
getSensorType: {
url: API.GET_SENSOR_TYPE,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
sysConfiguration: {
url: API.GET_SYSTEM_CONFIGURATION,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
pvLogs: {
url: API.PV_LOGS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
loginLogs: {
url: API.LOGIN_LOGS,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
},
getPagePartInfo: {
url: API.GET_PAGE_PART_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
validDefaultPWD: {
url: API.VALID_DEFAULT_PWD,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
}
};
export const searchAutoCity = keywords => {
const url = 'https://restapi.amap.com/v3/assistant/inputtips';
const options = {
callback: `jsonp_${new Date().getTime()}`,
};
const params = Object.assign(
{},
{
s: 'rsv3',
key: 'e83f64300a2a55a33fa8e4ab9a46bca6',
platform: 'JS',
logversion: '2.0',
csid: '5A098355-8164-41D5-A2DC-78E1471CCD28',
appname: window.location.href,
sdkversion: '1.4.15',
keywords,
},
);
return jsonp(url, params, options);
};
export const getUserInfo = params => {
const url =
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO;
return request({
url,
method: constants.REQUEST_METHOD_GET,
params,
// params: param.query,
});
};
export const getWebSiteConfig = params => {
const url = API.GET_WEB_SITE_CONFIG;
return request({
url,
method: constants.REQUEST_METHOD_GET,
params,
// params: param.query,
});
};
// 更新常用页
export const savePagePartInfo = param =>
request({
url: API.SAVE_Page_PART_INFO,
method: constants.REQUEST_METHOD_POST,
data: param.data,
params: param.query,
});
export default services;