lang 3 gadi atpakaļ
vecāks
revīzija
6fabab207c
1 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. 7 4
      Controller/CloudStorage.py

+ 7 - 4
Controller/CloudStorage.py

@@ -1200,9 +1200,10 @@ class CloudStorageView(View):
         lang = request_dict.get('lang', 'en')
 
         redisObj = RedisObject()
-        if redisObj.get_data(key=uid+'do_experience_order'):
-            return response.json(5)
-        redisObj.set_data(key=uid+'do_experience_order', val=uid, expire=300)
+        redisObj.CONN.setnx(uid+'do_experience_order', 1)
+        re.CONN.expire(uid+'do_experience_order', 60)
+        if not res:
+            return json(200000, 'Invalid request')
 
         if cdk is not None and pay_type == 11:
             cdk_qs = CDKcontextModel.objects.filter(cdk=cdk).values('is_activate', 'rank__id', 'rank__commodity_code')
@@ -1214,6 +1215,7 @@ class CloudStorageView(View):
             commodity_code = cdk_qs[0]['rank__commodity_code']
 
         if uid is None or channel is None or commodity_code is None or pay_type is None or rank is None:
+            del_data(key=uid + 'do_experience_order')
             return response.json(13, '参数有误.')
 
         dvq = Device_Info.objects.filter(UID=uid)
@@ -1324,10 +1326,11 @@ class CloudStorageView(View):
                     sms = 'SMS_219748439'
 
                 self.do_vod_msg_Notice(uid, channel, userID, lang, sys_msg_text_list, sms)
-                redisObj.del_data(key=uid+'do_experience_order')
                 result = returnurl
+                redisObj.del_data(key=uid+'do_experience_order')
                 return response.json(0, result)
         except Exception:
+            del_data(key=uid + 'do_experience_order')
             return response.json(474)
         # red_url =
         # return JsonResponse(status=200, data={'red_url': red_url})