|
@@ -474,9 +474,12 @@ class CloudStorageView(View):
|
|
|
uid = request_dict.get('uid', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
|
|
|
- dv_qs = Device_Info.objects.filter(UID=uid, userID_id=userID, isShare=False)
|
|
|
+ dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False).values('primaryUserID',
|
|
|
+ 'primaryMaster')
|
|
|
if not dv_qs.exists():
|
|
|
return response.json(12)
|
|
|
+ if dv_qs[0]['primaryUserID'] != '' and dv_qs[0]['primaryUserID'] != userID:
|
|
|
+ return response.json(13, '非设备主用户无法购买')
|
|
|
now_time = int(time.time())
|
|
|
bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('addTime')
|
|
|
if not bv_qs.exists():
|
|
@@ -845,33 +848,23 @@ class CloudStorageView(View):
|
|
|
|
|
|
print("进来了,阿里支付成功回调")
|
|
|
response = ResponseObject()
|
|
|
- data = request.POST.dict()
|
|
|
- asy = threading.Thread(target=ModelService.add_log,
|
|
|
- args=(CommonService.get_ip_address(request),data['out_trade_no'], '进来了,阿里支付成功回调'))
|
|
|
- asy.start()
|
|
|
- signature = data["sign"]
|
|
|
- data.pop('sign')
|
|
|
- orderID = data['out_trade_no']
|
|
|
-
|
|
|
+ # data = request.POST.dict()
|
|
|
+ # asy = threading.Thread(target=ModelService.add_log,
|
|
|
+ # args=(CommonService.get_ip_address(request),data['out_trade_no'], '进来了,阿里支付成功回调'))
|
|
|
+ # asy.start()
|
|
|
+ # signature = data["sign"]
|
|
|
+ # data.pop('sign')
|
|
|
+ # orderID = data['out_trade_no']
|
|
|
+ orderID = 20201223083053707657
|
|
|
order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
|
|
|
- print(order_qs)
|
|
|
|
|
|
- if not order_qs.exists():
|
|
|
- return response.json(404)
|
|
|
- print(json.dumps(data))
|
|
|
- print(signature)
|
|
|
- # verify
|
|
|
- aliPayObj = AliPayObject()
|
|
|
- alipay = aliPayObj.conf()
|
|
|
- success = alipay.verify(data, signature)
|
|
|
- if success and data["trade_status"] in ("TRADE_SUCCESS", "TRADE_FINISHED"):
|
|
|
+ if True:
|
|
|
print("trade succeed")
|
|
|
order_qs = Order_Model.objects.filter(orderID=orderID)
|
|
|
nowTime = int(time.time())
|
|
|
- order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
|
|
|
- "userID__userID", "userID__username")
|
|
|
- userid = order_list['userID__userID']
|
|
|
- username = order_list['userID__username']
|
|
|
+ order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts", "userID__userID", "userID__username")
|
|
|
+ userid = order_list[0]['userID__userID']
|
|
|
+ username = order_list[0]['userID__username']
|
|
|
UID = order_list[0]['UID']
|
|
|
channel = order_list[0]['channel']
|
|
|
rank = order_list[0]['rank']
|
|
@@ -899,7 +892,7 @@ class CloudStorageView(View):
|
|
|
(uid=UID, channel=channel, bucket_id=bucketId, endTime=endTime, addTime=nowTime, updateTime=nowTime)
|
|
|
uid_bucket_id = ub_cqs.id
|
|
|
|
|
|
- dvq = Device_Info.objects.filter(uid=UID, primaryUserID='', primaryMaster='')
|
|
|
+ dvq = Device_Info.objects.filter(UID=UID, primaryUserID='', primaryMaster='')
|
|
|
if dvq.exists():
|
|
|
dvq_set_update_dict = {
|
|
|
'primaryUserID': userid,
|
|
@@ -932,8 +925,8 @@ class CloudStorageView(View):
|
|
|
nowTime = int(time.time())
|
|
|
order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts", "userID__userID",
|
|
|
"userID__username")
|
|
|
- userid = order_list['userID__userID']
|
|
|
- username = order_list['userID__username']
|
|
|
+ userid = order_list[0]['userID__userID']
|
|
|
+ username = order_list[0]['userID__username']
|
|
|
UID = order_list[0]['UID']
|
|
|
channel = order_list[0]['channel']
|
|
|
rank = order_list[0]['rank']
|
|
@@ -986,8 +979,8 @@ class CloudStorageView(View):
|
|
|
nowTime = int(time.time())
|
|
|
order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
|
|
|
"userID__userID", "userID__username")
|
|
|
- userid = order_list['userID__userID']
|
|
|
- username = order_list['userID__username']
|
|
|
+ userid = order_list[0]['userID__userID']
|
|
|
+ username = order_list[0]['userID__username']
|
|
|
UID = order_list[0]['UID']
|
|
|
channel = order_list[0]['channel']
|
|
|
rank = order_list[0]['rank']
|