Ver código fonte

Merge branch 'master' of http://47.100.37.243:10080/wutt/game

sunyadv 5 anos atrás
pai
commit
f733c480dd

+ 5 - 1
minigame/WebContent/static/css/lottery.css

@@ -17,7 +17,6 @@
     width: 84%;
     height: auto;
     left: 7%;
-    top: 250px;
 }
 .container {
     display: flex;
@@ -109,6 +108,11 @@ input{
     width: 52%;
     z-index: 12;
 }
+.advertisement li{
+	font-size: 10px !important;
+	line-height: 20px !important;
+	height: 20px !important;
+}
 
 /*滚动*/
 .case {

BIN
minigame/WebContent/static/images/lottery_background.png


BIN
minigame/WebContent/static/images/lottery_background2.png


BIN
minigame/WebContent/static/images/reward_book.png


BIN
minigame/WebContent/static/images/reward_book2.png


BIN
minigame/WebContent/static/images/reward_oil10.png


BIN
minigame/WebContent/static/images/reward_oil10_2.png


BIN
minigame/WebContent/static/images/reward_oil5.png


BIN
minigame/WebContent/static/images/reward_oil5_2.png


BIN
minigame/WebContent/static/images/reward_oil60.png


BIN
minigame/WebContent/static/images/reward_oil60_2.png


BIN
minigame/WebContent/static/images/reward_soap.png


BIN
minigame/WebContent/static/images/reward_soap2.png


BIN
minigame/WebContent/static/img/poster/hsr1.jpg


BIN
minigame/WebContent/static/img/share_btn.png


+ 27 - 22
minigame/WebContent/static/lottery.html

@@ -22,7 +22,8 @@
             $(window).resize(function () {
                 setPosition();
             });
-            
+            //id设置进入localstorage
+            localStorage.setItem("userId", id);
             //在这里查看是否有id
             if(id == null){
             	alert("请先登录");
@@ -41,7 +42,7 @@
 				}
 			});
             
-            //点击
+            //点击查看结果
             $(".check_result").click(function(){
             	window.location.href = "result.html";
             })
@@ -58,26 +59,31 @@
                             enable = false;
                             //设置初始速度
                             speed = 60;
-                            //设置要中奖的位置 0手账 2 1升 4谢谢惠顾 5肥皂 6 12瓶 7 500毫升
+                            //设置要中奖的位置 1.5没有 0十二瓶 4一升 2.6五百毫升 3书 7肥皂
                             if(resp.data.prizeLevel == -1){
-                                threshold = 4;
+                            	var rand = Math.round(Math.random()*2);
+                            	if(rand <= 1){
+                            		threshold = 1;
+                            	}else{
+                            		threshold = 5; 
+                            	}
                             }else if(resp.data.prizeLevel == 0){
-                            	threshold = 6;
+                            	threshold = 0;
                             	src = "images/reward_oil60_2.png";
                             }else if(resp.data.prizeLevel == 1){
-                            	threshold = 7;   
+                            	threshold = 2;   
                             	src = "images/reward_oil5_2.png";           	
                             }else if(resp.data.prizeLevel == 2){
-                            	threshold = 2;
+                            	threshold = 4;
                             	src = "images/reward_oil10_2.png";                          	
                             }else if(resp.data.prizeLevel == 3){
-                            	threshold = 5;
+                            	threshold = 7;
                             	src = "images/reward_soap2.png";                          	
                             }else if(resp.data.prizeLevel == 4){
-                            	threshold = 0;
+                            	threshold = 3;
                             	src = "images/reward_book2.png";        	
                             }else{
-                            	threshold = 4;
+                            	threshold = 1;
                             }
                             //配置移动次数
                             last = 56 + threshold - current;
@@ -111,7 +117,6 @@
         			});
                 }
             });
-            
         });
 
         //重新设置内容位置
@@ -124,7 +129,7 @@
             $(".tips").css("top", $(".container").width() * 2.45);
             $(".mask").css("height", $(document).height());
             $(".result_failed_button").css("top", $(".container").width() * 1.6);
-            $(".result_success_title").css("top", $(".container").width() * 0.66);
+            $(".result_success_title").css("top", $(".container").width() * 0.69);
             $(".result_success_logo").css("top", $(".container").width() * 0.9);
             $(".result_success_name").css("top", $(".container").width() * 1.35);
             $(".result_success_phone").css("top", $(".container").width() * 1.59);
