Эх сурвалжийг харах

修改云存套餐转移接口

locky 2 жил өмнө
parent
commit
20d549f669

+ 4 - 6
Controller/CloudTransfer.py

@@ -162,6 +162,7 @@ class cloudTestView(View):
             new_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=new_uid).values('isExist')
             if not (old_deviceInfo_qs.exists() and new_deviceInfo_qs.exists()):
                 return response.json(10010)
+            username = old_deviceInfo_qs[0]['userID__username']
 
             # 不是主用户无法转移
             vodPrimaryUserID = old_deviceInfo_qs[0]['vodPrimaryUserID']
@@ -182,6 +183,7 @@ class cloudTestView(View):
                 'addTime')
             if not old_using_uid_bucket.exists():
                 return response.json(10013)
+            bucket_content = old_using_uid_bucket[0]['bucket__content']
 
             # 免费存储桶不可转移
             old_vod_bucket_id = old_using_uid_bucket[0]['bucket_id']
@@ -236,16 +238,12 @@ class cloudTestView(View):
                     'time': int(time.time()),
                     'url': 'cloudTransfer/mealTransfer',
                     'content': json.dumps(content),
-                    'operation': '用户{}的设备{}的套餐{}转移给设备{}'.format(old_deviceInfo_qs[0]['userID__username'], old_uid,
-                                                                old_using_uid_bucket[0]['bucket__content'], new_uid),
+                    'operation': '用户{}的设备{}的套餐{}转移给设备{}'.format(username, old_uid, bucket_content, new_uid),
                 }
                 LogModel.objects.create(**log)
-
+            return response.json(0)
         except Exception as e:
-            # print(e)
             return response.json(500, repr(e))
-        else:
-            return response.json(0)
 
     def expireMeal(self, request_dict, response):
         UID_Bucket_id = request_dict.get("UID_Bucket_id", None)