|
@@ -959,24 +959,27 @@ class CloudStorageView(View):
|
|
|
lang = parmap["lang"]
|
|
|
trade_status = data['result_code'] # 业务结果 SUCCESS/FAIL
|
|
|
out_trade_no = data['out_trade_no'] # 商户订单号
|
|
|
- order_qs = Order_Model.objects.filter(orderID=out_trade_no)
|
|
|
+ order_qs = Order_Model.objects.filter(orderID=out_trade_no, status=0)
|
|
|
logger.info(data)
|
|
|
if trade_status == "SUCCESS":
|
|
|
- logger.info('微信回调返回值 进来了。')
|
|
|
check_sign = pay.get_notifypay(data)
|
|
|
if not check_sign:
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': '签名失败'}))
|
|
|
logger.info('签名成功')
|
|
|
orderID = out_trade_no
|
|
|
- print("进来了,微信支付成功回调")
|
|
|
+
|
|
|
+ #redis加锁,防止订单重复
|
|
|
+ redisObj = RedisObject()
|
|
|
+ isLock = redisObj.CONN.setnx(orderID + 'do_notify', 1)
|
|
|
+ redisObj.CONN.expire(orderID + 'do_notify', 60)
|
|
|
+ if not isLock:
|
|
|
+ return response.json(5)
|
|
|
|
|
|
nowTime = int(time.time())
|
|
|
order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
|
|
|
"userID__userID", "userID__username","status")
|
|
|
+
|
|
|
logger.info(order_list[0]['UID'])
|
|
|
- if(order_list[0]['status'] == 1):
|
|
|
- logger.info('前面已支付成功,通知')
|
|
|
- return HttpResponse(pay.xml_to_dict({'return_code': 'SUCCESS', 'return_msg': 'OK'}))
|
|
|
|
|
|
userid = order_list[0]['userID__userID']
|
|
|
username = order_list[0]['userID__username']
|
|
@@ -1050,6 +1053,8 @@ class CloudStorageView(View):
|
|
|
'Dear customer,you already subscribed the cloud storage package successfully for device ' + UID + ' on ' + time.strftime(
|
|
|
"%b %dth,%Y", time.localtime())]
|
|
|
self.do_vod_msg_Notice(UID, channel, userid, lang, sys_msg_text_list, 'SMS_219738485')
|
|
|
+ logger.info(pay.xml_to_dict({'return_code': 'SUCCESS', 'return_msg': 'OK'}))
|
|
|
+ redisObj.del_data(key=orderID + 'do_notify')
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'SUCCESS', 'return_msg': 'OK'}))
|
|
|
else:
|
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
@@ -1057,6 +1062,7 @@ class CloudStorageView(View):
|
|
|
except Exception as e:
|
|
|
if order_qs:
|
|
|
order_qs.update(status=10, promotion_rule_id=promotion_rule_id)
|
|
|
+ redisObj.del_data(key=orderID + 'do_notify')
|
|
|
return HttpResponse(pay.xml_to_dict({'return_code': 'FAIL', 'return_msg': repr(e)}))
|
|
|
|
|
|
def do_create_pay_order(self, request_dict, userID, ip, response): # 创建支付订单
|