1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- """
- demeter web page
- name:site.py 站点相关
- author:rabin
- """
- from __load__ import *
- class site_path(Load):
- @Web.auth
- @Web.setting
- def get(self):
- self.common(
- name = u'站点管理'
- ,path = '/site/site'
- ,width = '600'
- ,height = '600'
- ,search = (('label-1','workdate-time-start','workdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'站点名称'))
- ,thead = (u'站点名称', u'快捷功能', u'更新时间')
- ,tbody = ('name','func', 'cdate')
- ,state = True
- )
- menu = (
- {'name':'抢购商品管理', 'url':'/site/product'}
- ,
- )
- self.commonList('site')
- if self.data['list']:
- for key, value in enumerate(self.data['list']):
- id = str(value['id'])
- param = '?search_site_id-select-=' + id
- self.data['list'][key]['func'] = ''
- for i in menu:
- self.data['list'][key]['func'] = self.data['list'][key]['func'] + '<a href="'+i['url']+''+param+'">'+i['name']+'</a> '
- self.commonView('list')
- class site_update_path(Load):
- @Web.auth
- @Web.setting
- def get(self):
- self.common(
- path = '/site/site'
- ,label = (u'站点名称',u'站点网址',u'登录页链接',u'登录账号',u'登录密码')
- ,update = ('name-input-required','link-input-required','login_link-input-required','username-input-required','password-password-required')
- )
- self.commonOne('site')
- self.commonView('update')
- @Web.auth
- @Web.setting
- def post(self):
- self.commonUpdate('site')
- @Web.auth
- @Web.setting
- def delete(self):
- self.commonDelete('site')
- class product_path(Load):
- @Web.auth
- @Web.setting
- def get(self):
- self.common(
- name = u'抢购商品'
- ,path = '/site/product'
- ,width = '600'
- ,height = '600'
- ,search = (('label-1','cdate-time-start','cdate-time-end','site_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'选择站点',u'商品名'))
- ,thead = (u'所属站点', u'商品名', u'商品链接', u'更新时间')
- ,tbody = ('site', 'name', 'link', 'cdate')
- ,state = True
- )
- self.data['common']['search_site_id-select-'] = self.service('common').list('site')
- self.commonList('product')
- if self.data['list']:
- for key, value in enumerate(self.data['list']):
- site = self.service('common').one('site', id=value['site_id'])
- self.data['list'][key]['site'] = site['name']
- self.commonView('list')
- class product_update_path(Load):
- @Web.auth
- @Web.setting
- def get(self):
- self.common(
- path = '/site/product'
- ,label = (u'所属站点', u'商品名称', u'商品链接')
- ,update = ('site_id-select-required', 'name-input-required','link-input-required')
- ,update_site_id = self.service('common').list('site')
- )
- self.commonOne('product')
- self.commonView('update')
- @Web.auth
- @Web.setting
- def post(self):
- self.commonUpdate('product')
- @Web.auth
- @Web.setting
- def delete(self):
- self.commonDelete('product')
|