add new endpoints for app v2 #116
1 changed files with 274 additions and 274 deletions
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
import asyncio
|
||||
from aiohttp import web
|
||||
from bumper import plugins
|
||||
import logging
|
||||
import bumper
|
||||
from bumper.models import *
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
from bumper import plugins
|
||||
from datetime import datetime, timedelta
|
||||
from bumper.models import *
|
||||
|
||||
|
||||
class v1_private_common(plugins.ConfServerApp):
|
||||
|
|
@ -140,7 +138,71 @@ class v1_private_common(plugins.ConfServerApp):
|
|||
try:
|
||||
body = {
|
||||
"code": bumper.RETURN_API_SUCCESS,
|
||||
"data": {"currentVersion": 231,
|
||||
"data": AREA_LIST,
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": self.get_milli_time(datetime.utcnow().timestamp()),
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
async def handle_getAgreementURLBatch(self, request): # EcoVacs Home
|
||||
try:
|
||||
body = {
|
||||
"code": bumper.RETURN_API_SUCCESS,
|
||||
"data": [
|
||||
{
|
||||
"acceptTime": None,
|
||||
"force": None,
|
||||
"id": "20180804040641_7d746faf18b8cb22a50d145598fe4c90",
|
||||
"type": "USER",
|
||||
"url": "https://gl-eu-wap.ecovacs.com/content/agreement?id=20180804040641_7d746faf18b8cb22a50d145598fe4c90&language=EN",
|
||||
"version": "1.03"
|
||||
},
|
||||
{
|
||||
"acceptTime": None,
|
||||
"force": None,
|
||||
"id": "20180804040245_4e7c56dfb7ebd3b81b1f2747d0859fac",
|
||||
"type": "PRIVACY",
|
||||
"url": "https://gl-eu-wap.ecovacs.com/content/agreement?id=20180804040245_4e7c56dfb7ebd3b81b1f2747d0859fac&language=EN",
|
||||
"version": "1.03"
|
||||
}
|
||||
],
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": self.get_milli_time(datetime.utcnow().timestamp()),
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
async def handle_getTimestamp(self, request): # EcoVacs Home
|
||||
try:
|
||||
time = self.get_milli_time(datetime.utcnow().timestamp())
|
||||
body = {
|
||||
"code": bumper.RETURN_API_SUCCESS,
|
||||
"data": {
|
||||
"timestamp": time
|
||||
},
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": time,
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
|
||||
plugin = v1_private_common()
|
||||
|
||||
AREA_LIST = {"currentVersion": 231,
|
||||
"areaList": [{"areaKey": "JP", "chsName": "日本", "enName": "Japan", "pyFirst": "R"},
|
||||
{"areaKey": "MY", "chsName": "马来西亚", "enName": "Malaysia", "pyFirst": "M"},
|
||||
{"areaKey": "DE", "chsName": "德国", "enName": "Germany", "pyFirst": "D"},
|
||||
|
|
@ -397,66 +459,4 @@ class v1_private_common(plugins.ConfServerApp):
|
|||
{"areaKey": "UG", "chsName": "乌干达", "enName": "Uganda", "pyFirst": "W"},
|
||||
{"areaKey": "HU", "chsName": "匈牙利", "enName": "Hungary", "pyFirst": "X"},
|
||||
{"areaKey": "TC", "chsName": "特克斯和凯科斯群岛", "enName": "Turks and Caicos Islands",
|
||||
"pyFirst": "T"}]},
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": self.get_milli_time(datetime.utcnow().timestamp()),
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
async def handle_getAgreementURLBatch(self, request): # EcoVacs Home
|
||||
try:
|
||||
body = {
|
||||
"code": bumper.RETURN_API_SUCCESS,
|
||||
"data": [
|
||||
{
|
||||
"acceptTime": None,
|
||||
"force": None,
|
||||
"id": "20180804040641_7d746faf18b8cb22a50d145598fe4c90",
|
||||
"type": "USER",
|
||||
"url": "https://gl-eu-wap.ecovacs.com/content/agreement?id=20180804040641_7d746faf18b8cb22a50d145598fe4c90&language=EN",
|
||||
"version": "1.03"
|
||||
},
|
||||
{
|
||||
"acceptTime": None,
|
||||
"force": None,
|
||||
"id": "20180804040245_4e7c56dfb7ebd3b81b1f2747d0859fac",
|
||||
"type": "PRIVACY",
|
||||
"url": "https://gl-eu-wap.ecovacs.com/content/agreement?id=20180804040245_4e7c56dfb7ebd3b81b1f2747d0859fac&language=EN",
|
||||
"version": "1.03"
|
||||
}
|
||||
],
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": self.get_milli_time(datetime.utcnow().timestamp()),
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
async def handle_getTimestamp(self, request): # EcoVacs Home
|
||||
try:
|
||||
time = self.get_milli_time(datetime.utcnow().timestamp())
|
||||
body = {
|
||||
"code": bumper.RETURN_API_SUCCESS,
|
||||
"data": {
|
||||
"timestamp": time
|
||||
},
|
||||
"msg": "操作成功",
|
||||
"success": True,
|
||||
"time": time,
|
||||
}
|
||||
|
||||
return web.json_response(body)
|
||||
|
||||
except Exception as e:
|
||||
logging.exception("{}".format(e))
|
||||
|
||||
plugin = v1_private_common()
|
||||
|
||||
"pyFirst": "T"}]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue