浏览代码

update field

lang 4 年之前
父节点
当前提交
64212f137a
共有 2 个文件被更改,包括 26 次插入18 次删除
  1. 18 18
      Controller/CloudStorage.py
  2. 8 0
      Object/ResponseObject.py

+ 18 - 18
Controller/CloudStorage.py

@@ -208,7 +208,7 @@ class CloudStorageView(View):
         qs = qs.values("id", "title", "content", "price","day", "currency", "bucket__storeDay",
                        "bucket__bucket", "bucket__area","commodity_code",
                        "commodity_type", "is_discounts", "virtual_price", "expire",
-                       "discount_price", "discount_content")
+                       "discount_price", "discount_content","symbol")
 
         if qs.exists():
             ql = list(qs)
@@ -478,7 +478,7 @@ class CloudStorageView(View):
         now_time = int(time.time())
         bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('endTime')
         if not bv_qs.exists():
-            return response.json(103,'未购买')
+            return response.json(10014)
         vh_qs = VodHlsModel.objects.filter \
             ( 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")
@@ -656,10 +656,10 @@ class CloudStorageView(View):
             return response.json(12)
         ubqs = UID_Bucket.objects.filter(channel=channel, uid=uid).order_by('endTime')
         if not ubqs.exists():
-            return response.json(10, '未购买')
+            return response.json(10014)
         now_time = int(time.time())
         if now_time > ubqs[0].endTime:
-            return response.json(102,'已过期')
+            return response.json(10015)
         ubqs.update(status=status)
         if status == 0:
             return response.json(0)
@@ -869,7 +869,7 @@ class CloudStorageView(View):
                 values("day", "bucket_id", "bucket__storeDay")
             bucketId = smqs[0]['bucket_id']
             if not smqs.exists():
-                return response.json(0, '套餐已删除')
+                return response.json(173)
             addTime = int(smqs[0]["day"]) * 24 * 3600
             ubqs = UID_Bucket.objects.filter(uid=UID, channel=channel). \
                 values("bucket_id", "endTime", "bucket__storeDay")
@@ -917,7 +917,7 @@ class CloudStorageView(View):
             values("day", "bucket_id", "bucket__storeDay", "expire")
         bucketId = smqs[0]['bucket_id']
         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). \
             values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
@@ -991,16 +991,16 @@ class CloudStorageView(View):
         rank = request_dict.get('rank', None)
         is_select_discount = request_dict.get('is_select_discount', 0)
         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)
         if not dv_qs.exists():
-            return response.json(12)
+            return response.json(173)
         smqs = Store_Meal.objects.filter(id=rank, pay_type=pay_type). \
             values('currency', 'price', 'content', 'day',
                    'commodity_type', 'title', 'content',
                    'expire', 'commodity_code', 'discount_price')
         if not smqs.exists():
-            return response.json(10, '套餐不存在')
+            return response.json(10016)
         currency = smqs[0]['currency']
         price = smqs[0]['price']
         if is_select_discount == '1':
@@ -1082,7 +1082,7 @@ class CloudStorageView(View):
                                                           'result': {"redirectUrl": redirectUrl, "orderID": orderID},
                                                           'error_code': 0})
                 else:
-                    return response.json(10, '生成订单错误.')
+                    return response.json(800)
 
         elif pay_type == 3:
             pay = WechatPayObject()
@@ -1096,7 +1096,7 @@ class CloudStorageView(View):
             # 统一调用接口
             response = pay.re_finall()
             if not response:
-                return response.json(10, '生成订单错误.')
+                return response.json(800)
             # 回调函数
             Order_Model.objects.create(orderID=orderID, UID=uid, channel=channel, userID_id=userID,
                                        desc=content, payType=pay_type, payTime=nowTime,
@@ -1240,12 +1240,12 @@ class CloudStorageView(View):
                 VodHlsModel.objects.filter(uid=uid).delete()
             else:
                 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()
         except Exception as e:
             return response.json(424, repr(e))
         else:
-            return response.json(0, '删除成功.')
+            return response.json(0)
 
     #设备关联套餐列表
     def device_commodity(self, request_dict, response):
@@ -1254,7 +1254,7 @@ class CloudStorageView(View):
         uid_bucket = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time).values("id", "uid", "endTime",
                                                                      "bucket__content").order_by('endTime')
         if not uid_bucket.exists():
-            return response.json(404,'该设备未购买云存套餐.')
+            return response.json(10014)
         for index, value in enumerate(uid_bucket):
             value['is_use'] = 0
             if index == 0:
@@ -1271,17 +1271,17 @@ class CloudStorageView(View):
                                                                                "bucket__content").order_by('endTime')
 
             if not using_uid_bucket.exists():
-                return response.json(404,'该设备未购买云存套餐.')
+                return response.json(10014)
 
             if int(using_uid_bucket[0]['id']) == int(switch_commodity_id):
-                return response.json(404,'切换的云存套餐ID不能与正在使用中的相同.')
+                return response.json(10017)
 
             # UID_Bucket.objects.filter(id=switch_commodity_id).update(is_use=1)  #更新转移的云存套餐为使用中
             UID_Bucket.objects.filter(id=using_uid_bucket[0]['id']).delete()    #删除原来使用中的云存套餐
             VodHlsModel.objects.filter(uid=uid).delete()                        #删除播放列表
             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):

+ 8 - 0
Object/ResponseObject.py

@@ -74,6 +74,10 @@ class ResponseObject(object):
             10004: 'The request method is incorrect. Please contact the developer',
             10005: 'Wrong configuration, wrong customer number',
             10006: 'Configuration error. The path value is incorrect',
+            10014: 'Cloud storage not purchased',
+            10015: 'The cloud storage has expired',
+            10016: 'Cloud storage package does not exist',
+            10017: 'The switched cloud storage package ID cannot be the same as the one in use',
         }
         data_cn = {
             0: '成功',
@@ -149,6 +153,10 @@ class ResponseObject(object):
             10011: '接受转移设备未开通过云存储服务,无法转移',
             10012: '接受转移设备套餐未过期,无法转移',
             10013: '体验套餐无法转移',
+            10014: '云存未购买',
+            10015: '云存已过期',
+            10016: '云存套餐不存在',
+            10017: '切换的云存套餐ID不能与正在使用中的相同',
         }
         if self.lang == 'cn':
             msg = data_cn