|
@@ -7,6 +7,7 @@ import time
|
|
|
import uuid
|
|
|
|
|
|
import paypalrestsdk
|
|
|
+import requests
|
|
|
import xlrd
|
|
|
import xlwt
|
|
|
from django.db import transaction, connection
|
|
@@ -97,31 +98,33 @@ class serveManagement(View):
|
|
|
return self.getCouponList(request_dict, response)
|
|
|
elif operation == 'getCouponId': # 查询优惠券id
|
|
|
return self.getCouponId(response)
|
|
|
- elif operation == 'addOrEditCoupon': # 添加/编辑优惠券
|
|
|
+ elif operation == 'addOrEditCoupon': # 添加/编辑优惠券
|
|
|
return self.addOrEditCoupon(request_dict, response)
|
|
|
- elif operation == 'deleteCoupon': # 删除优惠券
|
|
|
+ elif operation == 'deleteCoupon': # 删除优惠券
|
|
|
return self.deleteCoupon(request_dict, response)
|
|
|
|
|
|
# 优惠券语言
|
|
|
elif operation == 'getCouponLangList': # 查询优惠券语言
|
|
|
return self.getCouponLangList(request_dict, response)
|
|
|
- elif operation == 'addOrEditCouponLang': # 添加/编辑优惠券语言
|
|
|
+ elif operation == 'addOrEditCouponLang': # 添加/编辑优惠券语言
|
|
|
return self.addOrEditCouponLang(request_dict, response)
|
|
|
- elif operation == 'deleteCouponLang': # 删除优惠券语言
|
|
|
+ elif operation == 'deleteCouponLang': # 删除优惠券语言
|
|
|
return self.deleteCouponLang(request_dict, response)
|
|
|
|
|
|
# 优惠券使用
|
|
|
elif operation == 'getCouponUsingList': # 查询优惠券使用
|
|
|
return self.getCouponUsingList(request_dict, response)
|
|
|
- elif operation == 'editCouponUsing': # 编辑优惠券使用
|
|
|
+ elif operation == 'editCouponUsing': # 编辑优惠券使用
|
|
|
return self.editCouponUsing(request_dict, response)
|
|
|
- elif operation == 'deleteCouponUsing': # 删除优惠券使用
|
|
|
+ elif operation == 'deleteCouponUsing': # 删除优惠券使用
|
|
|
return self.deleteCouponUsing(request_dict, response)
|
|
|
|
|
|
elif operation == 'getDeviceOrderList':
|
|
|
return self.getDeviceOrderList(request_dict, response)
|
|
|
elif operation == 'getAbnormalOrderList':
|
|
|
return self.getAbnormalOrderList(request_dict, response)
|
|
|
+ elif operation == 'updateAbnormalOrder':
|
|
|
+ return self.updateAbnormalOrder(request_dict, response)
|
|
|
elif operation == 'deleteDeviceOrder':
|
|
|
return self.deleteDeviceOrder(userID, request_dict, response)
|
|
|
elif operation == 'getDevicePackageList': # 云存设备套餐
|
|
@@ -652,7 +655,8 @@ class serveManagement(View):
|
|
|
store_meal_list = []
|
|
|
for item in store_meal:
|
|
|
pixel_content = '4k像素' if item['pixel_level'] == 1 else '4k像素以下'
|
|
|
- store_meal_list.append({'id': item['id'], 'title': item['lang__title'] + '--' + item['lang__content'] + '(' + pixel_content + ')'})
|
|
|
+ store_meal_list.append({'id': item['id'], 'title': item['lang__title'] + '--' + item[
|
|
|
+ 'lang__content'] + '(' + pixel_content + ')'})
|
|
|
return response.json(0, store_meal_list)
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
@@ -735,7 +739,7 @@ class serveManagement(View):
|
|
|
line = int(pageSize)
|
|
|
|
|
|
try:
|
|
|
- if combo_id: # 根据套餐id查询
|
|
|
+ if combo_id: # 根据套餐id查询
|
|
|
coupon_id_list = CouponCombo.objects.filter(combo_id=combo_id).values_list('coupon_id', flat=True)
|
|
|
coupon_qs = CouponConfigModel.objects.filter(id__in=coupon_id_list).values(
|
|
|
'id', 'type', 'use_range', 'coupon_discount')
|
|
@@ -1196,12 +1200,35 @@ class serveManagement(View):
|
|
|
if not order_qs.exists():
|
|
|
return response.json(0, [])
|
|
|
count = order_qs.count()
|
|
|
- order_qs = order_qs.values("order_id", "username", "pay_type", "status", "trade_no", "agreement_id",
|
|
|
+ order_qs = order_qs.values("id", "order_id", "username", "pay_type", "status", "trade_no", "agreement_id",
|
|
|
"price", "pay_time").order_by('-pay_time')[(page - 1) * line:page * line]
|
|
|
return response.json(0, {'list': list(order_qs), 'total': count})
|
|
|
except Exception as e:
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
+ def updateAbnormalOrder(self, request_dict, response):
|
|
|
+ abnormal_order_id = request_dict.get('id', None)
|
|
|
+ if not all([abnormal_order_id]):
|
|
|
+ return response.json(444)
|
|
|
+ abnormal_order = AbnormalOrder.objects.filter(id=abnormal_order_id)
|
|
|
+ if not abnormal_order.exists():
|
|
|
+ return response.json(173)
|
|
|
+ try:
|
|
|
+ trade_no = abnormal_order.values('trade_no')[0]['trade_no']
|
|
|
+ order_qs = Order_Model.objects.filter(trade_no=trade_no)
|
|
|
+ if order_qs.exists():
|
|
|
+ abnormal_order.update(status=1)
|
|
|
+ return response.json(0)
|
|
|
+ params = {'trade_no': trade_no}
|
|
|
+ eur_response = requests.get('https://www.zositeche.com/testApi/checkOrderExist', params=params)
|
|
|
+ if eur_response.status_code == 200:
|
|
|
+ result = eur_response.json()
|
|
|
+ if result['result_code'] == 0 and result['result']['is_exist']:
|
|
|
+ abnormal_order.update(status=1)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
def vodOrderReconcile(self, request, request_dict, response):
|
|
|
|
|
|
file = request.FILES.get('file', None)
|