|
@@ -9,6 +9,7 @@ import hashlib
|
|
|
import json
|
|
|
import threading
|
|
|
import time
|
|
|
+import random
|
|
|
import uuid
|
|
|
from decimal import Decimal
|
|
|
|
|
@@ -31,6 +32,7 @@ from Object.TokenObject import TokenObject
|
|
|
from Object.UnicomObject import UnicomObjeect
|
|
|
from Object.WXTechObject import WXTechObject
|
|
|
from Service.CommonService import CommonService
|
|
|
+from Object.EIoTClubObject import EIoTClubObject
|
|
|
|
|
|
|
|
|
class UnicomManageControllerView(View):
|
|
@@ -824,6 +826,10 @@ class UnicomManageControllerView(View):
|
|
|
if card_type == 1:
|
|
|
data = {'iccid': iccid, 'operator': 3}
|
|
|
return response.json(0, {'package_list': cls.get_wx_package_list(**data)})
|
|
|
+ if card_type == 5:
|
|
|
+ data = {'iccid': iccid, 'timestamp': int(time.time()), 'nonce': random.randint(10000, 99999) }
|
|
|
+ original_data = EIoTClubObject.query_order_record_list("v3",**data)
|
|
|
+ return response.json(0, {'package_list': cls.get_dx_package_list(original_data)})
|
|
|
return response.json(0, {'package_list': package_list})
|
|
|
|
|
|
@staticmethod
|
|
@@ -1284,3 +1290,21 @@ class UnicomManageControllerView(View):
|
|
|
LOGGER.info('UnicomManageControllerView.transfer_device_package, errLine:{}, errMsg:{}'.format(
|
|
|
e.__traceback__.tb_lineno, repr(e)))
|
|
|
return response.json(500)
|
|
|
+
|
|
|
+ def get_dx_package_list(original_data):
|
|
|
+ """
|
|
|
+ 鼎芯数据处理
|
|
|
+ """
|
|
|
+ package_list = []
|
|
|
+ for package in original_data["data"]:
|
|
|
+ new_package = {
|
|
|
+ "packageName": package.get("packageName", ""),
|
|
|
+ "status": package.get("state"), # Assuming state 2 means 'In Use'
|
|
|
+ "flowTotal": package.get("flowTotal", 0),
|
|
|
+ "used": package.get("flowTotal", 0) - package.get("flowRemain", 0),
|
|
|
+ "activationTime": package.get("startDate", ""),
|
|
|
+ "expireTime": package.get("endDate", ""),
|
|
|
+ "updatedTime": "" #没有这个数据接口
|
|
|
+ }
|
|
|
+ package_list.append(new_package)
|
|
|
+ return package_list
|