1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- """
- demeter web page
- name:main.py
- author:rabin
- """
- from __load__ import *
- class index_path(Load):
- @Web.setting
- def get(self):
- id = self.input('id')
- if not id:
- self.redirect('/')
- self.data['info'] = self.service('common').one('farm', id=id)
- self.data['product'] = self.service('common').list('farm_product', search={'farm_id':id, 'status':True}, limit='0,8')
- self.data['env'] = self.service('common').list('farm_env', search={'farm_id':id}, order='inorder asc,cdate desc', limit='0,5')
- if self.data['env']:
- for key, value in enumerate(self.data['env']):
- info = self.service('common').one('device_info', id=value['device_id'])
- #info['value'] = Demeter.exp(info['out_exp'], info['value'])
- self.data['env'][key]['device'] = info
- info = self.service('common').one('device_type', id=value['type_id'])
- self.data['env'][key]['type'] = info
- mobile = Demeter.checkMobile(self.request)
- if mobile:
- path = 'mobile/'
- else:
- path = ''
- self.view(path + "farm.html")
|