site.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter web page
  4. name:site.py 站点相关
  5. author:rabin
  6. """
  7. from __load__ import *
  8. class site_path(Load):
  9. @Web.auth
  10. @Web.setting
  11. def get(self):
  12. self.common(
  13. name = u'站点管理'
  14. ,path = '/site/site'
  15. ,width = '600'
  16. ,height = '600'
  17. ,search = (('label-1','workdate-time-start','workdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'站点名称'))
  18. ,thead = (u'站点名称', u'快捷功能', u'更新时间')
  19. ,tbody = ('name','func', 'cdate')
  20. ,state = True
  21. )
  22. menu = (
  23. {'name':'抢购商品管理', 'url':'/site/product'}
  24. ,
  25. )
  26. self.commonList('site')
  27. if self.data['list']:
  28. for key, value in enumerate(self.data['list']):
  29. id = str(value['id'])
  30. param = '?search_site_id-select-=' + id
  31. self.data['list'][key]['func'] = ''
  32. for i in menu:
  33. self.data['list'][key]['func'] = self.data['list'][key]['func'] + '<a href="'+i['url']+''+param+'">'+i['name']+'</a>&nbsp;&nbsp;&nbsp;&nbsp;'
  34. self.commonView('list')
  35. class site_update_path(Load):
  36. @Web.auth
  37. @Web.setting
  38. def get(self):
  39. self.common(
  40. path = '/site/site'
  41. ,label = (u'站点名称',u'站点网址',u'登录页链接',u'登录账号',u'登录密码')
  42. ,update = ('name-input-required','link-input-required','login_link-input-required','username-input-required','password-password-required')
  43. )
  44. self.commonOne('site')
  45. self.commonView('update')
  46. @Web.auth
  47. @Web.setting
  48. def post(self):
  49. self.commonUpdate('site')
  50. @Web.auth
  51. @Web.setting
  52. def delete(self):
  53. self.commonDelete('site')
  54. class product_path(Load):
  55. @Web.auth
  56. @Web.setting
  57. def get(self):
  58. self.common(
  59. name = u'抢购商品'
  60. ,path = '/site/product'
  61. ,width = '600'
  62. ,height = '600'
  63. ,search = (('label-1','cdate-time-start','cdate-time-end','site_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'选择站点',u'商品名'))
  64. ,thead = (u'所属站点', u'商品名', u'商品链接', u'更新时间')
  65. ,tbody = ('site', 'name', 'link', 'cdate')
  66. ,state = True
  67. )
  68. self.data['common']['search_site_id-select-'] = self.service('common').list('site')
  69. self.commonList('product')
  70. if self.data['list']:
  71. for key, value in enumerate(self.data['list']):
  72. site = self.service('common').one('site', id=value['site_id'])
  73. self.data['list'][key]['site'] = site['name']
  74. self.commonView('list')
  75. class product_update_path(Load):
  76. @Web.auth
  77. @Web.setting
  78. def get(self):
  79. self.common(
  80. path = '/site/product'
  81. ,label = (u'所属站点', u'商品名称', u'商品链接')
  82. ,update = ('site_id-select-required', 'name-input-required','link-input-required')
  83. ,update_site_id = self.service('common').list('site')
  84. )
  85. self.commonOne('product')
  86. self.commonView('update')
  87. @Web.auth
  88. @Web.setting
  89. def post(self):
  90. self.commonUpdate('product')
  91. @Web.auth
  92. @Web.setting
  93. def delete(self):
  94. self.commonDelete('product')