e nl-222 ol-222">
+ goods_info = RoomGoodsInfo.objects.get(room_id=order.room_id, goods_id=order.goods_id, anchor_id=order.anchor_id)
+ goods_info.inventory += order.amount
+ goods_info.save()
+ except:
+ return
+
+@logit
+@transaction.atomic
+def notify_url_api(request):
+ """ 支付异步通知回调地址 """
+ notify_data, success = check_pay_notify(request.body, wx_configs=settings.WECHAT)
+ if not success:
+ return HttpResponse(WXPAY_NOTIFY_FAIL)
+
+ order = RoomOrderInfo.objects.select_for_update().get(order_id=notify_data.get('out_trade_no', ''), status=True)
+
+ order.notify_msg = request.body
+ order.transaction_id = notify_data.get('transaction_id', '')
+ order.save()
+
+ result_code = notify_data.get('result_code', '')
+ if result_code == 'SUCCESS':
+ live_views.order_paid_success(order)
+ else:
+ live_views.order_paid_fail(order)
+
+ return HttpResponse(WXPAY_NOTIFY_SUCCESS)
@@ -18,8 +18,11 @@ from account.models import UserInfo |
||
| 18 | 18 |
from goods.models import GoodsInfo, PackGoodsInfo, PackGoodsSaleInfo, PackInfo |
| 19 | 19 |
from kol.models import KOLInfo |
| 20 | 20 |
from pay.models import OrderInfo |
| 21 |
+from live.models import RoomOrderInfo |
|
| 21 | 22 |
from utils.error.errno_utils import KOLStatusCode, OrderStatusCode, PackGoodsStatusCode, PackStatusCode, UserStatusCode |
| 22 | 23 |
|
| 24 |
+from live import views as live_views |
|
| 25 |
+ |
|
| 23 | 26 |
|
| 24 | 27 |
WECHAT = settings.WECHAT |
| 25 | 28 |
|
@@ -215,19 +218,22 @@ def wx_notify_url_api(request): |
||
| 215 | 218 |
if not success: |
| 216 | 219 |
return HttpResponse(WXPAY_NOTIFY_FAIL) |
| 217 | 220 |
|
| 221 |
+ #尖货接龙订单 |
|
| 218 | 222 |
try: |
| 219 | 223 |
order = OrderInfo.objects.select_for_update().get(order_id=notify_data.get('out_trade_no', ''), status=True)
|
| 220 |
- except OrderInfo.DoesNotExist: |
|
| 221 |
- return HttpResponse(WXPAY_NOTIFY_FAIL) |
|
| 224 |
+ order.notify_msg = request.body |
|
| 225 |
+ order.transaction_id = notify_data.get('transaction_id', '')
|
|
| 226 |
+ order.save() |
|
| 222 | 227 |
|
| 223 |
- order.notify_msg = request.body |
|
| 224 |
- order.transaction_id = notify_data.get('transaction_id', '')
|
|
| 225 |
- order.save() |
|
| 228 |
+ result_code = notify_data.get('result_code', '')
|
|
| 229 |
+ if result_code == 'SUCCESS': |
|
| 230 |
+ order_paid_success(order) |
|
| 231 |
+ else: |
|
| 232 |
+ order_paid_fail(order) |
|
| 233 |
+ |
|
| 234 |
+ return HttpResponse(WXPAY_NOTIFY_SUCCESS) |
|
| 235 |
+ except: |
|
| 236 |
+ return HttpResponse(WXPAY_NOTIFY_FAIL) |
|
| 226 | 237 |
|
| 227 |
- result_code = notify_data.get('result_code', '')
|
|
| 228 |
- if result_code == 'SUCCESS': |
|
| 229 |
- order_paid_success(order) |
|
| 230 |
- else: |
|
| 231 |
- order_paid_fail(order) |
|
| 232 | 238 |
|
| 233 | 239 |
return HttpResponse(WXPAY_NOTIFY_SUCCESS) |