fix bug: ValueError: invalid literal for int() with base 10: 'origin'

Brightcells %!s(int64=8) %!d(string=hace) años
padre
commit
23f00aedae
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      pay/views.py

+ 3 - 1
pay/views.py

@@ -37,6 +37,8 @@ def wx_order_create_api(request):
37 37
     photo_id = request.POST.get('photo_id', '')
38 38
     photo_type = request.POST.get('photo_type', 'nomark')  # nomark for 去除水印, origin for 获取高清图
39 39
 
40
+    photo_type_ = OrderInfo.ORIGIN if photo_type == 'origin' else OrderInfo.NOMARK
41
+
40 42
     # 群组照片校验
41 43
     try:
42 44
         group_photo = GroupPhotoInfo.objects.get(pk=photo_id)
@@ -44,7 +46,7 @@ def wx_order_create_api(request):
44 46
         return response(GroupPhotoStatusCode.GROUP_PHOTO_NOT_FOUND)
45 47
 
46 48
     # 判断是否重复购买
47
-    if OrderInfo.objects.filter(photo_id=photo_id, photo_type=photo_type, from_uid=user_id, pay_status=OrderInfo.PAID).exists():
49
+    if OrderInfo.objects.filter(photo_id=photo_id, photo_type=photo_type_, from_uid=user_id, pay_status=OrderInfo.PAID).exists():
48 50
         return response(OrderStatusCode.WX_ORDER_PAID_ALREADY_EXISTS)
49 51
 
50 52
     body = request.POST.get('body', '')  # 商品描述