Эх сурвалжийг харах

Merge remote-tracking branch 'remotes/origin/test'

Ansjer 3 жил өмнө
parent
commit
8b02fe8604

+ 13 - 9
AdminController/DeviceManagementController.py

@@ -458,16 +458,20 @@ class DeviceManagement(View):
         version_number_qs = AppVersionNumber.objects.values('version_number')
         test_list = [item[key] for item in version_number_qs for key in item]
         if (version_number > test_list[-1] or version_number < test_list[0]):
-            return False
-        pos = bisect_left(test_list, version_number)
-        if pos == 0:
-            return test_list[0]
-        if pos == len(test_list):
-            return test_list[-1]
-        before = test_list[pos - 1]
-        version_number_qs = AppVersionNumber.objects.filter(version_number=before).values('id')
-        try:
+            version_number_qs = AppVersionNumber.objects.filter().values('id').order_by('id')
+            total_list = [item[key] for item in version_number_qs for key in item]
+            version_number_id = total_list[-1]
+        else:
+            pos = bisect_left(test_list, version_number)
+            if pos == 0:
+                return test_list[0]
+            if pos == len(test_list):
+                return test_list[-1]
+            before = test_list[pos - 1]
+            version_number_qs = AppVersionNumber.objects.filter(version_number=before).values('id')
             version_number_id = version_number_qs[0]['id']
+        try:
+
             app_bundle_qs = AppBundle.objects.filter(app_bundle_id=app_bundle_id,
                                                      app_device_type__devicenamelanguage__lang=lang,
                                                      app_device_type__app_version_number_id=version_number_id). \

+ 3 - 3
Controller/UserController.py

@@ -15,7 +15,6 @@ import base64
 import datetime
 import logging
 import random
-import threading
 import time
 import traceback
 from io import BytesIO
@@ -2209,6 +2208,7 @@ class InitInfoView(View):
                     return response.json(904)
             else:
                 return response.json(444, 'push_type')
+            self.save_push_config(userID, appBundleId, push_type, token_val, m_code, lang, tz)
             if m_code:
                 # 获取设备推送状态
                 update_dict = {
@@ -2269,14 +2269,14 @@ class InitInfoView(View):
             app_type = 1 if push_type == 0 else 2
             gateway_push_qs = GatewayPush.objects.filter(user_id=user_id, m_code=m_code)
             if gateway_push_qs.exists():
-                gateway_push_qs.update(token_val=token_val, logout=False)
+                if gateway_push_qs.first().token_val != token_val:
+                    gateway_push_qs.update(token_val=token_val, logout=False)
             else:
                 GatewayPush.objects.create(user_id=user_id, app_bundle_id=app_bundle_id, app_type=app_type,
                                            push_type=push_type, token_val=token_val, m_code=m_code, lang=lang, tz=tz)
         except Exception as e:
             print('出错了~异步保存配置信息错误,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
 
-
     def update_country(self, request_dict, response, request):
         username = request_dict.get('unique', None)
         appBundleId = request_dict.get('appBundleId', None)