|
@@ -60,6 +60,24 @@ class UnicomComboView(View):
|
|
return self.buy_unicom_combo(user_id, request_dict, request, response)
|
|
return self.buy_unicom_combo(user_id, request_dict, request, response)
|
|
elif operation == 'combo-list':
|
|
elif operation == 'combo-list':
|
|
return self.query_package_list(response)
|
|
return self.query_package_list(response)
|
|
|
|
+ elif operation == 'get-device-info':
|
|
|
|
+ return self.get_device_info(request_dict, response)
|
|
|
|
+
|
|
|
|
+ @classmethod
|
|
|
|
+ def get_device_info(cls, request_dict, response):
|
|
|
|
+ """
|
|
|
|
+ 获取设备信息
|
|
|
|
+ @param request_dict:
|
|
|
|
+ @param response:
|
|
|
|
+ @return:
|
|
|
|
+ """
|
|
|
|
+ serial_no = request_dict.get('serialNumber', None)
|
|
|
|
+ if not serial_no:
|
|
|
|
+ return response.json(444)
|
|
|
|
+ unicom_device_info_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_no).values()
|
|
|
|
+ if not unicom_device_info_qs.exists():
|
|
|
|
+ return response.json(173)
|
|
|
|
+ return response.json(0, dict(unicom_device_info_qs.first()))
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def device_add(cls, request_dict, response):
|
|
def device_add(cls, request_dict, response):
|
|
@@ -80,6 +98,9 @@ class UnicomComboView(View):
|
|
unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
|
|
unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
|
|
if unicom_device_qs.exists():
|
|
if unicom_device_qs.exists():
|
|
return response.json(174)
|
|
return response.json(174)
|
|
|
|
+ unicom_device_serial_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_no)
|
|
|
|
+ if unicom_device_serial_qs.exists():
|
|
|
|
+ return response.json(174)
|
|
unicom_obj = UnicomObjeect()
|
|
unicom_obj = UnicomObjeect()
|
|
result = unicom_obj.verify_device(iccid=iccid)
|
|
result = unicom_obj.verify_device(iccid=iccid)
|
|
if result.status_code == 200 and result.text:
|
|
if result.status_code == 200 and result.text:
|
|
@@ -216,16 +237,16 @@ class UnicomComboView(View):
|
|
pay_price = PayService.get_two_float(price, 2)
|
|
pay_price = PayService.get_two_float(price, 2)
|
|
notify_url = 'unicom/wap/pay/ali-notify'
|
|
notify_url = 'unicom/wap/pay/ali-notify'
|
|
order_dict['pay_url'] = PayService.create_alipay_payment('cn', order_id, pay_price,
|
|
order_dict['pay_url'] = PayService.create_alipay_payment('cn', order_id, pay_price,
|
|
- unicom_combo_qs.combo_name,
|
|
|
|
|
|
+ unicom_combo_qs['combo_name'],
|
|
notify_url,
|
|
notify_url,
|
|
- unicom_combo_qs.remark, response)
|
|
|
|
|
|
+ unicom_combo_qs['remark'], response)
|
|
res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id}
|
|
res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id}
|
|
elif pay_type == 3: # 微信支付
|
|
elif pay_type == 3: # 微信支付
|
|
notify_url = 'unicom/wap/pay/wechat-notify'
|
|
notify_url = 'unicom/wap/pay/wechat-notify'
|
|
ip = CommonService.get_ip_address(request)
|
|
ip = CommonService.get_ip_address(request)
|
|
order_dict['pay_url'], sign_params = PayService.create_wechat_payment('cn', order_id, price, ip,
|
|
order_dict['pay_url'], sign_params = PayService.create_wechat_payment('cn', order_id, price, ip,
|
|
notify_url,
|
|
notify_url,
|
|
- unicom_combo_qs.remark,
|
|
|
|
|
|
+ unicom_combo_qs['remark'],
|
|
response)
|
|
response)
|
|
res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id, 'result': sign_params}
|
|
res_data = {'redirectUrl': order_dict['pay_url'], 'orderID': order_id, 'result': sign_params}
|
|
else:
|
|
else:
|