@@ -146,7 +151,7 @@
                 setTimeout(function(){next()}, speed);
             }else{
                 setTimeout(function(){
-                    if(threshold == 4){
+                    if(threshold == 1 || threshold == 3 || threshold == 5){
                     	failed();
                     }else{
                     	success();
@@ -205,15 +210,15 @@
     <img class="background" src="images/lottery_background.png">
     <img class="pool" src="images/lottery_pool.png">
     <div class="container">
-        <img class="item item0" src="images/reward_book.png">
-        <img class="item item1" src="images/reward_soap.png">
-        <img class="item item2" src="images/reward_oil10.png">
-        <img class="item item7" src="images/reward_oil5.png">
+        <img class="item item0" src="images/reward_oil60.png">
+        <img class="item item1" src="images/reward_null.png">
+        <img class="item item2" src="images/reward_oil5.png">
+        <img class="item item7" src="images/reward_soap.png">
         <img class="item button" src="images/lottery_button.png">
-        <img class="item item3" src="images/reward_oil5.png">
-        <img class="item item6" src="images/reward_oil60.png">
-        <img class="item item5" src="images/reward_soap.png">
-        <img class="item item4" src="images/reward_null.png">
+        <img class="item item3" src="images/reward_book.png">
+        <img class="item item6" src="images/reward_oil5.png">
+        <img class="item item5" src="images/reward_null.png">
+        <img class="item item4" src="images/reward_oil10.png">
     </div>
     <span class="title"><span style="color: #FF356B">活动</span>说明</span>
     <span class="tips">1.中奖者留下姓名和电话,在活动结束后会联系邮寄奖品;<br>
@@ -266,6 +271,6 @@
 
     <img class="result failed" src="images/result_failed.png" style="display: none;">
     <img class="result_failed_button" src="images/result_failed_button.png" style="display: none;">
-    <span class="check_result">查看中奖结果</span>
+    <span class="check_result">查看我的中奖结果</span>
 </body>
 </html>

+ 21 - 9
minigame/WebContent/static/result.html

@@ -5,7 +5,7 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <title>抽奖结果</title>
+    <title>我的抽奖结果</title>
     <style type="text/css">
     	*{
     		margin: 0;
@@ -16,15 +16,27 @@
     <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
     <script type="text/javascript">
 	    $(function(){
-	    	$.post("../prize/luckDrawListBack", {}, function(resp) {
-				if (resp.code == 'error') {
-					console.log(resp.code);
-				}else{
-					for(let index in resp.data){
-						$("table").append("<tr><td>" + resp.data[index].nickName + "</td><td>" + resp.data[index].prize + "</td></tr>")
+	    	var id = localStorage.getItem("userId");
+			if(id != null){
+				$.post("../prize/getluckDrawByUserId", {
+					UserId: id
+				}, function(resp) {
+					if (resp.code == 'error') {
+						console.log(resp.code);
+					}else{
+						if(resp.data.length != 0){
+							for(let index in resp.data){
+								$("table").append("<tr><td>" + resp.data[index].nickName + "</td><td>" + resp.data[index].prize + "</td></tr>");
+							}
+						}else{
+							$("body").append("<p style='text-align: center'>没有中奖信息</p>");
+						}
+						
 					}
-				}
-			});
+				});
+			}else{
+				$("body").append("<p style='text-align: center'>没有中奖信息!</p>");
+			}
 		})
 	</script>
 </head>

+ 79 - 0
minigame/WebContent/static/result_all.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en" style="width: 100%">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>抽奖结果</title>
+    <style type="text/css">
+    	*{
+    		margin: 0;
+    		padding: 0;
+    	}
+    </style>
+    <script src="js/jquery.min.js"></script>
+    <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
+    <script type="text/javascript">
+	    $(function(){
+			$.post("../prize/luckDrawListBack", {}, function(resp) {
+				if (resp.code == 'error') {
+					console.log(resp.code);
+				}else{
+					for(let index in resp.data){
+						$("table").append(
+								"<tr><td>" + 
+								index +
+								"</td><td>" +
+								resp.data[index].nickName + 
+								"</td><td>" +
+								resp.data[index].prize +
+								"</td><td>" +
+								resp.data[index].userName +
+								"</td><td>" +
+								resp.data[index].phone +
+								"</td><td>" +
+								formatTime(resp.data[index].indate, 'Y-M-D h:m:s') + 
+								"</td></tr>"
+							);
+					}
+				}
+			});
+		})
+		function formatNumber (n) {
+		    n = n.toString()
+		    return n[1] ? n : '0' + n;
+		}
+		function formatTime (number, format) {
+		    let time = new Date(number)
+		    let newArr = []
+		    let formatArr = ['Y', 'M', 'D', 'h', 'm', 's']
+		    newArr.push(time.getFullYear())
+		    newArr.push(formatNumber(time.getMonth() + 1))
+		    newArr.push(formatNumber(time.getDate()))
+		
+		    newArr.push(formatNumber(time.getHours()))
+		    newArr.push(formatNumber(time.getMinutes()))
+		    newArr.push(formatNumber(time.getSeconds()))
+		
+		    for (let i in newArr) {
+		        format = format.replace(formatArr[i], newArr[i])
+		    }
+		    return format;
+		}
+	</script>
+</head>
+
+<body style="width: 100%">
+    <table class="table table-condensed">
+		<tr>
+			<th>#</th>
+			<th>昵称</th>
+			<th>奖品</th>
+			<th>姓名</th>
+			<th>电话</th>
+			<th>时间</th>
+		</tr>
+	</table>
+</body>
+</html>

+ 3 - 3
minigame/src/com/hssx/controller/PrizeController.java

@@ -84,8 +84,8 @@ public class PrizeController {
 			response.getWriter().println(msg.toJSONStr());
 			return;
 		}
-		// if (luckDrawCount == 0) {
-		// 直接抽奖
+		// if (luckDrawCount <= 1) {
+		// 直接抽奖(每日默认2次抽奖机会)
 		count = getLuckDraw(prizeRecord, count);
 		// 添加抽奖记录
 		UserPrizeCount userPrizeCount = new UserPrizeCount();
@@ -94,7 +94,7 @@ public class PrizeController {
 		map.put("prizeLevel", count);
 		map.put("prizeRecord", prizeRecord);
 		msg.data = map;
-		// } else if (luckDrawCount == 1) {
+		// } else if (luckDrawCount == 2) {
 		// int opportunityCount =
 		// prizeOpportunityMapper.selectCountByToday(userId);
 		// if (opportunityCount > 0) {