Merge branch 'develop'

pull/100/head
13621160019@163.com 2021-12-07 20:02:01 +08:00
commit 9504aa856f
5 changed files with 20 additions and 13 deletions

2
admin/nginx.conf vendored
View File

@ -46,7 +46,7 @@ http {
}
location /api {
proxy_pass http://192.168.1.6:8000/;
proxy_pass http://127.0.0.1:8000/;
proxy_connect_timeout 75;
proxy_read_timeout 600;
send_timeout 600;

View File

@ -1315,7 +1315,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
@ -1476,7 +1476,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
@ -4758,7 +4758,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
@ -4788,7 +4788,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
@ -4819,7 +4819,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
@ -4853,19 +4853,19 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}
],
"url": {
"raw": "{{base_url}}/points/2",
"raw": "{{base_url}}/points/11",
"host": [
"{{base_url}}"
],
"path": [
"points",
"2"
"11"
]
}
},
@ -4884,7 +4884,7 @@
},
{
"key": "Token",
"value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f",
"value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1",
"type": "text",
"description": "Login to get a valid token"
}

View File

@ -1190,7 +1190,7 @@ curl -i -X GET {{base_url}}/offlinemeterfiles/{id}/restore
* GET Point by ID
```bash
curl -i -X GET {{base_url}}/points/{id}
curl -i -H "User-UUID: dcdb67d1-6116-4987-916f-6fc6cf2bc0e4" -H "Token: GET-TOKEN-AFTER-LOGIN" -X GET {{base_url}}/points/{id}
```
Result in JSON
@ -1225,7 +1225,7 @@ Result in JSON
* GET all Points
```bash
curl -i -X GET {{base_url}}/points
curl -i -H "User-UUID: dcdb67d1-6116-4987-916f-6fc6cf2bc0e4" -H "Token: GET-TOKEN-AFTER-LOGIN" -X GET {{base_url}}/points
```
* DELETE Point by ID
```bash

View File

@ -17,6 +17,8 @@ class PointCollection:
@staticmethod
def on_get(req, resp):
"""Handles GET requests"""
access_control(req)
cnx = mysql.connector.connect(**config.myems_system_db)
cursor = cnx.cursor(dictionary=True)
@ -64,6 +66,7 @@ class PointCollection:
@user_logger
def on_post(req, resp):
"""Handles POST requests"""
access_control(req)
try:
raw_json = req.stream.read().decode('utf-8')
except Exception as ex:
@ -206,6 +209,8 @@ class PointItem:
@staticmethod
def on_get(req, resp, id_):
"""Handles GET requests"""
access_control(req)
if not id_.isdigit() or int(id_) <= 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_POINT_ID')
@ -255,6 +260,7 @@ class PointItem:
@staticmethod
@user_logger
def on_delete(req, resp, id_):
access_control(req)
if not id_.isdigit() or int(id_) <= 0:
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_POINT_ID')
@ -395,6 +401,7 @@ class PointItem:
@user_logger
def on_put(req, resp, id_):
"""Handles PUT requests"""
access_control(req)
try:
raw_json = req.stream.read().decode('utf-8')
except Exception as ex:

2
web/nginx.conf vendored
View File

@ -47,7 +47,7 @@ http {
}
location /api {
proxy_pass http://192.168.1.6:8000/;
proxy_pass http://127.0.0.1:8000/;
proxy_connect_timeout 75;
proxy_read_timeout 600;
send_timeout 600;