Переглянути джерело

4G卡绑定序列号加打印

zhangdongming 2 днів тому
батько
коміт
5a31458042

+ 0 - 1
AdminController/ProblemEntryManagementController.py

@@ -5,7 +5,6 @@ from django.core.paginator import Paginator
 from django.db import transaction
 from django.views import View
 
-from Ansjer.test.util.email_log import response
 from Model.models import DeviceScheme, ProductTroubleshoot, AbnormalEventCode, ProductsScheme, AbnormalEvent
 from Object.ResponseObject import ResponseObject
 from Service.CommonService import CommonService

+ 10 - 6
Controller/UnicomCombo/UnicomComboController.py

@@ -369,7 +369,7 @@ class UnicomComboView(View):
         sign = request_dict.get('sign', None)
         sim = int(request_dict.get('sim', 1))
         logger = logging.getLogger('info')
-        logger.info('--->设备调用4G注册接口')
+        logger.info('--->设备调用4G注册接口{}'.format(request_dict))
         logger.info('iccid:{},serial_no:{}'.format(iccid, serial_no))
         if not all([iccid, serial_no, sign, time_stamp]):
             return response.json(444)
@@ -378,8 +378,8 @@ class UnicomComboView(View):
             return response.json(13)
         n_time = int(time.time())
         try:
-            logger.info('--->参数验证通过,sign验证通过')
             ip = CommonService.get_ip_address(request)
+            logger.info('--->参数验证通过,sign验证通过{}:{}'.format(serial_no, ip))
             # 待完善代码 根据uid与用户id验证系统设备mdcmd
             unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
             if unicom_device_qs.exists():
@@ -400,6 +400,7 @@ class UnicomComboView(View):
                     cls.create_operation_log('unicom/api/device-bind',
                                              ip, request_dict, '4G序列号{}新绑定鼎芯{}'.format(serial_no, iccid))
                     return response.json(0)
+                logger.error("{}外置卡或判断鼎芯国际卡异常".format(serial_no))
                 return response.json(0, '外置卡不保存相关信息{}'.format(serial_no))
 
             if cls.is_unicom_sim(iccid):  # 联通卡
@@ -500,7 +501,7 @@ class UnicomComboView(View):
             assert result['code'] == '200'
             return True
         except Exception as e:
-            print(repr(e))
+            LOGGER.error("{}iccid判断是否鼎芯国际卡异常{}".format(iccid, repr(e)))
             return False
 
     @classmethod
@@ -697,7 +698,8 @@ class UnicomComboView(View):
                                                                              notify_url,
                                                                              unicom_combo_qs['remark'], response)
                     res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id}
-                    cls.create_order_pay_log(order_id, f'{serial_number}购买联通4G套餐', notify_url, 'aliPay', 'SUCCESS')
+                    cls.create_order_pay_log(order_id, f'{serial_number}购买联通4G套餐', notify_url, 'aliPay',
+                                             'SUCCESS')
                 elif pay_type == 3:  # 微信支付
                     notify_url = 'unicom/wap/pay/wechat-notify'
                     ip = CommonService.get_ip_address(request)
@@ -709,7 +711,8 @@ class UnicomComboView(View):
                                                                    product_name,
                                                                    response)
                     result['result'] = sign_params
-                    cls.create_order_pay_log(order_id, f'{serial_number}购买联通4G套餐', notify_url, 'wechatPay', 'SUCCESS')
+                    cls.create_order_pay_log(order_id, f'{serial_number}购买联通4G套餐', notify_url, 'wechatPay',
+                                             'SUCCESS')
                 else:
                     return response.json(444, {'param': 'pay_type'})
 
@@ -1177,7 +1180,8 @@ class UnicomComboView(View):
             LOGGER.info(f'{serial_no}有正在使用的套餐')
             return True
         except Exception as e:
-            LOGGER.info('{}判断是否4G设备异常,errLine:{}, errMsg:{}'.format(serial_number, e.__traceback__.tb_lineno, repr(e)))
+            LOGGER.info(
+                '{}判断是否4G设备异常,errLine:{}, errMsg:{}'.format(serial_number, e.__traceback__.tb_lineno, repr(e)))
             return False
 
     @classmethod