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

Merge branch 'dev' of http://192.168.136.99:3000/SERVER/AnsjerServer into bin

 Conflicts:
	Object/ResponseObject.py
chenshibin 4 жил өмнө
parent
commit
b35b88d758

+ 24 - 24
Controller/CloudStorage.py

@@ -210,7 +210,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)
@@ -246,7 +246,7 @@ class CloudStorageView(View):
         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")
         if not vh_qs.exists():
-            return response.json(11,'不存在.')
+            return response.json(173)
         sec = vh_qs[0]['sec']
         fg = vh_qs[0]['fg']
         bucket__region = vh_qs[0]['bucket__region']
@@ -326,8 +326,8 @@ class CloudStorageView(View):
         print(uid)
         now_time = int(time.time())
         ubqs = UID_Bucket.objects.filter(uid=uid, channel=channel, endTime__gte=now_time). \
-            values("bucket__mold", "bucket__bucket", "bucket__endpoint",
-                   "bucket__region", "endTime").order_by('endTime')[:1]
+                   values("bucket__mold", "bucket__bucket", "bucket__endpoint",
+                          "bucket__region", "endTime").order_by('endTime')[:1]
         if ubqs.exists():
             if ubqs[0]["bucket__mold"] == 0:
                 # 阿里云 oss sts
@@ -480,7 +480,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(10030)
         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")
@@ -564,8 +564,8 @@ class CloudStorageView(View):
         print(channel)
         now_time = int(time.time())
         ubqs = UID_Bucket.objects.filter(uid=UID, channel=channel, endTime__gte=now_time). \
-            values("bucket__mold", "bucket__bucket", "bucket__endpoint",
-                   "bucket__region", "status", "bucket__storeDay", "bucket__id").order_by('endTime')[:1]
+                   values("bucket__mold", "bucket__bucket", "bucket__endpoint",
+                          "bucket__region", "status", "bucket__storeDay", "bucket__id").order_by('endTime')[:1]
         if ubqs.exists():
             ub_qs_data = ubqs[0]
             store_day = ub_qs_data['bucket__storeDay']
@@ -658,10 +658,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(10030)
         now_time = int(time.time())
         if now_time > ubqs[0].endTime:
-            return response.json(102,'已过期')
+            return response.json(10031)
         ubqs.update(status=status)
         if status == 0:
             return response.json(0)
@@ -876,7 +876,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]
             nowTime = int(time.time())
@@ -928,10 +928,10 @@ 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]
+                   values("id", "bucket__storeDay", "bucket__region", "endTime").order_by('endTime')[:1]
         expire = smqs[0]['expire']
         if order_list[0]['isSelectDiscounts'] == 1:
             expire = smqs[0]['expire'] * 2
@@ -975,7 +975,7 @@ class CloudStorageView(View):
                 return HttpResponse(WechatPayObject.xml_to_dict({'return_code':'FAIL', 'return_msg':'套餐不存在'}))
             # ##
             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]
             expire = smqs[0]['expire']
             if order_list[0]['isSelectDiscounts'] == 1:
                 expire = smqs[0]['expire'] * 2
@@ -1002,7 +1002,7 @@ 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)
@@ -1011,7 +1011,7 @@ class CloudStorageView(View):
                    'commodity_type', 'title', 'content',
                    'expire', 'commodity_code', 'discount_price')
         if not smqs.exists():
-            return response.json(10, '套餐不存在')
+            return response.json(173)
         currency = smqs[0]['currency']
         price = smqs[0]['price']
         if is_select_discount == '1':
@@ -1251,21 +1251,21 @@ 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):
         uid = request_dict.get('uid',None)
         now_time = int(time.time())
         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():
-            return response.json(404,'该设备未购买云存套餐.')
+            return response.json(10030)
         for index, value in enumerate(uid_bucket):
             value['is_use'] = 0
             if index == 0:
@@ -1279,20 +1279,20 @@ class CloudStorageView(View):
         if switch_commodity_id:
             #切换设备套餐关联
             using_uid_bucket = UID_Bucket.objects.filter(uid=uid, endTime__gte=int(time.time())).values("id", "uid", "endTime",
-                                                                               "bucket__content").order_by('endTime')
+                                                                                                        "bucket__content").order_by('endTime')
 
             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):
-                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=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):

+ 11 - 4
Object/ResponseObject.py

@@ -82,6 +82,9 @@ class ResponseObject(object):
             10012: 'Experience packages cannot be transferred',
             10013: 'Original equipment package has expired and cannot be transferred',
             10014: 'Accept transfer of equipment packages that have not expired and cannot be transferred',
+            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 = {
             0: '成功',
@@ -154,10 +157,14 @@ class ResponseObject(object):
             10008: '用户没有此设备,无法转移',
             10009: '用户已拥有此设备,无法转移',
             10010: '不是同一账户下的设备,无法转移',
-            10011: '接受转移设备不存在,无法转移',
-            10012: '体验套餐无法转移',
-            10013: '原设备套餐已过期,无法转移',
-            10014: '接受转移设备套餐未过期,无法转移',
+            10011: '原设备正在正常使用云存储服务,无法转移',
+            # 10012: '接受转移设备未开通过云存储服务,无法转移',
+            10013: '接受转移设备套餐未过期,无法转移',
+            10014: '体验套餐无法转移',
+            10015: '原设备套餐已过期,无法转移',
+            10030: '未购买云存',
+            10031: '云存已过期',
+            10032: '切换的云存套餐ID不能与正在使用中的相同',
         }
         if self.lang == 'cn':
             msg = data_cn