@@ -15,6 +15,7 @@ from tornado.web import Application, RequestHandler, StaticFileHandler |
||
15 | 15 |
|
16 | 16 |
from utils.boxinfo import get_box_status, get_mac_address |
17 | 17 |
from utils.logit import log_request_arguments, logit |
18 |
+from utils.servertime import local_string |
|
18 | 19 |
from utils.sqlite import (CREATE_INDEX1, CREATE_INDEX2, CREATE_TABLE_STMT, DELETE_RECORD_STMT, INSERT_RECORD_STMT, |
19 | 20 |
SELECT_MAX_PHOTO_ID_STMT, SELECT_ORIGIN_PATH_STMT) |
20 | 21 |
from utils.tv import get_last_photo_path |
@@ -295,6 +296,16 @@ class BoxInfoHandler(RequestHandler): |
||
295 | 296 |
}) |
296 | 297 |
|
297 | 298 |
|
299 |
+class BoxTimeHandler(RequestHandler): |
|
300 |
+ def post(self): |
|
301 |
+ self.write({ |
|
302 |
+ 'status': 200, |
|
303 |
+ 'data': { |
|
304 |
+ 'time': local_string(), |
|
305 |
+ } |
|
306 |
+ }) |
|
307 |
+ |
|
308 |
+ |
|
298 | 309 |
class LastPhotoHandler(RequestHandler): |
299 | 310 |
def post(self): |
300 | 311 |
self.write({ |
@@ -313,6 +324,7 @@ handlers = [ |
||
313 | 324 |
(r'/fetch_origin', FetchOriginHandler), |
314 | 325 |
(r'/delete_photo', DeletePhotoHandler), |
315 | 326 |
(r'/box_info', BoxInfoHandler), |
327 |
+ (r'/box_time', BoxTimeHandler), |
|
316 | 328 |
(r'/static/(.*)', StaticFileHandler, {'path': ROOT_PATH}), |
317 | 329 |
# TV APP |
318 | 330 |
(r'/last_photo', LastPhotoHandler), |
@@ -0,0 +1,8 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+ |
|
4 |
+import time |
|
5 |
+ |
|
6 |
+ |
|
7 |
+def local_string(): |
|
8 |
+ return time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()) |