rabin há 6 anos atrás
pai
commit
09614b36bd
1 ficheiros alterados com 12 adições e 12 exclusões
  1. 12 12
      front/api/main.py

+ 12 - 12
front/api/main.py

@@ -1,9 +1,9 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 """
-    demeter web
-    name:main.py 主界面相关api
-    author:rabin
+	demeter web
+	name:main.py 主界面相关api
+	author:rabin
 """
 from __load__ import *
 
@@ -23,7 +23,7 @@ class index_path(Load):
 
 	@apiSuccess {Object[]} gateway 网关信息(环境监测)
 	@apiSuccess {String}   gateway.name  网关名称
-	@apiSuccess {String}   gateway.id    网关ID
+	@apiSuccess {String}   gateway.id	网关ID
 	@apiErrorExample 操作成功
 	{"status": 1, "msg": "yes", "code": 0, "data": {"farm": {"info": "3123fdf", "master_name": "31232", "tel": "323", "name": "\u9ed8\u8ba4\u56ed\u533a", "pic": "http://192.168.15.10:8087/upload/2017/09/27/5c3d27b95a0375cd5c0eab03c61a494a.jpg", "cdate": 1506496822, "gateway": "", "master_pic": "", "state": true, "location": "", "address": "312", "id": 1}, "gateway": [{"stat": false, "pic": null, "hardware_id": 10086, "farm_id": 1, "cdate": 1506496123, "state": true, "camera": null, "id": "542535db-6c0b-51fc-9f73-cafb3872ce76", "name": "\u9ed8\u8ba4\u7f51\u5173"}], "setting": {"farm": 1, "user": "229cfd36-9399-5599-b2b5-c53174c3de19", "name": "\u519c\u5c0f\u76d2", "copyright": "2017 nongxiaohe.com v1.0.0", "site": "http://www.nongxiaohe.com/"}, "base": {}, "msg": 0}}
 	@apiErrorExample 操作失败
@@ -42,11 +42,11 @@ class index_path(Load):
 		self.data['msg'] = len(self.service('common').list('msg', search={'status':False, "farm_id":self.data['setting']['farm']}, limit='0,100'))
 		if self.data['msg'] > 99:
 			self.data['msg'] = str(99) + '+'
-            
-        self.data['pic'] = []
-        pic = self.service('common').list('device_info', state=True, search={'hardware_type':6, 'farm_id':self.data['info']['farm_id']})
-        if pic:
-          for key, value in enumerate(pic):
-            pic[key]['cdates'] = Demeter.date(value['cdate'])
-            self.data['pic'] = pic
-        self.out('yes', self.data)
+			
+		self.data['pic'] = []
+		pic = self.service('common').list('device_info', state=True, search={'hardware_type':6, 'farm_id':self.data['info']['farm_id']})
+		if pic:
+			for key, value in enumerate(pic):
+				pic[key]['cdates'] = Demeter.date(value['cdate'])
+			self.data['pic'] = pic
+		self.out('yes', self.data)