|
@@ -141,30 +141,32 @@ class UnicomComboView(View):
|
|
|
page = int(pageNo)
|
|
|
line = int(pageSize)
|
|
|
unicom_device_info_qs = UnicomDeviceInfo.objects.filter().values(
|
|
|
- 'iccid', 'serial_no', 'user_id', 'card_type', 'main_card', 'created_time'
|
|
|
- ).order_by('-created_time')
|
|
|
+ 'iccid', 'serial_no', 'user_id', 'card_type', 'main_card', 'created_time', 'updated_time', 'status'
|
|
|
+ ).order_by('-updated_time')
|
|
|
total = unicom_device_info_qs.count()
|
|
|
get_info_qs = unicom_device_info_qs[(page - 1) * line:page * line]
|
|
|
try:
|
|
|
res_list = []
|
|
|
for item in get_info_qs:
|
|
|
res = {
|
|
|
- 'userID': item['user_id'],
|
|
|
'serialNo': item['serial_no'],
|
|
|
'iccid': item['iccid'],
|
|
|
+ 'status': item['status'],
|
|
|
'cardType': item['card_type'],
|
|
|
'mainCard': item['main_card'],
|
|
|
- 'createdTime': item['created_time']
|
|
|
+ 'createdTime': item['created_time'],
|
|
|
+ 'updatedTime': item['updated_time']
|
|
|
}
|
|
|
usreID = item['user_id']
|
|
|
user_info_qs = Device_User.objects.filter(userID=usreID).values(
|
|
|
- 'NickName', 'phone')
|
|
|
+ 'NickName', 'phone', 'username')
|
|
|
if user_info_qs.exists():
|
|
|
res['userID'] = usreID
|
|
|
res['NickName'] = user_info_qs.first()['NickName']
|
|
|
res['phone'] = user_info_qs.first()['phone']
|
|
|
+ res['username'] = user_info_qs.first()['username']
|
|
|
else:
|
|
|
- res['userID'] = ''
|
|
|
+ res['usreID'] = ''
|
|
|
res_list.append(res)
|
|
|
return response.json(0, {'list': res_list, 'total': total})
|
|
|
except Exception as e:
|
|
@@ -210,27 +212,31 @@ class UnicomComboView(View):
|
|
|
total = combo_order_info_qs.count()
|
|
|
data_list = []
|
|
|
for combo_order in combo_order_info_qs:
|
|
|
- data = {'nickName': '',
|
|
|
+ data = {'userName': '',
|
|
|
'serialNo': '',
|
|
|
'iccid': combo_order.iccid,
|
|
|
'status': combo_order.status,
|
|
|
'order_id': combo_order.order_id,
|
|
|
- 'comboName': combo_order.combo.combo_name,
|
|
|
'flow_total_usage': combo_order.flow_total_usage,
|
|
|
'next_month_activate': combo_order.next_month_activate,
|
|
|
'activationTime': combo_order.activation_time,
|
|
|
'expireTime': combo_order.expire_time,
|
|
|
'createdTime': combo_order.created_time,
|
|
|
'updated_time': combo_order.updated_time}
|
|
|
+ unicom_combo_qs = UnicomCombo.objects.filter(id=combo_order.combo_id).values('combo_name')
|
|
|
+ if unicom_combo_qs.exists():
|
|
|
+ data['comboName'] = unicom_combo_qs[0]['combo_name']
|
|
|
+ else:
|
|
|
+ data['comboName'] = ''
|
|
|
iccid = combo_order.iccid
|
|
|
unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid).values('user_id', 'serial_no')
|
|
|
# if not unicom_device_qs.exists():
|
|
|
# return response.json(0, [])
|
|
|
userID = unicom_device_qs[0]['user_id']
|
|
|
- if userID:
|
|
|
- device_user = Device_User.objects.filter(userID=userID).values('NickName')
|
|
|
- nick_name = device_user[0]['NickName']
|
|
|
- data['nickName'] = nick_name
|
|
|
+ device_user = Device_User.objects.filter(userID=userID).values('username')
|
|
|
+ if device_user.exists():
|
|
|
+ nick_name = device_user[0]['username']
|
|
|
+ data['userName'] = nick_name
|
|
|
data['serialNo'] = unicom_device_qs[0]['serial_no']
|
|
|
data_list.append(data)
|
|
|
return response.json(0, {'list': data_list, 'total': total})
|