AppSetController.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
  5. @AUTHOR: ASJRD018
  6. @NAME: AnsjerFormal
  7. @software: PyCharm
  8. @DATE: 2020/2/27 9:38
  9. @Version: python3.6
  10. @MODIFY DECORD:ansjer dev
  11. @file: AppSetController.py
  12. @Contact: chanjunkai@163.com
  13. """
  14. from django.views.generic.base import View
  15. from Object.ResponseObject import ResponseObject
  16. class AppSetView(View):
  17. def get(self, request, *args, **kwargs):
  18. request.encoding = 'utf-8'
  19. operation = kwargs.get('operation', None)
  20. return self.validation(request.GET, operation)
  21. def post(self, request, *args, **kwargs):
  22. request.encoding = 'utf-8'
  23. operation = kwargs.get('operation', None)
  24. return self.validation(request.POST, operation)
  25. def validation(self, request_dict, operation):
  26. response = ResponseObject()
  27. # token = request_dict.get('token', None)
  28. # tko = TokenObject(token)
  29. # userID = tko.userID
  30. if operation == 'query':
  31. return self.do_query(request_dict, response)
  32. else:
  33. return response.json(414)
  34. def do_query(self, request_dict, response):
  35. appBundleId = request_dict.get('appBundleId', None)
  36. if not appBundleId:
  37. return response.json(444,'appBundleId')
  38. res = {}
  39. res['grade'] = 1
  40. # # 用户帮助
  41. res['usingHelp'] = 0
  42. # # AP添加方式
  43. res['apAdd'] = 1
  44. # # AP工具
  45. res['apTool'] = 1
  46. # # 广告模块
  47. res['ad_module'] = {
  48. "time": 0,
  49. "ad_path": [
  50. "https://test.dvema.com/web/static/image/default_ad1",
  51. "https://test.dvema.com/web/static/image/default_ad2",
  52. "https://test.dvema.com/web/static/image/default_ad3",
  53. ]
  54. }
  55. res['init_img'] = 'https://test.dvema.com/web/static/image/default_start'
  56. return response.json(0, res)