浏览代码

Merge branch 'dev' into lang

# Conflicts:
#	Controller/CloudStorage.py
lang 4 年之前
父节点
当前提交
2daf89a08f
共有 4 个文件被更改,包括 200 次插入168 次删除
  1. 20 1
      Controller/CloudStorage.py
  2. 13 4
      Controller/CloudTest.py
  3. 154 152
      Controller/CloudVod.py
  4. 13 11
      Object/ResponseObject.py

+ 20 - 1
Controller/CloudStorage.py

@@ -479,7 +479,7 @@ class CloudStorageView(View):
         if not dv_qs.exists():
             return response.json(12)
         if dv_qs[0]['primaryUserID'] != '' and dv_qs[0]['primaryUserID'] != userID:
-            return response.json(13, '非设备主用户无法购买')
+            return response.json(10034)
         now_time = int(time.time())
         bv_qs = UID_Bucket.objects.filter(uid=uid,channel=channel, endTime__gte=now_time).order_by('addTime')
         if not bv_qs.exists():
@@ -1177,6 +1177,16 @@ class CloudStorageView(View):
 
         if uid == None or channel == None or commodity_code == None or pay_type == None or rank == None:
             return response.json(13, '参数有误.')
+
+        dvq = Device_Info.objects.filter(UID=uid)
+        dvq=dvq.filter(~Q(primaryUserID='')).values('primaryUserID')
+        if dvq.exists():
+            if dvq[0]['primaryUserID']!=userID:
+                if pay_type==10:
+                    return response.json(10035)
+                if pay_type==11:
+                    return response.json(10036)
+
         dv_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False, isExist=1)
         if not dv_qs.exists():
             return response.json(12)
@@ -1211,6 +1221,15 @@ class CloudStorageView(View):
                                    commodity_code=commodity_code, commodity_type=smqs[0]['commodity_type'],
                                    rank_id=rank,status=1, uid_bucket_id=uid_bucket_id)
 
+        dvq = Device_Info.objects.filter(UID=UID, primaryUserID='', primaryMaster='')
+        if dvq.exists():
+            dvq_set_update_dict = {
+                'primaryUserID': userid,
+                'primaryMaster': username
+            }
+            dvq.update(**dvq_set_update_dict)
+        order_qs.update(status=1, updTime=nowTime, uid_bucket_id=uid_bucket_id)
+
         # return response.json(0)
         returnurl = "{SERVER_DOMAIN}cloudstorage/payOK".format(SERVER_DOMAIN=SERVER_DOMAIN)
         if pay_type == 10:

+ 13 - 4
Controller/CloudTest.py

@@ -61,15 +61,23 @@ class cloudTestView(View):
             deviceUser_qs = Device_User.objects.filter(
                 Q(username=loginName) | Q(phone=loginName) | Q(userEmail=loginName)).values('userID')
             userID = deviceUser_qs[0]['userID']
-            # 判断该用户的userID是否跟转移的一样
+            # 判断新用户的userID是否跟旧用户的一样
             if userID == oldUserID:
                 return response.json(10009)
             # 判断该用户是否已有此设备UID
-            new_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isExist=1)
-            if new_deviceInfo_qs:
+            # new_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isExist=1)
+            # if new_deviceInfo_qs:
+            #     return response.json(10009)
+            # 获取新用户的主用户UserID和主用户名
+            new_deviceInfo_qs = Device_Info.objects.filter(userID_id=userID, isExist=1).values('UID', 'primaryUserID',
+                                                                                               'primaryMaster')
+            if new_deviceInfo_qs[0]['UID'] == userID:
+                # 新用户已有此设备
                 return response.json(10009)
+            primaryUserID = new_deviceInfo_qs[0]['primaryUserID']
+            primaryMaster = new_deviceInfo_qs[0]['primaryMaster']
             # 更新设备信息
-            old_deviceInfo_qs.update(userID=userID)
+            old_deviceInfo_qs.update(userID=userID, primaryUserID=primaryUserID, primaryMaster=primaryMaster)
         except Exception as e:
             # print(e)
             return response.json(500, repr(e))
