فهرست منبع

优惠券订单加锁

zhangdongming 1 روز پیش
والد
کامیت
938db2a953
1فایلهای تغییر یافته به همراه11 افزوده شده و 10 حذف شده
  1. 11 10
      Controller/CloudStorage.py

+ 11 - 10
Controller/CloudStorage.py

@@ -1581,16 +1581,17 @@ class CloudStorageView(View):
                     coupon_ids = CouponModel.objects.filter(userID=user_id, use_status=0,
                                                             coupon_config__id=coupon_combo_qs[0]["coupon_id"],
                                                             valid_time__gte=now_time).values_list("id", flat=True)
-                    redis_obj = RedisObject()
-                    for c_id in coupon_ids:
-                        key_coupon = f"{RedisKeyConstant.COUPON_ID_LOCK.value}{c_id}"
-                        coupon_lock = redis_obj.get_data(key_coupon)
-                        if not coupon_lock:
-                            redis_obj.set_data(key_coupon, 1, 60)
-                            coupon_id = c_id
-                            break
-                    else:
-                        return response.json(5)
+                    if uid not in ['5Z1LZLK7D5Y6WKDE111A', '7ZB7V8B5LA48K1MC111A', '4XES12WGN9D9KLEJ111A']:
+                        redis_obj = RedisObject()
+                        for c_id in coupon_ids:
+                            key_coupon = f"{RedisKeyConstant.COUPON_ID_LOCK.value}{c_id}"
+                            coupon_lock = redis_obj.get_data(key_coupon)
+                            if not coupon_lock:
+                                redis_obj.set_data(key_coupon, 1, 60)
+                                coupon_id = c_id
+                                break
+                            else:
+                                return response.json(5)
 
             Order_Model.objects.create(
                 orderID=order_id, UID=uid, channel=channel, userID_id=user_id, desc=content, payType=pay_type,