瀏覽代碼

update field

lang 4 年之前
父節點
當前提交
34cf418d84
共有 2 個文件被更改,包括 22 次插入16 次删除
  1. 16 16
      Controller/CloudStorage.py
  2. 6 0
      Object/ResponseObject.py

+ 16 - 16
Controller/CloudStorage.py

@@ -210,7 +210,7 @@ class CloudStorageView(View):
         qs = qs.values("id", "title", "content", "price","day", "currency", "bucket__storeDay",
         qs = qs.values("id", "title", "content", "price","day", "currency", "bucket__storeDay",
                        "bucket__bucket", "bucket__area","commodity_code",
                        "bucket__bucket", "bucket__area","commodity_code",
                        "commodity_type", "is_discounts", "virtual_price", "expire",
                        "commodity_type", "is_discounts", "virtual_price", "expire",
-                       "discount_price", "discount_content")
+                       "discount_price", "discount_content","symbol")
 
 
         if qs.exists():
         if qs.exists():
             ql = list(qs)
             ql = list(qs)
@@ -246,7 +246,7 @@ class CloudStorageView(View):
         vh_qs = VodHlsModel.objects.filter(uid=uid, channel=channel, time=storeTime, endTime__gte=now_time). \
         vh_qs = VodHlsModel.objects.filter(uid=uid, channel=channel, time=storeTime, endTime__gte=now_time). \
             values("sec", "fg", "bucket__bucket", "bucket__endpoint", "bucket__region", "bucket__mold")
             values("sec", "fg", "bucket__bucket", "bucket__endpoint", "bucket__region", "bucket__mold")
         if not vh_qs.exists():
         if not vh_qs.exists():
-            return response.json(11,'不存在.')
+            return response.json(173)
         sec = vh_qs[0]['sec']
         sec = vh_qs[0]['sec']
         fg = vh_qs[0]['fg']
         fg = vh_qs[0]['fg']
         bucket__region = vh_qs[0]['bucket__region']
         bucket__region = vh_qs[0]['bucket__region']
@@ -480,7 +480,7 @@ class CloudStorageView(View):
         now_time = int(time.time())
         now_time = int(time.time())
         bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('endTime')
         bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('endTime')
         if not bv_qs.exists():
         if not bv_qs.exists():
-            return response.json(103,'未购买')
+            return response.json(10030)
         vh_qs = VodHlsModel.objects.filter \
         vh_qs = VodHlsModel.objects.filter \
             ( uid=uid, channel=channel, time__range=(startTime, endTime), endTime__gte=now_time). \
             ( uid=uid, channel=channel, time__range=(startTime, endTime), endTime__gte=now_time). \
             values("id", "time", "sec", "bucket__bucket", "fg", "bucket__endpoint", "bucket__region", "bucket__mold")
             values("id", "time", "sec", "bucket__bucket", "fg", "bucket__endpoint", "bucket__region", "bucket__mold")
@@ -658,10 +658,10 @@ class CloudStorageView(View):
             return response.json(12)
             return response.json(12)
         ubqs = UID_Bucket.objects.filter(channel=channel, uid=uid).order_by('endTime')
         ubqs = UID_Bucket.objects.filter(channel=channel, uid=uid).order_by('endTime')
         if not ubqs.exists():
         if not ubqs.exists():
-            return response.json(10, '未购买')
+            return response.json(10030)
         now_time = int(time.time())
         now_time = int(time.time())
         if now_time > ubqs[0].endTime:
         if now_time > ubqs[0].endTime:
-            return response.json(102,'已过期')
+            return response.json(10031)
         ubqs.update(status=status)
         ubqs.update(status=status)
         if status == 0:
         if status == 0:
             return response.json(0)
             return response.json(0)
@@ -876,7 +876,7 @@ class CloudStorageView(View):
                 values("day", "bucket_id", "bucket__storeDay", "expire")
                 values("day", "bucket_id", "bucket__storeDay", "expire")
             bucketId = smqs[0]['bucket_id']
             bucketId = smqs[0]['bucket_id']
             if not smqs.exists():
             if not smqs.exists():
-                return response.json(0, '套餐已删除')
+                return response.json(173)
             ubqs = UID_Bucket.objects.filter(bucket__id=bucketId, uid=UID, channel=channel, endTime__gte=nowTime). \
             ubqs = UID_Bucket.objects.filter(bucket__id=bucketId, uid=UID, channel=channel, endTime__gte=nowTime). \
                        values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
                        values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
             nowTime = int(time.time())
             nowTime = int(time.time())
@@ -928,7 +928,7 @@ class CloudStorageView(View):
             values("day", "bucket_id", "bucket__storeDay", "expire")
             values("day", "bucket_id", "bucket__storeDay", "expire")
         bucketId = smqs[0]['bucket_id']
         bucketId = smqs[0]['bucket_id']
         if not smqs.exists():
         if not smqs.exists():
-            return response.json(0, '套餐已删除')
+            return response.json(173)
         # ##
         # ##
         ubqs = UID_Bucket.objects.filter(bucket__id=bucketId, uid=UID, channel=channel, endTime__gte=nowTime). \
         ubqs = UID_Bucket.objects.filter(bucket__id=bucketId, uid=UID, channel=channel, endTime__gte=nowTime). \
                    values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
                    values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
@@ -1002,7 +1002,7 @@ class CloudStorageView(View):
         rank = request_dict.get('rank', None)
         rank = request_dict.get('rank', None)
         is_select_discount = request_dict.get('is_select_discount', 0)
         is_select_discount = request_dict.get('is_select_discount', 0)
         if not uid or not channel or not pay_type or not rank:
         if not uid or not channel or not pay_type or not rank:
