__load__.py 569 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter load
  5. author:rabin
  6. """
  7. from demeter.web import *
  8. # 这里做微信的登录认证
  9. def auth(method):
  10. def wrapper(self, *args, **kwargs):
  11. return method(self, *args, **kwargs)
  12. return wrapper
  13. class Weixin(object):
  14. def check(self):
  15. return
  16. class Load(Base):
  17. KEYS = ('user', 'farm')
  18. def setting(self):
  19. uid = self.input('uid')
  20. farm = 1
  21. if uid:
  22. user = self.service('common').one('farm_user', id=uid)
  23. if user:
  24. farm = user['farm_id']
  25. Demeter.config['setting']['farm'] = farm
  26. return