chenjunkai 5 жил өмнө
parent
commit
7eca4b4d36

+ 4 - 2
Ansjer/urls.py

@@ -7,7 +7,7 @@ from Controller import FeedBack, EquipmentOTA, EquipmentInfo, AdminManage, AppIn
     EquipmentManager, LogManager, PermissionManager, OTAEquipment, shareUserPermission, UidSetController, \
     UserManger, CheckUserData, \
     UserController, CloudVod, OrderContrller, VodBucket, DetectController, DeviceShare, UserBrandController, \
-    StsOssController, UIDPreview, OssCrd, SysMsg, UidUser, EquipmentManagerV2,PushDeploy
+    StsOssController, UIDPreview, OssCrd, SysMsg, UidUser, EquipmentManagerV2, PushDeploy, AppSetController
 
 urlpatterns = [
     url(r'^account/authcode$', UserController.authCodeView.as_view()),
@@ -159,7 +159,7 @@ urlpatterns = [
     # 删除云存视频
     path('cv/del', CloudVod.deleteVodHls),
     url(r'^equipment/judge', EquipmentManager.judgeInterface),
-    
+
     # ap模式,新增设备表
     url(r'^uiduser/add', UidUser.addInterface),
     url(r'^uiduser/query', UidUser.queryInterface),
@@ -176,6 +176,8 @@ urlpatterns = [
 
     url(r'^oalexa/auth', UserController.alexaAuthView.as_view()),
 
+    url(r'^appset/(?P<operation>.*)$', AppSetController.AppSetView.as_view()),
+
     # app 设备消息模板
     # 路由加参数参考
     # url(r'^(?P<path>.*)/(?P<UID>.*)/lls$', Test.Test.as_view(), name=u'gg'),

+ 63 - 0
Controller/AppSetController.py

@@ -0,0 +1,63 @@
+#!/usr/bin/env python3  
+# -*- coding: utf-8 -*-  
+"""
+@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
+@AUTHOR: ASJRD018
+@NAME: AnsjerFormal
+@software: PyCharm
+@DATE: 2020/2/27 9:38
+@Version: python3.6
+@MODIFY DECORD:ansjer dev
+@file: AppSetController.py
+@Contact: chanjunkai@163.com
+"""
+
+from django.views.generic.base import View
+
+from Object.ResponseObject import ResponseObject
+
+
+class AppSetView(View):
+    def get(self, request, *args, **kwargs):
+        request.encoding = 'utf-8'
+        operation = kwargs.get('operation', None)
+        return self.validation(request.GET, operation)
+
+    def post(self, request, *args, **kwargs):
+        request.encoding = 'utf-8'
+        operation = kwargs.get('operation', None)
+        return self.validation(request.POST, operation)
+
+    def validation(self, request_dict, operation):
+        response = ResponseObject()
+        # token = request_dict.get('token', None)
+        # tko = TokenObject(token)
+        # userID = tko.userID
+        if operation == 'query':
+            return self.do_query(request_dict, response)
+        else:
+            return response.json(414)
+
+    def do_query(self, request_dict, response):
+        appBundleId = request_dict.get('appBundleId', None)
+        if not appBundleId:
+            return response.json(444,'appBundleId')
+        res = {}
+        res['grade'] = 1
+        #     # 用户帮助
+        res['usingHelp'] = 0
+        #     # AP添加方式
+        res['apAdd'] = 1
+        #     # AP工具
+        res['apTool'] = 1
+        #     # 广告模块
+        res['ad_module'] = {
+            "time": 0,
+            "ad_path": [
+                "https://test.dvema.com/web/static/image/default_ad1",
+                "https://test.dvema.com/web/static/image/default_ad2",
+                "https://test.dvema.com/web/static/image/default_ad3",
+            ]
+        }
+        res['init_img'] = 'https://test.dvema.com/web/static/image/default_start'
+        return response.json(0, res)

+ 25 - 23
Controller/UserController.py

@@ -1263,8 +1263,11 @@ class InitInfoView(View):
         response = ResponseObject()
         token = request_dict.get('token', None)
         tko = TokenObject(token)
-        userID = tko.userID
-        return self.init_info(request_dict, userID, response)
+        if tko.code == 0:
+            userID = tko.userID
+            return self.init_info(request_dict, userID, response)
+        else:
+            return response.json(tko.code)
 
     # 初始化设备token
     def init_info(self, request_dict, userID, response):
@@ -1275,7 +1278,6 @@ class InitInfoView(View):
         appBundleId = request_dict.get('appBundleId', None)
         tz = request_dict.get('tz', '0')
         lang = request_dict.get('lang', '')  # 语言区域
-        is_ver = request_dict.get('is_ver', 0)  # 判断是否为对接新接口的app版本
         now_time = int(time.time())
         if all([token_val, push_type, appBundleId,userID]):
             push_type = int(push_type)
@@ -1320,26 +1322,26 @@ class InitInfoView(View):
                     UserExModel.objects.create(**create_dict)
         # 获取设备是否存在有已被删除
         res = {'usmsg': 0}  # 预留字段, 有版本app该字段去掉会报错
-        if is_ver:
-            # 评分
-            res['grade'] = 1
-            # 用户帮助
-            res['usingHelp'] = 0
-            # AP添加方式
-            res['apAdd'] = 1
-            # AP工具
-            res['apTool'] = 1
-            # 广告模块
-            res['ad_module'] = {
-                "time": 0,
-                "ad_path": [
-                    "https://test.dvema.com/web/static/image/default_ad1",
-                    "https://test.dvema.com/web/static/image/default_ad2",
-                    "https://test.dvema.com/web/static/image/default_ad3",
-                ]
-            }
-            res['init_img'] = 'https://test.dvema.com/web/static/image/default_start'
-            # http: // test.dvema.com / web / static / image / default_start_750_1334.jpg
+        # if is_ver:
+        #     # 评分
+        #     res['grade'] = 1
+        #     # 用户帮助
+        #     res['usingHelp'] = 0
+        #     # AP添加方式
+        #     res['apAdd'] = 1
+        #     # AP工具
+        #     res['apTool'] = 1
+        #     # 广告模块
+        #     res['ad_module'] = {
+        #         "time": 0,
+        #         "ad_path": [
+        #             "https://test.dvema.com/web/static/image/default_ad1",
+        #             "https://test.dvema.com/web/static/image/default_ad2",
+        #             "https://test.dvema.com/web/static/image/default_ad3",
+        #         ]
+        #     }
+        #     res['init_img'] = 'https://test.dvema.com/web/static/image/default_start'
+        #     # http: // test.dvema.com / web / static / image / default_start_750_1334.jpg
         return response.json(0, res)