-            return response.json(13, '参数有误.')
+            return response.json(444)
         dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False, isExist=1)
         dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False, isExist=1)
         if not dv_qs.exists():
         if not dv_qs.exists():
             return response.json(12)
             return response.json(12)
@@ -1011,7 +1011,7 @@ class CloudStorageView(View):
                    'commodity_type', 'title', 'content',
                    'commodity_type', 'title', 'content',
                    'expire', 'commodity_code', 'discount_price')
                    'expire', 'commodity_code', 'discount_price')
         if not smqs.exists():
         if not smqs.exists():
-            return response.json(10, '套餐不存在')
+            return response.json(173)
         currency = smqs[0]['currency']
         currency = smqs[0]['currency']
         price = smqs[0]['price']
         price = smqs[0]['price']
         if is_select_discount == '1':
         if is_select_discount == '1':
@@ -1251,12 +1251,12 @@ class CloudStorageView(View):
                 VodHlsModel.objects.filter(uid=uid).delete()
                 VodHlsModel.objects.filter(uid=uid).delete()
             else:
             else:
                 if type(vod_id_list).__name__ != 'list':
                 if type(vod_id_list).__name__ != 'list':
-                    return response.json(424, 'vod_id_list格式错误')
+                    return response.json(444)
                 VodHlsModel.objects.filter(id__in=vod_id_list).delete()
                 VodHlsModel.objects.filter(id__in=vod_id_list).delete()
         except Exception as e:
         except Exception as e:
             return response.json(424, repr(e))
             return response.json(424, repr(e))
         else:
         else:
-            return response.json(0, '删除成功.')
+            return response.json(0)
 
 
     #设备关联套餐列表
     #设备关联套餐列表
     def device_commodity(self, request_dict, response):
     def device_commodity(self, request_dict, response):
@@ -1265,7 +1265,7 @@ class CloudStorageView(View):
         uid_bucket = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time).values("id", "uid", "endTime",
         uid_bucket = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time).values("id", "uid", "endTime",
                                                                                       "bucket__content").order_by('endTime')
                                                                                       "bucket__content").order_by('endTime')
         if not uid_bucket.exists():
         if not uid_bucket.exists():
-            return response.json(404,'该设备未购买云存套餐.')
+            return response.json(10030)
         for index, value in enumerate(uid_bucket):
         for index, value in enumerate(uid_bucket):
             value['is_use'] = 0
             value['is_use'] = 0
             if index == 0:
             if index == 0:
@@ -1282,17 +1282,17 @@ class CloudStorageView(View):
                                                                                                         "bucket__content").order_by('endTime')
                                                                                                         "bucket__content").order_by('endTime')
 
 
             if not using_uid_bucket.exists():
             if not using_uid_bucket.exists():
-                return response.json(404,'该设备未购买云存套餐.')
+                return response.json(10030)
 
 
             if int(using_uid_bucket[0]['id']) == int(switch_commodity_id):
             if int(using_uid_bucket[0]['id']) == int(switch_commodity_id):
-                return response.json(404,'切换的云存套餐ID不能与正在使用中的相同.')
+                return response.json(10032)
 
 
             # UID_Bucket.objects.filter(id=switch_commodity_id).update(is_use=1)  #更新转移的云存套餐为使用中
             # UID_Bucket.objects.filter(id=switch_commodity_id).update(is_use=1)  #更新转移的云存套餐为使用中
             UID_Bucket.objects.filter(id=using_uid_bucket[0]['id']).delete()    #删除原来使用中的云存套餐
             UID_Bucket.objects.filter(id=using_uid_bucket[0]['id']).delete()    #删除原来使用中的云存套餐
             VodHlsModel.objects.filter(uid=uid).delete()                        #删除播放列表
             VodHlsModel.objects.filter(uid=uid).delete()                        #删除播放列表
             StsCrdModel.objects.filter(uid=uid).delete()                        #删除sts记录
             StsCrdModel.objects.filter(uid=uid).delete()                        #删除sts记录
-            return response.json(0,'切换云存套餐成功')
-        return response.json(404,'切换的套餐ID不能为空')
+            return response.json(0)
+        return response.json(444)
 
 
 #删除过期云存播放列表
 #删除过期云存播放列表
 def deleteVodHls(request):
 def deleteVodHls(request):

+ 6 - 0
Object/ResponseObject.py

@@ -74,6 +74,9 @@ class ResponseObject(object):
             10004: 'The request method is incorrect. Please contact the developer',
             10004: 'The request method is incorrect. Please contact the developer',
             10005: 'Wrong configuration, wrong customer number',
             10005: 'Wrong configuration, wrong customer number',
             10006: 'Configuration error. The path value is incorrect',
             10006: 'Configuration error. The path value is incorrect',
+            10030: 'No purchase of cloud storage',
+            10031: 'The cloud storage has expired',
+            10032: 'The switched cloud storage package ID cannot be the same as the one in use',
         }
         }
         data_cn = {
         data_cn = {
             0: '成功',
             0: '成功',
@@ -151,6 +154,9 @@ class ResponseObject(object):
             10013: '接受转移设备套餐未过期,无法转移',
             10013: '接受转移设备套餐未过期,无法转移',
             10014: '体验套餐无法转移',
             10014: '体验套餐无法转移',
             10015: '原设备套餐已过期,无法转移',
             10015: '原设备套餐已过期,无法转移',
+            10030: '未购买云存',
+            10031: '云存已过期',
+            10032: '切换的云存套餐ID不能与正在使用中的相同',
         }
         }
         if self.lang == 'cn':
         if self.lang == 'cn':
             msg = data_cn
             msg = data_cn