- 积分
- 143
- 金钱
- 132
- 威望
- 0
- 贡献
- 0
- HASS币
- 0
注册会员
- 积分
- 143
- 金钱
- 132
- HASS币
- 0
|
楼主 |
发表于 2024-6-18 08:29:49
|
显示全部楼层
后面得到的数据怎么处理自己搞一下
把里面写了“你的……”的部分改成自己的
[
{
"id": "60a3e8a3dfaa4bd2",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "与天然气服务器连接",
"method": "POST",
"ret": "obj",
"paytoqs": "ignore",
"url": "https://bol.grs.petrochina.com.cn/api/v1/open/user/passwordLogin",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json;charset=UTF-8"
}
],
"x": 320,
"y": 360,
"wires": [
[
"4aae056f50fbbbe9"
]
]
},
{
"id": "170e788526a0dc82",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "0 10-16 * * *",
"once": false,
"onceDelay": "5",
"topic": "",
"payload": "{\"mobile\":\"这里是你的手机号\",\"password\":\"这里是你的密码\",\"captcha\":\"\",\"captchaId\":\"img_captcha_a671eddd-3833-475f-a647-843ca6ca867b\"}",
"payloadType": "json",
"x": 130,
"y": 360,
"wires": [
[
"60a3e8a3dfaa4bd2"
]
]
},
{
"id": "df57ca02eb7a2cd9",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "向天然气服务器请求响应",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://bol.grs.petrochina.com.cn/api/v1/close/recharge/getUserDebt",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json;charset=UTF-8"
},
{
"keyType": "other",
"keyValue": "token",
"valueType": "msg",
"valueValue": "token"
}
],
"x": 410,
"y": 440,
"wires": [
[
"3e3a335c9f2d81b5"
]
]
},
{
"id": "4aae056f50fbbbe9",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "处理响应",
"func": "var token = msg.payload.data.token;\nvar refreshToken = msg.payload.data.refreshToken;\nmsg.token = token;\nmsg.refreshToken = refreshToken;\nmsg.payload = {\"cid\":5000000081,\"terminalType\":1};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 520,
"y": 360,
"wires": [
[
"1a851fda782bc939"
]
]
},
{
"id": "1a851fda782bc939",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "https://bol.grs.petrochina.com.cn/api/v1/close/user/getUserCode",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json;charset=UTF-8"
},
{
"keyType": "other",
"keyValue": "token",
"valueType": "msg",
"valueValue": "token"
}
],
"x": 680,
"y": 360,
"wires": [
[
"6ea857fbf60c856a"
]
]
},
{
"id": "6ea857fbf60c856a",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "再次处理响应",
"func": "msg.payload = {\"cid\":5000000081,\"userCodeId\":这里换成你的用户号};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 160,
"y": 440,
"wires": [
[
"df57ca02eb7a2cd9"
]
]
},
{
"id": "3e3a335c9f2d81b5",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "从响应中获取燃气表余额",
"func": "var responseJson = JSON.parse(msg.payload);\nvar remoteMeterBalance = responseJson.data.remoteMeterBalance;\nmsg.remoteMeterBalance = Number(remoteMeterBalance);\nif (msg.remoteMeterBalance < 2){\n msg.payload = \"请注意燃气表余额已经不足,仅剩余\" + msg.remoteMeterBalance.toFixed(2) + '元';\n msg.testflag = \"flag\";\n}else{\n msg.payload = \"\";\n msg.testflag = msg.payload;\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 690,
"y": 440,
"wires": [
[
"27bddf0a344e92b5",
"0e4f7fa418b86672",
"fa499e6bdae09d9d"
]
]
}
] |
|