@@ -144,3 +152,4 @@ class cloudTestView(View):
                 return response.json(500, repr(e))
             else:
                 return response.json(0)
+        response.json(404)

+ 154 - 152
Controller/CloudVod.py

@@ -1120,160 +1120,162 @@ class CloudVodView(View):
         response = HttpResponse()
         success_pay_content = '''
 
-
-<!-- saved from url=(0040)http://test.dvema.com/cloudstorage/payOK -->
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-        <!--浏览器不缓存-->
-        <meta http-equiv="Pragma" content="no-cache">
-        <meta http-equiv="Cache-Control" content="no-cache">
-        <meta http-equiv="Expires" content="0">
-        <!--utf-8-->
-    
-    <!-- viewport的<meta>标签,这个标签可以修改在大部分的移动设备上面的显示,为了确保适当的绘制和触屏缩放。-->
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <link rel="shortcut icon" href="https://test.dvema.com/web/images/favicon.ico" type="image/x-icon" charset="utf-8">  
-    <title>支付成功</title>
-    <style>
-            .title_head{
-                    height: 50px;
-                    border-radius: 5px;
-                    background-color: #c3c6c7; 
-                    text-align: center;
-                    line-height: 50px;
-            }
-            .content{
-                    text-align: center;
-                    margin-top: 50px;
-                    font-size: 15px;
-                    color:#0000008A;
-					
-            }
-            .content_img{
-					margin-bottom:15px;
-                    width: 60px; 
-                    height: 60px;
-            }
-            .bottom{
-                     margin-bottom: 10px; 
-                     margin-top: 250px; 
-                     color : white;
-            }
-            .bottom_div{
-                    border: 1px solid #68c9c5; 
-                    line-height: 38px; 
-                    text-align: center; 
-                    width: 100px; 
-                    height: 38px;
-                    border-radius: 30px;
-					background-color:#68c9c5; 
-            }
-            
-            .bottom_div:hover{
-                    background-color: #dde4e2;
-            }
-    </style>
-</head>
-<body style="" rlt="1" inmaintabuse="true">
-        
-    <div class="content">
-            <p>
-					<img src="./支付成功_files/success.png" class="content_img">
-                    <br>
-                    支付成功
-            </p>
-    </div>
-    <center class="bottom">
-            <div class="bottom_div" onclick="payOKButton()"> 
-             完成
-            </div>
-    </center>
-    <script src="./支付成功_files/hm.js.下载"></script><script>             // 点击付款成功按钮
-    function payOKButton() {
-        // 复杂数据
-        console.log('success')
-        window.location.href="https://www.baidu.com?page=closePage"  
-    }
-        </script>
- 
-
-        <div id="qds" style="display:none;"></div>
-        </body></html>
+            <!-- saved from url=(0040)http://test.dvema.com/cloudstorage/payOK -->
+            <html>
+                <head>
+                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+                    <!--浏览器不缓存-->
+                    <meta http-equiv="Pragma" content="no-cache">
+                    <meta http-equiv="Cache-Control" content="no-cache">
+                    <meta http-equiv="Expires" content="0">
+                    <!--utf-8-->
+                
+                    <!-- viewport的<meta>标签,这个标签可以修改在大部分的移动设备上面的显示,为了确保适当的绘制和触屏缩放。-->
+                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+                    <link rel="shortcut icon" href="https://test.dvema.com/web/images/favicon.ico" type="image/x-icon" charset="utf-8">  
+                    <title>支付成功</title>
+                    <style>
+                            .title_head{
+                                    height: 50px;
+                                    border-radius: 5px;
+                                    background-color: #c3c6c7; 
+                                    text-align: center;
+                                    line-height: 50px;
+                            }
+                            .content{
+                                    text-align: center;
+                                    margin-top: 50px;
+                                    font-size: 15px;
+                                    color:#0000008A;
+                                    
+                            }
+                            .content_img{
+                                    margin-bottom:15px;
+                                    width: 60px; 
+                                    height: 60px;
+                            }
+                            .bottom{
+                                     margin-bottom: 10px; 
+                                     margin-top: 250px; 
+                                     color : white;
+                            }
+                            .bottom_div{
+                                    border: 1px solid #68c9c5; 
+                                    line-height: 38px; 
+                                    text-align: center; 
+                                    width: 100px; 
+                                    height: 38px;
+                                    border-radius: 30px;
+                                    background-color:#68c9c5; 
+                            }
+                            
+                            .bottom_div:hover{
+                                    background-color: #dde4e2;
+                            }
+                    </style>
+                </head>
+                <body style="" rlt="1" inmaintabuse="true">
+                    <div class="content">
+                        <p>
+                            <img src="https://test.dvema.com/web/images/success.png" class="content_img">
+                            <br>
+                            支付成功
+                        </p>
+                    </div>
+                    <center class="bottom">
+                        <div class="bottom_div" onclick="payOKButton()"> 
+                         完成
+                        </div>
+                    </center>
+                    <script src="./支付成功_files/hm.js.下载"></script><script>             // 点击付款成功按钮
+                        function payOKButton() {
+                            // 复杂数据
+                            console.log('success')
+                            window.location.href="https://www.baidu.com?page=closePage"  
+                        }
+                    </script>
+                    <div id="qds" style="display:none;"></div>
+                </body>
+            </html>
                         '''
         falil_pay_content = '''
-        <!DOCTYPE html>
-        <html>
-        <head>
-        	<!--浏览器不缓存-->
-        	<meta http-equiv="Pragma" content="no-cache">
-        	<meta http-equiv="Cache-Control" content="no-cache">
-        	<meta http-equiv="Expires" content="0">
-        	<!--utf-8-->
-            <meta http-equiv="content-type" content="text/html;charset=utf-8">
-            <!-- viewport的<meta>标签,这个标签可以修改在大部分的移动设备上面的显示,为了确保适当的绘制和触屏缩放。-->
-            <meta name="viewport" content="width=device-width, initial-scale=1.0">
-            <link rel="shortcut icon" href="https://test.dvema.com/web/images/favicon.ico" type="image/x-icon"  charset="utf-8"/>  
-            <title>Trading particulars</title>
-            <style>
-            	.title_head{
-            		height: 50px;
-            		border-radius: 5px;
-            		background-color: #c3c6c7; 
-            		text-align: center;
-            		line-height: 50px;
-            	}
-            	.content{
-            		text-align: center;
-            		margin-top: 50px;
-            		font-size: 20px;
-            		color : #ec7648
-            	}
-            	.content_img{
-            		width: 60px; 
-            		height: 60px;
-            	}
-            	.bottom{
-            		 margin-bottom: 10px; 
-            		 margin-top: 250px; 
-            		 color : #ec7648
-            	}
-            	.bottom_div{
-            		border: 1px solid #ec7648; 
-            		line-height: 38px; 
-            		text-align: center; 
-            		width: 100px; 
-            		height: 38px;
-            		border-radius: 5px;
-            	}
-
-            	.bottom_div:hover{
-            		background-color: #dde4e2;
-            	}
-            </style>
-        </head>
-        <body>
-        	<div class="title_head">Trading particulars</div>
-            <div class="content">
-            	<p >
-            		<img src="https://test.dvema.com/web/images/failed.jpg" class="content_img">
-            		<br />
-            		Payment failure
-            	</p>
-            </div>
-            <center class="bottom">
-            	<div class="bottom_div" onclick="payOKButton()"> 
-            	 Finish
-            	</div>
-            </center>
-            <script> 	    // 点击付款成功按钮
-            function payOKButton() {
-                // 复杂数据
-                console.log('success')
-                //window.webkit.messageHandlers.jsCallOC.postMessage({"status": 0});
-                window.location.href="https://www.baidu.com?page=closePage"  
-            }
-        	</script>
-        </body> 
-        </html>
+            <!DOCTYPE html>
+            <!-- saved from url=(0301)http://test.dvema.com/cloudVod/orderStatus?orderID=20201222084512037485&token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsYW5nIjoiY24iLCJleHAiOjE2MTEyMTg2OTEsInVzZXIiOiIxMzgwMDEzODAwMDE1NzU4ODgzNTAwNjEyMDgiLCJ1c2VySUQiOiIxMzgwMDEzODAwMDE1NzU4ODgzNTAwNjEyMDgifQ.Jjcana0NjrHzAv6CusQrVANK3Bn0gnDrc_CKDZruIgk -->
+            <html>
+                <head>
+                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+                    <!--浏览器不缓存-->
+                    <meta http-equiv="Pragma" content="no-cache">
+                    <meta http-equiv="Cache-Control" content="no-cache">
+                    <meta http-equiv="Expires" content="0">
+                    <!--utf-8-->
+                    
+                    <!-- viewport的<meta>标签,这个标签可以修改在大部分的移动设备上面的显示,为了确保适当的绘制和触屏缩放。-->
+                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+                    <link rel="shortcut icon" href="https://test.dvema.com/web/images/favicon.ico" type="image/x-icon" charset="utf-8">  
+                    <title>支付失败</title>
+                    <style>
+                        .title_head{
+                            height: 50px;
+                            border-radius: 5px;
+                            background-color: #c3c6c7; 
+                            text-align: center;
+                            line-height: 50px;
+                        }
+                        .content{
+                            text-align: center;
+                            margin-top: 50px;
+                            font-size: 20px;
+                            color : #0000008A;
+                        }
+                        .content_img{
+                            margin-bottom:15px;
+                            width: 60px; 
+                            height: 60px;
+                        }
+                        .bottom{
+                             margin-bottom: 10px; 
+                             margin-top: 250px; 
+                             color : #fff;
+                        }
+                        .bottom_div{
+                            border: 1px solid #68c9c5; 
+                            line-height: 38px; 
+                            text-align: center; 
+                            width: 100px; 
+                            height: 38px;
+                            border-radius: 30px;
+                            background-color:rgba(199, 0, 11, 1); 
+                        }
+            
+                        .bottom_div:hover{
+                            background-color: #dde4e2;
+                        }
+                    </style>
+                </head>
+                <body>
+                    <div class="content">
+                        <p>
+                            <img src="https://test.dvema.com/web/images/fail.png" class="content_img">
+                            <br>
+                            支付失败
+                        </p>
+                    </div>
+                    <center class="bottom">
+                        <div class="bottom_div" onclick="payOKButton()"> 
+                         完成
+                        </div>
+                    </center>
+                    <script> 	    // 点击付款成功按钮
+                    function payOKButton() {
+                        // 复杂数据
+                        console.log('success')
+                        //window.webkit.messageHandlers.jsCallOC.postMessage({"status": 0});
+                        window.location.href="https://www.baidu.com?page=closePage"  
+                    }
+                    </script>
+                 </body>
+            </html>
                         '''
         if om_qs.exists():
             if om_qs[0]['status'] == 1:

+ 13 - 11
Object/ResponseObject.py

@@ -82,9 +82,10 @@ 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',
+            10033: 'The primary user of the device cannot purchase it',
+            10034: 'Non device primary users cannot view cloud storage',
+            10035: 'Non device primary users cannot experience cloud storage',
+            10036: 'Non device primary users cannot exchange for cloud storage',
         }
         data_cn = {
             0: '成功',
@@ -157,14 +158,15 @@ class ResponseObject(object):
             10008: '用户没有此设备,无法转移',
             10009: '用户已拥有此设备,无法转移',
             10010: '不是同一账户下的设备,无法转移',
-            10011: '原设备正在正常使用云存储服务,无法转移',
-            # 10012: '接受转移设备未开通过云存储服务,无法转移',
-            10013: '接受转移设备套餐未过期,无法转移',
-            10014: '体验套餐无法转移',
-            10015: '原设备套餐已过期,无法转移',
-            10030: '未购买云存',
-            10031: '云存已过期',
-            10032: '切换的云存套餐ID不能与正在使用中的相同',
+            10011: '接受转移设备不存在,无法转移',
+            10012: '体验套餐无法转移',
+            10013: '原设备套餐已过期,无法转移',
+            10014: '接受转移设备套餐未过期,无法转移' ,
+            10033: '非设备主用户无法购买',
+            10034: '非设备主用户无法查看云存',
+            10035: '非设备主用户无法体验云存',
+            10036: '非设备主用户无法兑换云存',
+
         }
         if self.lang == 'cn':
             msg = data_cn