rabin 7 lat temu
rodzic
commit
1b6ac0e2f6

+ 9 - 0
admin/page/admin.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class admin_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'管理员' #中文名
@@ -25,6 +26,7 @@ class admin_path(Load):
 
 class admin_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/admin/admin'
@@ -35,12 +37,14 @@ class admin_update_path(Load):
 		self.commonOne('manage_admin')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('manage_admin', '手机号已经被注册', mobile=self.data['update']['mobile'])
 
 
 class role_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'角色'
@@ -60,6 +64,7 @@ class role_path(Load):
 
 class role_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		auth = self.data['setting']['menuList']
 		self.common(
@@ -75,14 +80,17 @@ class role_update_path(Load):
 		self.commonOne('manage_role')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('manage_role')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('manage_role')
 
 class log_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'日志' #中文名
@@ -101,6 +109,7 @@ class log_path(Load):
 
 class setCookie_path(Load):
 	@Web.auth
+	@Web.setting
 	def post(self):
 		value = self.input('farm', Demeter.config['setting']['farm'])
 		self.set_secure_cookie('farm', value)

+ 78 - 13
admin/page/device.py

@@ -9,6 +9,8 @@ from __load__ import *
 
 class gateway_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'网关'
@@ -45,6 +47,8 @@ class gateway_path(Load):
 
 class gateway_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		if id:
@@ -60,15 +64,21 @@ class gateway_update_path(Load):
 		self.commonOne('device_gateway')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.commonUpdate('device_gateway')
 		self.device(id)
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_gateway')
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def device(self, id):
 		info = self.service('common').one('device_gateway', id=id)
 		hardware_id = info['hardware_id']
@@ -76,6 +86,8 @@ class gateway_update_path(Load):
 		
 class info_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'设备'
@@ -102,7 +114,7 @@ class info_path(Load):
 		if status:
 			self.data['search']['status'] = False
 
-		self.commonList('device_info', order='id desc')
+		self.commonList('device_info', order='inorder asc, type_id asc,udate asc')
 		if self.data['list']:
 			for key, value in enumerate(self.data['list']):
 				farm = self.service('common').one('farm', id=value['farm_id'])
@@ -138,6 +150,7 @@ class info_path(Load):
 						self.data['list'][key]['value'] = '<input type="checkbox" name="switch" lay-filter="switch" lay-skin="switch" checked '+status+' value="1" data-value="0" data-id="'+value['id']+'" data-url="'+url+'">'
 					else:
 						self.data['list'][key]['value'] = '<input type="checkbox" lay-filter="switch" name="switch" lay-skin="switch" '+status+' value="0" data-value="1" data-id="'+value['id']+'" data-url="'+url+'">'
+					self.data['list'][key]['value'] = ''
 				elif value['hardware_type'] == 5:
 					if value['value'] == '1':
 						self.data['list'][key]['value'] = '已连接'
@@ -151,6 +164,8 @@ class info_path(Load):
 		self.commonView('list')
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		value = self.input('value')
@@ -162,6 +177,8 @@ class info_path(Load):
 
 class info_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.commonOne('device_info')
 		if self.data['info']['hardware_type'] == 7:
@@ -169,8 +186,8 @@ class info_update_path(Load):
 				path = 'camera'
 				#,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'选择硬件类型', u'摄像机地址')
 				#,update = ('name-input-required','hardware_id-show-','farm_id-select-required','gateway_id-select-required','hardware_type-select-required','value-text-required')
-				,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址')
-				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
+				,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址', u'排序')
+				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 				,update_farm_id = Demeter.config['setting']['farmList']
 				,update_gateway_id = self.service('common').list('device_gateway')
 				#,update_hardware_type = self.service('common').list('hardware_type')
@@ -178,8 +195,8 @@ class info_update_path(Load):
 		elif self.data['info']['hardware_type'] == 6:
 			self.common(
 				path = 'camera_pic'
-				,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址')
-				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
+				,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址', u'排序')
+				,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 				,update_farm_id = Demeter.config['setting']['farmList']
 				,update_gateway_id = self.service('common').list('device_gateway')
 			)
@@ -188,20 +205,24 @@ class info_update_path(Load):
 				path = 'info'
 				#,label = (u'设备名称', u'设备id', u'计算公式', u'实时计算公式')
 				#,update = ('name-input-required','hardware_id-show-',u'exp-text--{n}为当前数据,只处理最新数据',u'out_exp-text--处理所有数据,比较消耗服务器资源')
-				,label = (u'设备名称', u'设备id', u'计算公式')
-				,update = ('name-input-required','hardware_id-show-',u'exp-text--{n}为当前数据,只处理最新数据')
+				,label = (u'设备名称', u'设备id', u'计算公式', u'排序')
+				,update = ('name-input-required','hardware_id-show-',u'exp-text--{n}为当前数据,只处理最新数据','inorder-text-')
 			)
 		else:
 			self.common(
 				path = 'info'
-				,label = (u'设备名称', u'设备id')
-				,update = ('name-input-required','hardware_id-show-')
+				,label = (u'设备名称', u'设备id', u'排序')
+				,update = ('name-input-required','hardware_id-show-','inorder-text-')
 			)
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.commonUpdate('device_info')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_info')
 		"""
@@ -215,58 +236,76 @@ class info_update_path(Load):
 
 class camera_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.redirect('/device/info?search_hardware_type=7')
 
 class camera_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			path = 'camera'
-			,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址')
-			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
+			,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址',u'排序')
+			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 			,update_farm_id = Demeter.config['setting']['farmList']
 			,update_gateway_id = self.service('common').list('device_gateway')
 		)
 		self.commonOne('device_info')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.data['update']['hardware_type'] = 7
 		self.data['update']['type_id'] = 0
 		self.commonUpdate('device_info')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_info')
 
 class camera_pic_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.redirect('/device/info?search_hardware_type=6')
 
 class camera_pic_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			path = 'camera_pic'
-			,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址')
-			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
+			,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址',u'排序')
+			,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required','inorder-text-')
 			,update_farm_id = Demeter.config['setting']['farmList']
 			,update_gateway_id = self.service('common').list('device_gateway')
 		)
 		self.commonOne('device_info')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.data['update']['hardware_type'] = 6
 		self.data['update']['type_id'] = 0
 		self.commonUpdate('device_info')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_info')
 
 class pic_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'摄像头图片'
@@ -289,6 +328,8 @@ class pic_path(Load):
 
 class stat_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		method = self.input('method', 'avg')
 		id = self.input('id')
@@ -321,6 +362,8 @@ class stat_path(Load):
 
 class type_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'类型'
@@ -337,6 +380,8 @@ class type_path(Load):
 
 class type_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			path = 'type'
@@ -348,15 +393,21 @@ class type_update_path(Load):
 		self.commonOne('device_type')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.commonUpdate('device_type')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_type')
 
 
 class printer_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'打印机'
@@ -378,6 +429,8 @@ class printer_path(Load):
 
 class printer_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			path = 'printer'
@@ -388,15 +441,21 @@ class printer_update_path(Load):
 		self.commonOne('device_printer')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.commonUpdate('device_printer')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('device_printer')
 
 
 class notice_type_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'错误码设置'
@@ -413,6 +472,8 @@ class notice_type_path(Load):
 
 class notice_type_update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/device/notice_type'
@@ -422,8 +483,12 @@ class notice_type_update_path(Load):
 		self.commonOne('notice_type')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		self.commonUpdate('notice_type')
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		self.commonDelete('notice_type')

+ 13 - 0
admin/page/farm.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class farm_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'农场' #中文名
@@ -47,6 +48,7 @@ class farm_path(Load):
 
 class farm_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/farm/farm'
@@ -56,6 +58,7 @@ class farm_update_path(Load):
 		self.commonOne('farm')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.commonUpdate('farm')
 		Demeter.config['setting']['farmList'] = self.service('common').list('farm')
@@ -87,6 +90,7 @@ class farm_update_path(Load):
 
 class info_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = str(Demeter.config['setting']['farm'])
 		param = '?farm=' + id + '&search_farm_id-select-=' + id
@@ -98,11 +102,13 @@ class info_path(Load):
 		self.commonOne('farm', id=Demeter.config['setting']['farm'])
 		self.commonView('set')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm', id=Demeter.config['setting']['farm'])
 
 class product_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'产品'
@@ -130,6 +136,7 @@ class product_path(Load):
 
 class product_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/farm/product'
@@ -140,15 +147,18 @@ class product_update_path(Load):
 		self.commonOne('farm_product')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_product')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_product')
 
 
 class user_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'用户'
@@ -172,6 +182,7 @@ class user_path(Load):
 
 class user_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/farm/user'
@@ -182,8 +193,10 @@ class user_update_path(Load):
 		self.commonOne('farm_user')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_user', '手机号已经被注册', mobile=self.data['update']['mobile'])
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_user')

+ 8 - 0
admin/page/hardware.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class hardware_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'硬件设备'
@@ -46,6 +47,7 @@ class hardware_path(Load):
 
 class hardware_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/hardware/hardware'
@@ -56,14 +58,17 @@ class hardware_update_path(Load):
 		self.commonOne('hardware')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('hardware')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('hardware')
 
 class type_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'硬件类型'
@@ -80,6 +85,7 @@ class type_path(Load):
 
 class type_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/hardware/type'
@@ -89,8 +95,10 @@ class type_update_path(Load):
 		self.commonOne('hardware_type')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('hardware_type')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('hardware_type')

+ 2 - 0
admin/page/main.py

@@ -9,10 +9,12 @@ from __load__ import *
 
 class index_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.view("index.html")
 
 class main_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.view("main.html")

+ 8 - 0
admin/page/msg.py

@@ -11,6 +11,7 @@ push = ({'id':'sms', 'name':'短信'}, {'id':'weixin', 'name':'微信'})
 
 class msg_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'消息'
@@ -49,6 +50,7 @@ class msg_path(Load):
 
 class msg_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/msg/msg'
@@ -62,15 +64,18 @@ class msg_update_path(Load):
 		self.commonOne('msg')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		# 发消息
 		self.commonUpdate('msg')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('msg')
 
 class type_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'消息类型'
@@ -87,6 +92,7 @@ class type_path(Load):
 
 class type_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/msg/type'
@@ -97,8 +103,10 @@ class type_update_path(Load):
 		self.commonOne('msg_type')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('msg_type')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('msg_type')

+ 4 - 0
admin/page/origin.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class batch_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'溯源批次'
@@ -35,6 +36,7 @@ class batch_path(Load):
 
 class batch_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/origin/batch'
@@ -47,8 +49,10 @@ class batch_update_path(Load):
 		self.commonOne('origin_batch')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('origin_batch')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('origin_batch')

+ 1 - 0
admin/page/upload.py

@@ -12,6 +12,7 @@ import uuid
 
 class upload_path(Load):
  	@Web.auth
+	@Web.setting
 	def post(self, *args, **kwargs):
 		url = self.request.protocol + "://" + self.request.host
 		file_metas = self.request.files["file"]

+ 22 - 0
admin/page/web.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class set_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/set'
@@ -18,11 +19,13 @@ class set_path(Load):
 		self.commonOne('web_set', id=1)
 		self.commonView('set')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_set',id=1)
 
 class article_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'文章'
@@ -44,6 +47,7 @@ class article_path(Load):
 
 class article_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/article'
@@ -54,15 +58,18 @@ class article_update_path(Load):
 		self.commonOne('web_article')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_article')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('web_article')
 
 
 class category_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'分类'
@@ -79,6 +86,7 @@ class category_path(Load):
 
 class category_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/category'
@@ -88,14 +96,17 @@ class category_update_path(Load):
 		self.commonOne('web_article_category')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_article_category')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('web_article_category')
 
 class help_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'帮助'
@@ -117,6 +128,7 @@ class help_path(Load):
 
 class help_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/help'
@@ -127,14 +139,17 @@ class help_update_path(Load):
 		self.commonOne('web_help')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_help')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('web_help')
 
 class help_category_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'分类'
@@ -151,6 +166,7 @@ class help_category_path(Load):
 
 class help_category_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/help_category'
@@ -160,14 +176,17 @@ class help_category_update_path(Load):
 		self.commonOne('web_help_category')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_help_category')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('web_help_category')
 
 class menu_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'菜单'
@@ -184,6 +203,7 @@ class menu_path(Load):
 
 class menu_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/web/menu'
@@ -193,8 +213,10 @@ class menu_update_path(Load):
 		self.commonOne('web_menu')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('web_menu')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('web_menu')

+ 16 - 0
admin/page/work.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class work_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'农事'
@@ -42,6 +43,7 @@ class work_path(Load):
 
 class work_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/work/work'
@@ -55,14 +57,17 @@ class work_update_path(Load):
 		self.commonOne('farm_work')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_work')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_work')
 
 class method_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'劳作方法'
@@ -89,6 +94,7 @@ class method_path(Load):
 
 class method_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/work/method'
@@ -100,14 +106,17 @@ class method_update_path(Load):
 		self.commonOne('farm_work_method')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_work_method')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_work_method')
 
 class category_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'劳作分类'
@@ -131,6 +140,7 @@ class category_path(Load):
 
 class category_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/work/category'
@@ -141,15 +151,18 @@ class category_update_path(Load):
 		self.commonOne('farm_work_category')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_work_category')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_work_category')
 
 
 class land_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			name = u'地块'
@@ -173,6 +186,7 @@ class land_path(Load):
 
 class land_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.common(
 			path = '/work/land'
@@ -183,8 +197,10 @@ class land_update_path(Load):
 		self.commonOne('farm_work_land')
 		self.commonView('update')
 	@Web.auth
+	@Web.setting
 	def post(self):
 		self.commonUpdate('farm_work_land')
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		self.commonDelete('farm_work_land')

+ 2 - 1
front/page/__load__.py

@@ -141,7 +141,8 @@ class Device(object):
 	def get(self, search):
 		if 'id--ins' in search and search['id--ins']:
 			search['id--ins'] = tuple(eval(search['id--ins']))
-		return self.service('common').list('device_info', state=True, search=search, order='type_id asc,udate asc,id asc', limit='0,10000')
+			#order='inorder asc, type_id asc,udate asc,id asc'
+		return self.service('common').list('device_info', state=True, search=search, order='inorder asc, type_id asc,udate asc', limit='0,10000')
 
 	@staticmethod
 	def getByGateway(self, search={}):

+ 72 - 0
front/page/device.py

@@ -9,6 +9,8 @@ from __load__ import *
 # 首页
 class index_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		# 获取网关列表
 		self.data['gateway'] = self.service('common').list('device_gateway', state=True, search={'farm_id':self.data['setting']['farm']})
@@ -19,6 +21,8 @@ class index_path(Load):
 #批量控制
 class mul_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['list'] = self.service('common').list('device_mul', search={'farm_id':self.data['setting']['farm']})
 		if self.data['list']:
@@ -29,6 +33,8 @@ class mul_path(Load):
 		self.view("device/mul.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		value = self.input('value')
@@ -62,6 +68,8 @@ class mul_path(Load):
 #大屏幕
 class screen_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		device = self.input('device')
 
@@ -106,6 +114,8 @@ class screen_path(Load):
 #大屏幕设置
 class screen_set_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['info'] = self.data['setting']['farmInfo']
 		self.data['info']['devices'] = self.data['info']['gateway']
@@ -114,6 +124,8 @@ class screen_set_path(Load):
 		self.view("device/alert/screen.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -129,6 +141,8 @@ class screen_set_path(Load):
 #获取设备数据和设备控制
 class data_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		Device.data(self)
 		if 'stat' in self.data and self.data['stat']:
@@ -138,6 +152,8 @@ class data_path(Load):
 #获取图像
 class pic_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		Device.pic(self)
 		self.view("device/pic.html")
@@ -145,6 +161,8 @@ class pic_path(Load):
 #数据统计
 class stat_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		Device.stat(self)
 		self.view("device/stat.html")
@@ -152,6 +170,8 @@ class stat_path(Load):
 #设备日志
 class log_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		Device.log(self)
 		self.view("device/logs.html")
@@ -159,6 +179,8 @@ class log_path(Load):
 #设备分组
 class group_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		# 获取页面
 		self.data['page'] = self.service('common').list('device_page', order='inorder asc,cdate desc', search={'farm_id':self.data['setting']['farm']})
@@ -174,6 +196,8 @@ class group_path(Load):
 #更新设备的上下限
 class update_device_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('device_id')
 		if id:
@@ -188,6 +212,8 @@ class update_device_path(Load):
 		self.view("device/alert/device.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -207,6 +233,8 @@ class update_device_path(Load):
 #更新页面
 class update_page_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		#self.data['ico'] = ('cj', 'kz', 'syt', 'wg', 'pl', 'dpm', 'fz', 'zn')
@@ -219,6 +247,8 @@ class update_page_path(Load):
 		self.view("device/alert/page.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -245,6 +275,8 @@ class update_page_path(Load):
 #更新分组
 class update_group_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		page = self.input('page')
 		self.data['page'] = self.service('common').one('device_page', id=page)
@@ -259,6 +291,8 @@ class update_group_path(Load):
 		self.view("device/alert/group.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -280,6 +314,8 @@ class update_group_path(Load):
 		self.out('yes', {'id':state})
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -291,6 +327,8 @@ class update_group_path(Load):
 #智能设置-批量设置
 class set_mul_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['name'] = '批量控制'
 		Device.set(self)
@@ -303,6 +341,8 @@ class set_mul_path(Load):
 #更新批量控制
 class update_set_mul_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = {}
@@ -315,6 +355,8 @@ class update_set_mul_path(Load):
 		self.view("device/alert/mul.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -335,6 +377,8 @@ class update_set_mul_path(Load):
 		self.out('yes', {'id':state})
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -346,6 +390,8 @@ class update_set_mul_path(Load):
 #智能设置-定时设置
 class set_timing_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['name'] = '定时设置'
 		Device.set(self)
@@ -374,6 +420,8 @@ class set_timing_path(Load):
 
 class update_set_timing_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		Device.setCronOper(self)
@@ -388,6 +436,8 @@ class update_set_timing_path(Load):
 		self.view("device/alert/timing.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -409,6 +459,8 @@ class update_set_timing_path(Load):
 		self.out('yes', {'id':state})
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -420,6 +472,8 @@ class update_set_timing_path(Load):
 #智能设置-周期设置
 class set_loop_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['name'] = '周期设置'
 		Device.set(self)
@@ -456,6 +510,8 @@ class set_loop_path(Load):
 
 class update_set_loop_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		Device.setCronOper(self)
@@ -468,6 +524,8 @@ class update_set_loop_path(Load):
 		self.view("device/alert/loop.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -497,6 +555,8 @@ class update_set_loop_path(Load):
 		self.out('yes', {'id':state})
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -511,6 +571,8 @@ class update_set_loop_path(Load):
 #智能设置-条件控制
 class set_condition_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		self.data['name'] = '条件控制'
 		Device.set(self)
@@ -540,6 +602,8 @@ class set_condition_path(Load):
 
 class update_set_condition_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		Device.setCronOper(self)
@@ -553,6 +617,8 @@ class update_set_condition_path(Load):
 		self.view("device/alert/condition.html")
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -591,6 +657,8 @@ class update_set_condition_path(Load):
 		self.out('yes', {'id':state})
 
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -605,6 +673,8 @@ class update_set_condition_path(Load):
 #更新控制设备的状态
 class update_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		value = self.input('value')
@@ -636,6 +706,8 @@ class update_path(Load):
 
 class get_path(Load):
 	@Web.auth
+	@Web.setting
+	@Web.setting
 	def get(self):
 		# 根据网关id获取设备
 		id = self.input('id')

+ 13 - 0
front/page/main.py

@@ -31,6 +31,7 @@ class Farm(object):
 
 class index_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		mobile = Demeter.checkMobile(self.request)
 		if mobile:
@@ -41,6 +42,7 @@ class index_path(Load):
 		self.view("farm/index.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.data['setting']['farm']
 		update = {}
@@ -53,11 +55,13 @@ class index_path(Load):
 
 class edit_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		Farm.init(self)
 		self.view("farm/edit.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.data['setting']['farm']
 		update = {}
@@ -94,6 +98,7 @@ class edit_path(Load):
 		self.out('修改成功')
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -104,6 +109,7 @@ class edit_path(Load):
 
 class product_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		Farm.init(self)
 		self.data['list'] = self.service('common').list('farm_product', search={'farm_id':self.data['setting']['farm']})
@@ -111,6 +117,7 @@ class product_path(Load):
 
 class product_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = {}
@@ -119,6 +126,7 @@ class product_update_path(Load):
 		self.view("farm/product_update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -153,6 +161,7 @@ class product_update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -169,6 +178,7 @@ class product_update_path(Load):
 
 class env_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		Farm.init(self)
 		self.data['list'] = self.service('common').list('farm_env', order='inorder asc,cdate desc', search={'farm_id':self.data['setting']['farm']})
@@ -182,6 +192,7 @@ class env_path(Load):
 
 class env_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = {}
@@ -192,6 +203,7 @@ class env_update_path(Load):
 		self.view("farm/env_update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -221,6 +233,7 @@ class env_update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:

+ 1 - 0
front/page/msg.py

@@ -9,6 +9,7 @@ from __load__ import *
 
 class index_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		self.data['list'] = self.service('common').list('msg', search={'farm_id':self.data['setting']['farm']}, page=True, order='status asc, cdate desc')
 		if self.data['list']:

+ 7 - 0
front/page/origin.py

@@ -35,6 +35,7 @@ class Code(object):
 
 class index_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		mobile = Demeter.checkMobile(self.request)
 		if mobile:
@@ -62,6 +63,7 @@ class index_path(Load):
 
 class view_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = self.service('common').one('origin_batch', id=id)
@@ -71,6 +73,7 @@ class view_path(Load):
 
 class update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		copy_id = self.input('copy_id')
@@ -97,6 +100,7 @@ class update_path(Load):
 		self.view("origin/update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -157,6 +161,7 @@ class update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -168,6 +173,7 @@ class update_path(Load):
 
 class printer_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		table_id = self.input('table_id');
@@ -179,6 +185,7 @@ class printer_path(Load):
 		self.view("origin/printer.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}

+ 1 - 0
front/page/upload.py

@@ -12,6 +12,7 @@ import uuid
 
 class upload_path(Load):
  	@Web.auth
+	@Web.setting
 	def post(self, *args, **kwargs):
 		url = self.request.protocol + "://" + self.request.host
 		file_metas = self.request.files["file"]

+ 14 - 0
front/page/work.py

@@ -25,6 +25,7 @@ class Work(object):
 
 class index_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		mobile = Demeter.checkMobile(self.request)
 		if mobile:
@@ -46,6 +47,7 @@ class index_path(Load):
 
 class update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['category'] = self.service('common').list('farm_work_category', search={'farm_id':self.data['setting']['farm']})
@@ -59,6 +61,7 @@ class update_path(Load):
 		self.view("work/update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -91,6 +94,7 @@ class update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -102,6 +106,7 @@ class update_path(Load):
 
 class set_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		Work.init(self)
 		self.data['category'] = self.service('common').list('farm_work_category', search={'farm_id':self.data['setting']['farm']})
@@ -111,6 +116,7 @@ class set_path(Load):
 
 class land_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = {}
@@ -119,6 +125,7 @@ class land_update_path(Load):
 		self.view("work/land_update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -131,6 +138,7 @@ class land_update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -142,6 +150,7 @@ class land_update_path(Load):
 
 class category_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['info'] = {}
@@ -150,6 +159,7 @@ class category_update_path(Load):
 		self.view("work/category_update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -162,6 +172,7 @@ class category_update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:
@@ -173,6 +184,7 @@ class category_update_path(Load):
 
 class method_update_path(Load):
 	@Web.auth
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		self.data['category'] = self.input('category')
@@ -182,6 +194,7 @@ class method_update_path(Load):
 		self.view("work/method_update.html")
 
 	@Web.auth
+	@Web.setting
 	def post(self):
 		id = self.input('id')
 		update = {}
@@ -198,6 +211,7 @@ class method_update_path(Load):
 		self.out('yes', {'state':state})
 
 	@Web.auth
+	@Web.setting
 	def delete(self):
 		id = self.input('id')
 		if not id:

+ 1 - 0
web/page/article.py

@@ -8,6 +8,7 @@
 from __load__ import *
 
 class index_path(Load):
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		if not id:

+ 1 - 0
web/page/farm.py

@@ -8,6 +8,7 @@
 from __load__ import *
 
 class index_path(Load):
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		if not id:

+ 2 - 0
web/page/help.py

@@ -8,6 +8,7 @@
 from __load__ import *
 
 class index_path(Load):
+	@Web.setting
 	def get(self):
 		self.data['url'] = '/help?'
 		self.data['category'] = self.service('common').list('web_help_category')
@@ -28,6 +29,7 @@ class index_path(Load):
 		self.view("list.html")
 
 class view_path(Load):
+	@Web.setting
 	def get(self):
 		id = self.input('id')
 		if not id:

+ 1 - 0
web/page/main.py

@@ -8,6 +8,7 @@
 from __load__ import *
 
 class index_path(Load):
+	@Web.setting
 	def get(self):
 		# 获取焦点图
 		self.data['focus'] = self.service('common').list('web_article', search={'category_id':2})

+ 4 - 0
web/page/origin.py

@@ -46,6 +46,7 @@ class Origin(object):
 		return config
 
 class index_path(Load):
+	@Web.setting
 	def get(self):
 		Origin.init(self)
 
@@ -56,6 +57,7 @@ class index_path(Load):
 		self.view(self.data['path'] + "origin/index.html")
 
 class work_path(Load):
+	@Web.setting
 	def get(self):
 		Origin.init(self)
 		self.data['work'] = self.service('common').list('farm_work', search={'farm_id':self.data['info']['farm_id']}, order='workdate asc,cdate asc')
@@ -80,6 +82,7 @@ class work_path(Load):
 		self.view(self.data['path'] + "origin/work.html")
 
 class env_path(Load):
+	@Web.setting
 	def get(self):
 		Origin.init(self)
 		
@@ -110,6 +113,7 @@ class env_path(Load):
 		return value
 
 class farm_path(Load):
+	@Web.setting
 	def get(self):
 		Origin.init(self)
 

+ 2 - 0
web/page/user.py

@@ -8,6 +8,7 @@
 from __load__ import *
 
 class login_path(Load):
+	@Web.setting
 	def post(self):
 		mobile = self.input('username')
 		password = self.input('password')
@@ -23,6 +24,7 @@ class login_path(Load):
 
 
 class loginout_path(Load):
+	@Web.setting
 	def get(self):
 		self.set_secure_cookie('user', '')
 		self.redirect('/user/login')