Browse Source

Merge remote-tracking branch 'origin/master'

locky 1 year ago
parent
commit
995c7d86ed

+ 5 - 2
AdminController/ServeManagementController.py

@@ -857,12 +857,15 @@ class serveManagement(View):
         if not abnormal_order.exists():
             return response.json(173)
         try:
-            trade_no = abnormal_order.values('trade_no')[0]['trade_no']
+            abnormal_order_qs = abnormal_order.values('trade_no', 'pay_time')
+            trade_no = abnormal_order_qs[0]['trade_no']
+            pay_time = abnormal_order_qs[0]['pay_time']
             order_qs = Order_Model.objects.filter(trade_no=trade_no)
             if order_qs.exists():
+                order_qs.update(payTime=pay_time)
                 abnormal_order.update(status=1)
                 return response.json(0)
-            params = {'trade_no': trade_no}
+            params = {'trade_no': trade_no, 'pay_time': pay_time}
             eur_response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
             if eur_response.status_code == 200:
                 result = eur_response.json()

+ 11 - 2
Controller/AlgorithmShop/AlgorithmShopController.py

@@ -315,6 +315,9 @@ class AlgorithmShopView(View):
             uid = request_dict.get('uid', None)
             version = request_dict.get('version', 'v1')
             algorithm_qs = DeviceAlgorithmExplain.objects.filter(lang=lang)
+            device_ver = request_dict.get('deviceVer', None)
+            device_code = request_dict.get('deviceCode', None)
+            LOGGER.info(f'AlgorithmShopView.algorithm_list ver:{device_ver},code:{device_code}')
             types = [0, 1, 3, 4, 5]
             if version == 'v1':
                 algorithm_qs = algorithm_qs.filter(algorithm_type__type__in=types)
@@ -322,8 +325,11 @@ class AlgorithmShopView(View):
                 .values('algorithm_type__id', 'algorithm_type__type',
                         'algorithm_type__icon_url',
                         'title', 'subtitle', 'algorithm_type__image_url',
-                        'algorithm_type__basic_function', 'concerning')
+                        'algorithm_type__basic_function', 'concerning',
+                        'algorithm_type__resource')
             algorithm_list = []
+            device_code = device_code[0:4] if device_code else device_code
+
             if not algorithm_qs.exists():
                 return response.json(0, algorithm_list)
             for item in algorithm_qs:
@@ -331,6 +337,8 @@ class AlgorithmShopView(View):
                 if uid:
                     setting = cls.get_uid_algorithm_info(item['algorithm_type__id'], uid)
                     setting = setting if setting else {'status': 0, 'function': {}}
+                resource = item['algorithm_type__resource']
+                resource = resource.get(device_code, '') if resource else ''
                 algorithm_list.append({
                     'typeId': item['algorithm_type__id'],
                     'type': item['algorithm_type__type'],
@@ -340,7 +348,8 @@ class AlgorithmShopView(View):
                     'subtitle': item['subtitle'],
                     'setting': setting,
                     'basicFunction': item['algorithm_type__basic_function'],
-                    'concerning': item['concerning']
+                    'concerning': item['concerning'],
+                    'resource': resource
                 })
             return response.json(0, algorithm_list)
         except Exception as e:

+ 1 - 1
Controller/Cron/CronTaskController.py

@@ -1272,7 +1272,7 @@ class CronComparedDataView(View):
                 params = {'trade_no': trade_no}
                 response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
                 if response.status_code != 200:
-                    # 如果响应失败,记录记录在数据库
+                    # 如果响应失败,记录在数据库
                     AbnormalOrder.objects.create(**order_dict)
                     continue
                 result = response.json()

+ 6 - 2
Controller/TestApi.py

@@ -170,7 +170,7 @@ class testView(View):
             return self.getSerialNumberInfo(request_dict, response)
         elif operation == 'get-serial-details':  # 序列号信息查询
             return self.get_serial_details(request_dict, response, request)
-        elif operation == 'checkOrderExist':  # 转换时间戳
+        elif operation == 'checkOrderExist':  # 检查paypal订单是否存在
             return self.checkOrderExist(request_dict, response)
         else:
             return 123
@@ -1041,9 +1041,13 @@ class testView(View):
     @staticmethod
     def checkOrderExist(request_dict, response):
         trade_no = request_dict.get('trade_no', None)
+        pay_time = request_dict.get('pay_time', None)
         try:
             order_qs = Order_Model.objects.filter(trade_no=trade_no)
-            is_exist = 1 if order_qs.exists() else 0
+            is_exist = 0
+            if order_qs.exists():
+                is_exist = 1
+                order_qs.update(payTime=pay_time)
             return response.json(0, {'is_exist': is_exist})
         except Exception as e:
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))

+ 1 - 0
Model/models.py

@@ -3673,6 +3673,7 @@ class DeviceAlgorithmType(models.Model):
     image_url = models.CharField(max_length=255, default='', verbose_name='图片地址')
     details_img_url = models.CharField(max_length=255, default='', verbose_name='详情图')
     icon_url = models.CharField(max_length=255, default='', verbose_name='图标地址')
+    resource = models.JSONField(null=True, verbose_name='算法模型bin文件地址JSON格式')
     created_time = models.IntegerField(default=0, verbose_name='创建时间')
 
     class Meta: