chenjunkai 6 роки тому
батько
коміт
3b5a0834fc
1 змінених файлів з 170 додано та 0 видалено
  1. 170 0
      Controller/CloudVod.py

+ 170 - 0
Controller/CloudVod.py

@@ -121,6 +121,8 @@ class CloudVodView(View):
             # 支付宝支付
             # 支付宝支付
             elif operation == 'aliPayCreateOrder':
             elif operation == 'aliPayCreateOrder':
                 return self.do_pay_by_ali(request_dict, userID, response)
                 return self.do_pay_by_ali(request_dict, userID, response)
+            elif operation == 'orderStatus':
+                return self.do_pay_status(request_dict,userID)
             else:
             else:
                 return response.json(414)
                 return response.json(414)
 
 
@@ -833,3 +835,171 @@ class CloudVodView(View):
             vod_play_list.append(
             vod_play_list.append(
                 {'name': vod['time'], 'sign_url': vod_play_url, 'thumb': thumb, 'sec': vod['sec'], 'id': vod['id']})
                 {'name': vod['time'], 'sign_url': vod_play_url, 'thumb': thumb, 'sec': vod['sec'], 'id': vod['id']})
         return response.json(0, vod_play_list)
         return response.json(0, vod_play_list)
+
+    def do_pay_status(self,request_dict,userID):
+        orderID = request_dict.get('orderID', None)
+        om_qs = Order_Model.objects.filter(userID_id=userID, orderID=orderID).values('status')
+        response = HttpResponse()
+        success_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 : green
+                    	}
+                    	.content_img{
+                    		width: 60px; 
+                    		height: 60px;
+                    	}
+                    	.bottom{
+                    		 margin-bottom: 10px; 
+                    		 margin-top: 250px; 
+                    		 color : green
+                    	}
+                    	.bottom_div{
+                    		border: 1px solid green; 
+                    		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/timg.jpg" class="content_img">
+                    		<br />
+                    		Successful payment
+                    	</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": 1});
+                    }
+                	</script>
+                </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});
+            }
+        	</script>
+        </body> 
+        </html>
+                        '''
+        if om_qs.exists():
+            if om_qs[0]['status'] == 1:
+                response.content = success_pay_content
+                return response
+            else:
+                response = HttpResponse()
+                response.content = falil_pay_content
+                return response
+        else:
+            response = HttpResponse()
+            response.content = falil_pay_content
+            return response