Explorar o código

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

Conflicts:
	minigame/src/com/hssx/controller/UserController.java
%!s(int64=5) %!d(string=hai) anos
pai
achega
f727354226
Modificáronse 32 ficheiros con 1396 adicións e 130 borrados
  1. 32 1
      minigame/WebContent/css/main.css
  2. BIN=BIN
      minigame/WebContent/images/assets_atlas_P_.png
  3. BIN=BIN
      minigame/WebContent/images/assets_atlas_P_2.png
  4. BIN=BIN
      minigame/WebContent/images/assets_atlas_P_3.png
  5. BIN=BIN
      minigame/WebContent/images/assets_atlas_P_4.png
  6. BIN=BIN
      minigame/WebContent/images/assets_atlas_P_5.png
  7. BIN=BIN
      minigame/WebContent/images/game_bg.jpg
  8. BIN=BIN
      minigame/WebContent/images/lottery_background.png
  9. BIN=BIN
      minigame/WebContent/images/lottery_background_red.png
  10. BIN=BIN
      minigame/WebContent/images/lottery_button.png
  11. BIN=BIN
      minigame/WebContent/images/lottery_pool.png
  12. BIN=BIN
      minigame/WebContent/images/result_failed.png
  13. BIN=BIN
      minigame/WebContent/images/result_failed_button.png
  14. BIN=BIN
      minigame/WebContent/images/result_success.png
  15. BIN=BIN
      minigame/WebContent/images/result_success_button.png
  16. BIN=BIN
      minigame/WebContent/img/cover.png
  17. BIN=BIN
      minigame/WebContent/img/loading/bg21.png
  18. BIN=BIN
      minigame/WebContent/img/loading/loading_icon.png
  19. BIN=BIN
      minigame/WebContent/img/replay_btn.png
  20. BIN=BIN
      minigame/WebContent/img/share_btn.png
  21. BIN=BIN
      minigame/WebContent/img/wait_cut.png
  22. BIN=BIN
      minigame/WebContent/img/wait_move.png
  23. 190 56
      minigame/WebContent/index.html
  24. 20 4
      minigame/WebContent/js/main.js
  25. 100 62
      minigame/WebContent/lottery.html
  26. 4 2
      minigame/src/com/hssx/constant/Constant.java
  27. 67 1
      minigame/src/com/hssx/controller/UserController.java
  28. 75 0
      minigame/src/com/hssx/mapper/WeiboParamMapper.java
  29. 271 0
      minigame/src/com/hssx/mapper/WeiboParamMapper.xml
  30. 99 0
      minigame/src/com/hssx/model/WeiboParam.java
  31. 512 0
      minigame/src/com/hssx/model/WeiboParamExample.java
  32. 26 4
      minigame/src/com/hssx/utils/WechatAndMicroblogUtil.java

+ 32 - 1
minigame/WebContent/css/main.css

@@ -495,6 +495,36 @@ img {
        -o-animation-delay: 3s;
           animation-delay: 3s; }
 
+.delay16 {
+  -webkit-animation-delay: 3.2s;
+     -moz-animation-delay: 3.2s;
+       -o-animation-delay: 3.2s;
+          animation-delay: 3.2s; }
+
+.delay17 {
+  -webkit-animation-delay: 3.4s;
+     -moz-animation-delay: 3.4s;
+       -o-animation-delay: 3.4s;
+          animation-delay: 3.4s; }
+
+.delay18 {
+  -webkit-animation-delay: 3.6s;
+     -moz-animation-delay: 3.6s;
+       -o-animation-delay: 3.6s;
+          animation-delay: 3.6s; }
+
+.delay19 {
+  -webkit-animation-delay: 3.8s;
+     -moz-animation-delay: 3.8s;
+       -o-animation-delay: 3.8s;
+          animation-delay: 3.8s; }
+
+.delay20 {
+  -webkit-animation-delay: 4s;
+     -moz-animation-delay: 4s;
+       -o-animation-delay: 4s;
+          animation-delay: 4s; }
+
 .time0 {
   -webkit-animation-duration: 0s;
      -moz-animation-duration: 0s;
@@ -656,7 +686,7 @@ img {
   height: 100vh;
   margin-left: -5rem;
   background: url(../img/loading/bg.jpg) no-repeat 0 0/cover;
-  z-index: 100;
+  z-index: 120;
   /*display: none;*/ }
   .loading .curtain-box {
     position: absolute;
@@ -821,6 +851,7 @@ img {
         font-size: 0.3125rem;
         width: 1.25rem;
         overflow: hidden;
+        -o-text-overflow: ellipsis;
         text-overflow: ellipsis;
         display: -webkit-box;
         -webkit-line-clamp: 2;

BIN=BIN
minigame/WebContent/images/assets_atlas_P_.png


BIN=BIN
minigame/WebContent/images/assets_atlas_P_2.png


BIN=BIN
minigame/WebContent/images/assets_atlas_P_3.png


BIN=BIN
minigame/WebContent/images/assets_atlas_P_4.png


BIN=BIN
minigame/WebContent/images/assets_atlas_P_5.png


BIN=BIN
minigame/WebContent/images/game_bg.jpg


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


BIN=BIN
minigame/WebContent/images/lottery_background_red.png


BIN=BIN
minigame/WebContent/images/lottery_button.png


BIN=BIN
minigame/WebContent/images/lottery_pool.png


BIN=BIN
minigame/WebContent/images/result_failed.png


BIN=BIN
minigame/WebContent/images/result_failed_button.png


BIN=BIN
minigame/WebContent/images/result_success.png


BIN=BIN
minigame/WebContent/images/result_success_button.png


BIN=BIN
minigame/WebContent/img/cover.png


BIN=BIN
minigame/WebContent/img/loading/bg21.png


BIN=BIN
minigame/WebContent/img/loading/loading_icon.png


BIN=BIN
minigame/WebContent/img/replay_btn.png


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


BIN=BIN
minigame/WebContent/img/wait_cut.png


BIN=BIN
minigame/WebContent/img/wait_move.png


+ 190 - 56
minigame/WebContent/index.html

@@ -15,10 +15,12 @@
     <title>贝蒂斯厨房</title>
     <script src="./js/flexiable.js"></script>
     <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
+	<script src="https://tjs.sjs.sinajs.cn/open/thirdpart/js/jsapi/mobile.js" charset="utf-8"></script>
     <link rel="stylesheet" type="text/css" href="./css/animate.min.css?v=1">
     <link rel="stylesheet" type="text/css" href="./css/music.css?v=2">
     <link rel="stylesheet" type="text/css" href="./css/main.css?v=2">
     <script src="https://cdn.bootcss.com/SoundJS/1.0.2/soundjs.min.js"></script>
+    <script src="https://tjs.sjs.sinajs.cn/open/thirdpart/js/jsapi/mobile.js" charset="utf-8"></script>
     <!--<script src="https://www.w3cways.com/demo/vconsole/vconsole.min.js?v=2.2.0"></script>-->
     <script>
         window.ifDebug = false;
@@ -44,12 +46,12 @@
         </div>
     </div>
 </div>
-    <div class="loading2">
-        <div class="curtain-box2">
-            <div class="txt rubberBand time6">
-            </div>
+<div class="loading2">
+    <div class="curtain-box2">
+        <div class="txt rubberBand time6">
         </div>
     </div>
+</div>
 <!-- 主内容 -->
 <div class="warp">
     <!-- 选择菜 -->
@@ -57,16 +59,16 @@
         <img src="./img/menu_tt.png" class="tt fadeIn time4 animated js-an">
         <div class="list">
             <div class="item bounceIn time3 animated js-an delay3">
-                <img src="./img/menu1.png">
+                <img src="./img/menu1.png" class="animated js-an pulse time4 delay11">
             </div>
             <div class="item bounceIn time3 animated js-an delay4">
-                <img src="./img/menu2.png">
+                <img src="./img/menu2.png" class="animated js-an pulse time4 delay12">
             </div>
             <div class="item bounceIn time3 animated js-an delay5">
-                <img src="./img/menu3.png">
+                <img src="./img/menu3.png" class="animated js-an pulse time4 delay13">
             </div>
             <div class="item bounceIn time3 animated js-an delay6">
-                <img src="./img/menu4.png">
+                <img src="./img/menu4.png" class="animated js-an pulse time4 delay14">
             </div>
         </div>
         <div class="confirm anim-btn"></div>
@@ -157,15 +159,15 @@
 <script src="./js/wechat.js"></script>
 <script src="./assets.js?v=2"></script>
 <script src="./js/music.js?v=1"></script>
-<script src="./js/main.js?v=8"></script>
+<script src="./js/main.js?v=12"></script>
 <script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
 <!-- 必须加在微信api资源 -->
 <script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
 <script>
-	//解决IOS下分享签名失败问题
-	if (navigator.userAgent.indexOf('iPhone') !== -1) {
-	  window.wechaturl = window.location + '';
-	}
+    //解决IOS下分享签名失败问题
+    if (navigator.userAgent.indexOf('iPhone') !== -1) {
+        window.wechaturl = window.location + '';
+    }
     //一般情况下,这样就可以自动播放了,但是一些奇葩iPhone机不可以
     var music = document.getElementById('music').play();
     music.volume = 0.1;
@@ -175,53 +177,185 @@
         music.volume = 0.1;
     }, false);
 
-        function shareWeixin(msg) {
-        	let wechaturl = window.location.href.split('#')[0];
-        	var shareUrl = wechaturl;
-        	if (window.wechaturl !== undefined) {
-        	 	wechaturl = window.wechaturl;
-        	}
-        	var url = escape(wechaturl);
-        	$.post("./user/getWxConfigParam?url="+url, {}, function(resp) {
+    function shareWeixin(msg) {
+        let wechaturl = window.location.href.split('#')[0];
+        var shareUrl = wechaturl;
+        if (window.wechaturl !== undefined) {
+            wechaturl = window.wechaturl;
+        }
+        var url = escape(wechaturl);
+        $.post("./user/getWxConfigParam?url="+url, {}, function(resp) {
+            if (resp.code == 'error') {
+                console.log(resp.code);
+            }else{
+                wx.config({
+                    debug: false,
+                    appId: 'wx749c84daac654e1e',
+                    timestamp: resp.data.timestamp,
+                    nonceStr: resp.data.noncestr,
+                    signature: resp.data.sign,
+                    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'showOptionMenu', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem']
+                });
+                wx.ready(function(){
+                    $("#cover").show();
+                    const share = {
+                        title: "我为你精心准备的美味,快享用吧!",
+                        desc: msg,
+                        imgUrl: "https://wx.ttkuaiban.com/minigame/images/share_picture.png",
+                        link: shareUrl,
+                        success: function() {
+//            			            alert("分享成功")
+                            window.location.href = "https://wx.ttkuaiban.com/minigame/lottery.html";
+                        },
+                        cancel: function() {
+//                                 alert("分享失败")
+                        }
+                    };
+                    wx.onMenuShareAppMessage(share);
+                    wx.onMenuShareTimeline(share);
+                    wx.onMenuShareQQ(share);
+                    wx.onMenuShareQZone(share);
+                    wx.onMenuShareWeibo(share);
+                });
+                wx.error(function(res){
+                    alert("分享失败")
+                    console.log(res);
+                });
+            };
+        });
+    }
+    
+    //通过微博进行分享的回调时事件
+    function shareWeibo(msg) {
+    	var url = escape(window.location.href.split('#')[0]);
+        $.post("./user/getWeiboConfigParam?url=" + url, {}, function(resp) {
+    		if (resp.code == 'error') {
+    			console.log(resp.code);
+    		}else{
+    			window.WeiboJS.init({
+    			    'appkey' : resp.data.appkey,
+    			    'debug': false,
+    			    'timestamp': parseInt(resp.data.timestamp),
+    			    'noncestr': resp.data.noncestr,
+    			    'signature': resp.data.sign,
+    			    'scope': [
+    			    	"getNetworkType", "networkTypeChanged", "getBrowserInfo", "checkAvailability", "setBrowserTitle", "openMenu", "setMenuItems", "menuItemSelected", "setSharingContent", "openImage", "scanQRCode", "pickImage", "openVideoCamera", "uploadVideo", "getWM", "getLocation", "pickContact", "apiFromTheFuture", "menuItemAvailable", "invokeMenuItem", "audioMetersChange"
+    			    ]
+    			}, function(ret){
+    				$("#cover").show();
+    				var shareTitle = "一秒变大厨,为远方的朋友做道菜吧!";
+    				var shareImg = "https://wx.ttkuaiban.com/minigame/images/share_picture.png";
+					WeiboJS.invoke("setSharingContent", {
+						title: shareTitle,
+						desc: msg,
+						icon: shareImg
+					}, function(e) {
+// 						alert("设置分享内容成功:" + JSON.stringify(e));
+					});
+					WeiboJS.invoke("setMenuItems", {
+			            menus: ["shareToWeibo", "shareToMessage", "shareToWeixin", "shareToPYQ", "shareToQQ", "shareToQzone"],
+			            content: shareTitle,
+			            title: msg,
+			            icon: shareImg
+			        }, function(e) {
+// 			            alert("setMenuItems 返回数据:" + JSON.stringify(e))
+			        });
+					WeiboJS.on("menuItemSelected", function(params){
+						if (!params.hasOwnProperty("error")) {
+							if (params.selected_code == 1001) {
+								WeiboJS.invoke("invokeMenuItem", {code:1001}, function(params){});
+							}
+							window.location.href = "https://wx.ttkuaiban.com/minigame/lottery.html";
+						}
+					});
+// 			     	WeiboJS.invoke("openMenu", {}, function(params){
+// 			     		alert("openMenu 返回数据:" + JSON.stringify(params));
+// 			         });
+    			});
+    		}
+        });
+    }
+
+    $(function () {
+    	var shareTitle = "一秒变大厨,为远方的朋友做道菜吧!";
+    	var shareImg = "https://wx.ttkuaiban.com/minigame/images/share_picture.png";
+    	var shareLink = "https://wx.ttkuaiban.com/minigame/index.html";
+    	var ua = navigator.userAgent.toLowerCase();
+    	if (ua.match(/microMessenger/i) == 'micromessenger') {
+    		$.post("./user/getWxConfigParam?url=https://wx.ttkuaiban.com/minigame/index.html", {}, function(resp) {
+                if (resp.code == 'error') {
+                    console.log(resp.code);
+                }else{
+                    wx.config({
+                        debug: false,
+                        appId: 'wx749c84daac654e1e',
+                        timestamp: resp.data.timestamp,
+                        nonceStr: resp.data.noncestr,
+                        signature: resp.data.sign,
+                        jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'showOptionMenu', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem']
+                    });
+                    wx.ready(function(){
+                        const share = {
+                            title: shareTitle,
+                            desc: "",
+                            imgUrl: shareImg,
+                            link: shareLink,
+                            success: function(res) {
+                                console.log(res)
+                            },
+                            cancel: function() {}
+                        };
+                        wx.onMenuShareAppMessage(share);
+                        wx.onMenuShareTimeline(share);
+                        wx.onMenuShareQQ(share);
+                        wx.onMenuShareQZone(share);
+                        wx.onMenuShareWeibo(share);
+                    });
+
+                    wx.error(function(res){
+                        console.log(res);
+                    });
+                };
+            });
+        } else if (ua.match(/weibo/i) == 'weibo') {
+        	//weibo
+    		var url = escape(location.href);
+            $.post("./user/getWeiboConfigParam?url=" + url, {}, function(resp) {
         		if (resp.code == 'error') {
         			console.log(resp.code);
         		}else{
-        			wx.config({
-        			    debug: false,
-        			    appId: 'wx749c84daac654e1e',
-        			    timestamp: resp.data.timestamp,
-        			    nonceStr: resp.data.noncestr,
-        			    signature: resp.data.sign,
-        			    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'showOptionMenu', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem']
+        			window.WeiboJS.init({
+        			    'appkey' : resp.data.appkey,
+        			    'debug': false,
+        			    'timestamp': parseInt(resp.data.timestamp),
+        			    'noncestr': resp.data.noncestr,
+        			    'signature': resp.data.sign,
+        			    'scope': [
+        			    	"getNetworkType", "networkTypeChanged", "getBrowserInfo", "checkAvailability", "setBrowserTitle", "openMenu", "setMenuItems", "menuItemSelected", "setSharingContent", "openImage", "scanQRCode", "pickImage", "openVideoCamera", "uploadVideo", "getWM", "getLocation", "pickContact", "apiFromTheFuture", "menuItemAvailable", "invokeMenuItem", "audioMetersChange"
+        			    ]
+        			}, function(ret){
+    					WeiboJS.invoke("setSharingContent", {
+    						title: "",
+    						desc: shareTitle,
+    						icon: shareImg
+    					}, function(e) {
+//     						alert("1-设置分享内容成功:" + JSON.stringify(e));
+    					});
+    					WeiboJS.invoke("setMenuItems", {
+    			            menus: ["shareToWeibo", "shareToMessage", "shareToWeixin", "shareToPYQ", "shareToQQ", "shareToQzone"],
+    			            content: shareTitle,
+    			            title: "",
+    			            icon: shareImg
+    			        }, function(e) {
+//     			            alert("setMenuItems 返回数据:" + JSON.stringify(e))
+    			        });
         			});
-        			wx.ready(function(){
-                        $("#cover").show();
-                        const share = {
-           			        title: "我为你精心准备的美味,快享用吧!",
-           			        desc: msg,
-           			        imgUrl: "https://wx.ttkuaiban.com/minigame/images/share_picture.png",
-           			        link: shareUrl,
-           			        success: function() {
-//            			            alert("分享成功")
-           			        	window.location.href = "https://wx.ttkuaiban.com/minigame/lottery.html";
-           			        },
-           			        cancel: function() {
-//                                 alert("分享失败")
-           			        }
-           			    };
-        			    wx.onMenuShareAppMessage(share);
-        			    wx.onMenuShareTimeline(share);
-        			    wx.onMenuShareQQ(share);
-        			    wx.onMenuShareQZone(share);
-        			    wx.onMenuShareWeibo(share);
-        			});
-        			wx.error(function(res){
-                        alert("分享失败")
-        				console.log(res);
-        			});
-        		};
-        	});
+        		}
+            });
+        } else {
+//         	alert('noooooo');
         }
-    </script>
+    })
+</script>
 </body>
 </html>

+ 20 - 4
minigame/WebContent/js/main.js

@@ -96,6 +96,12 @@ function handleComplete(evt, comp) {
                 $(".warp").show();
                 $(".select-dish-box").find(".animated").removeClass("js-an");
             });
+        });
+		$(".loading2").on("click",function(){
+            $(".loading2").fadeOut(function(){
+                $(".warp").show();
+                $(".select-dish-box").find(".animated").removeClass("js-an");
+            });
         });
     });
 
@@ -841,11 +847,12 @@ function handleComplete(evt, comp) {
 
 function getInfo() {
     var ua = navigator.userAgent.toLowerCase();
-    var isMobile = false;
+    var isAvatorSupport = false;
     if (!!navigator.userAgent.match(/AppleWebKit.*Mobile.*/)) {
-        isMobile = true;
+        
         if (ua.match(/MicroMessenger/i) == "micromessenger") {
             type = 0;
+            isAvatorSupport = true;
             url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
                 +"appid=wx749c84daac654e1e&"
                 +"redirect_uri=https://wx.ttkuaiban.com/minigame&"
@@ -856,6 +863,7 @@ function getInfo() {
 
         if (ua.match(/WeiBo/i) == "weibo") {
             type = 1;
+            isAvatorSupport = true;
             url = "https://api.weibo.com/oauth2/authorize?"
                 +"client_id=2141531565&"
                 +"response_type=code&"
@@ -865,6 +873,7 @@ function getInfo() {
         var ua = navigator.userAgent.toLowerCase();
         if (ua.match(/MicroMessenger/i) == "micromessenger") {
             type = 0;
+            isAvatorSupport = true;
             url = "https://open.weixin.qq.com/connect/oauth2/authorize?"
                 +"appid=wx749c84daac654e1e&"
                 +"redirect_uri=https://wx.ttkuaiban.com/minigame&"
@@ -920,6 +929,7 @@ function getInfo() {
             }
         }
         getMsg();
+        init();
         $(".poster-mode").fadeIn();
     } else {
         $('#edit').show();
@@ -932,7 +942,7 @@ function getInfo() {
         $('.secret-btn').show();
 
         init();
-        if (isMobile && !window.ifDebug) {
+        if (isAvatorSupport && !window.ifDebug) {
             getMsg();
         }
 
@@ -1063,8 +1073,14 @@ function saveText() {
                     history.pushState("", "Title", href);
                 }
 
+                var share = msg.data.receiver + "," + msg.data.message;
+
                 //海报页面的微信分享
-                shareWeixin(msg.data.message);
+                if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+                    shareWeixin(share);
+                } else if (ua.match(/WeiBo/i) == 'weibo') {
+                    shareWeibo(share);
+                }
             }else{
                 console.log("错误"+xhr.status)
             }

+ 100 - 62
minigame/WebContent/lottery.html

@@ -8,6 +8,7 @@
     <title>抽奖</title>
     <script src="js/jquery.min.js"></script>
     <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
+    <script src="https://tjs.sjs.sinajs.cn/open/thirdpart/js/jsapi/mobile.js" charset="utf-8"></script>
     <script src="js/wechat.js"></script>
     <link rel="stylesheet" href="css/lottery2.css?v=2" type="text/css" />
     <script type="text/javascript">
@@ -23,51 +24,112 @@
         var recordId = null;
         $(function () {
         	//先在这里查看是否有id
-            if(id == null || id == undefined || id == ""){
-            	window.location.href = "https://wx.ttkuaiban.com/minigame";
-            }
-        	
-            $.post("./user/getWxConfigParam?url=https://wx.ttkuaiban.com/minigame/lottery.html", {}, function(resp) {
-        		if (resp.code == 'error') {
-        			console.log(resp.code);
-        		}else{
-        			wx.config({
-        			    debug: false,
-        			    appId: 'wx749c84daac654e1e',
-        			    timestamp: resp.data.timestamp,
-        			    nonceStr: resp.data.noncestr,
-        			    signature: resp.data.sign,
-        			    jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'showOptionMenu', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem']
-        			});
-        			wx.ready(function(){
-        				const share = {
-        			        title: "一秒变大厨,为远方的朋友做道菜吧!",
-        			        desc: "",
-        			        imgUrl: "https://wx.ttkuaiban.com/minigame/images/share_picture.png",
-        			        link: "https://wx.ttkuaiban.com/minigame/lottery.html",
-        			        success: function() {
-        			        	$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
+            var shareTitle = "一秒变大厨,为远方的朋友做道菜吧!";
+            var shareImg = "https://wx.ttkuaiban.com/minigame/images/share_picture.png";
+            var shareLink = "https://wx.ttkuaiban.com/minigame/lottery.html";
+            var ua = navigator.userAgent.toLowerCase();
+			var currentUrl = window.location.href;
+            if (ua.match(/microMessenger/i) == 'micromessenger') {
+                $.post("./user/getWxConfigParam?url=" + currentUrl, {}, function(resp) {
+                	if (resp.code == 'error') {
+                        console.log(resp.code);
+                    }else{
+                        wx.config({
+                            debug: false,
+                            appId: 'wx749c84daac654e1e',
+                            timestamp: resp.data.timestamp,
+                            nonceStr: resp.data.noncestr,
+                            signature: resp.data.sign,
+                            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'showOptionMenu', 'hideAllNonBaseMenuItem', 'showAllNonBaseMenuItem']
+                        });
+                        wx.ready(function(){
+                            const share = {
+                                title: shareTitle,
+                                desc: "",
+                                imgUrl: shareImg,
+                                link: shareLink,
+                                success: function(res) {
+                                	$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
+            		    				if (resp.code == 'error') {
+            		    					console.log(resp.code);
+            		    				}else{
+            		    					//分享之后前端限制可抽奖次数+1
+        		    						alert("分享成功,每日第一次分享成功可额外获得一次抽奖机会");
+            		    					limit--;
+            		    				}
+            		    			});
+                                },
+                                cancel: function() {}
+                            };
+                            wx.onMenuShareAppMessage(share);
+                            wx.onMenuShareTimeline(share);
+                            wx.onMenuShareQQ(share);
+                            wx.onMenuShareQZone(share);
+                            wx.onMenuShareWeibo(share);
+                        });
+                        wx.error(function(res){
+                            console.log(res);
+                        });
+                    };
+                });
+            } else if (ua.match(/weibo/i) == 'weibo') {
+                //weibo
+                var url = escape(location.href);
+                $.post("./user/getWeiboConfigParam?url=" + url, {}, function(resp) {
+                    if (resp.code == 'error') {
+                        console.log(resp.code);
+                    }else{
+                        window.WeiboJS.init({
+                            'appkey' : resp.data.appkey,
+                            'debug': false,
+                            'timestamp': parseInt(resp.data.timestamp),
+                            'noncestr': resp.data.noncestr,
+                            'signature': resp.data.sign,
+                            'scope': [
+                            	"getNetworkType", "networkTypeChanged", "getBrowserInfo", "checkAvailability", "setBrowserTitle", "openMenu", "setMenuItems", "menuItemSelected", "setSharingContent", "openImage", "scanQRCode", "pickImage", "openVideoCamera", "uploadVideo", "getWM", "getLocation", "pickContact", "apiFromTheFuture", "menuItemAvailable", "invokeMenuItem", "audioMetersChange"
+                            ]
+                        }, function(ret){
+                            WeiboJS.invoke("setSharingContent", {
+                                title: shareTitle,
+                                desc: "",
+                                icon: shareImg
+                            }, function(e) {
+    						    //alert("1-设置分享内容成功:" + JSON.stringify(e));
+                            });
+                            WeiboJS.invoke("setMenuItems", {
+        			            menus: ["shareToWeibo", "shareToMessage", "shareToWeixin", "shareToPYQ", "shareToQQ", "shareToQzone"],
+        			            content: shareTitle,
+        			            title: "",
+        			            icon: shareImg
+        			        }, function(e) {
+//         			            alert("setMenuItems 返回数据:" + JSON.stringify(e))
+        			        });
+    						
+    						WeiboJS.on("menuItemSelected", function(e) {
+    							$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
         		    				if (resp.code == 'error') {
         		    					console.log(resp.code);
         		    				}else{
         		    					//分享之后前端限制可抽奖次数+1
+        		    					alert("分享成功,每日第一次分享成功可额外获得一次抽奖机会");
         		    					limit--;
         		    				}
         		    			});
-        			        },
-        			        cancel: function() {}
-        			    };
-        			    wx.onMenuShareAppMessage(share);
-        			    wx.onMenuShareTimeline(share);
-        			    wx.onMenuShareQQ(share);
-        			    wx.onMenuShareQZone(share);
-        			    wx.onMenuShareWeibo(share);
-        			});
-        			wx.error(function(res){
-        				console.log(res);
-        			});
-        		};	
-        	});
+    							if (!e.hasOwnProperty("error")) {
+//     								if (e.selected_code == 1001) {
+//         								WeiboJS.invoke("invokeMenuItem", {code:1001}, function(params){});
+//         							}
+    							}
+// 				                alert("菜单选择结果:" + JSON.stringify(e))
+				            });
+    						
+//     						WeiboJS.invoke("menuItemAvailable", {}, function(params){
+// //     							alert("获取的菜单项:" + JSON.stringify(params));
+//     						});
+                        });
+                    }
+                });
+            } else {}
             
             //进入和窗口缩放时重新设置内容位置
             setPosition();
@@ -238,30 +300,6 @@
             $(".failed").show();
             $(".result_failed_button").show();
         }
-        
-     	//判断微信分享
-//         document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
-//     		//发送给好友
-//     		WeixinJSBridge.on('menu:share:appmessage', function(argv){
-//     			$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
-//     				if (resp.code == 'error') {
-//     					console.log(resp.code);
-//     				}else{
-//     					alert("分享成功");
-//     				}
-//     			});
-//     		});
-//     		//分享到朋友圈
-//     		WeixinJSBridge.on('menu:share:timeline', function(argv){
-//     			$.post("./prize/luckDrawAddShare", {uid: id}, function(resp) {
-//     				if (resp.code == 'error') {
-//     					console.log(resp.code);
-//     				}else{
-//     					alert("分享成功");
-//     				}
-//     			});
-//     		}); 
-//     	}, false);
     </script>
 </head>
 

+ 4 - 2
minigame/src/com/hssx/constant/Constant.java

@@ -7,8 +7,10 @@ package com.hssx.constant;
  * Version: 1.0
  */
 public class Constant {
-    public static final String MICROBLOG_APPKEY = "2141531565";//微博的appkey
-    public static final String MICROBLOG_APPSECRET = "f39462b939a56ce6d846bf83e04c20b5";//微博的accesstoken
+//    public static final String MICROBLOG_APPKEY = "2141531565";//微博的appkey
+//    public static final String MICROBLOG_APPSECRET = "f39462b939a56ce6d846bf83e04c20b5";//微博的accesstoken
+    public static final String MICROBLOG_APPKEY = "3741162137";//微博的appkey
+    public static final String MICROBLOG_APPSECRET = "a1b248c612b5f165b3402ee3861a5739";//微博的accesstoken
     public static final String WECHAT_APPID = "wx749c84daac654e1e";//微信的appid
     public static final String WECHAT_APPSECRET = "aacbd046ec1c790836f4f684c96fe585";//微信的appsecret
     public static final String CALLBACKURL = "https://wx.ttkuaiban.com/minigame/index.html";//微博返回code的回调地址

+ 67 - 1
minigame/src/com/hssx/controller/UserController.java

@@ -7,7 +7,9 @@ import java.security.NoSuchProviderException;
 import java.util.Date;
 import java.util.SortedMap;
 import java.util.TreeMap;
+
 import javax.servlet.http.HttpServletResponse;
+
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
@@ -16,16 +18,19 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.estates.filter.EmojiHttpServletRequestWraper;
 import com.hssx.constant.Constant;
-import com.hssx.entity.News;
 import com.hssx.entity.User;
 import com.hssx.entity.UserExample;
 import com.hssx.mapper.NewsMapper;
 import com.hssx.mapper.UserMapper;
+import com.hssx.mapper.WeiboParamMapper;
 import com.hssx.mapper.WxParamMapper;
+import com.hssx.model.WeiboParam;
+import com.hssx.model.WeiboParamExample;
 import com.hssx.model.WxParam;
 import com.hssx.model.WxParamExample;
 import com.hssx.utils.HttpKit;
@@ -33,6 +38,7 @@ import com.hssx.utils.HttpRespMsg;
 import com.hssx.utils.JsapiTicketUtil;
 import com.hssx.utils.Sha1Util;
 import com.hssx.utils.Snowflake;
+import com.hssx.utils.WechatAndMicroblogUtil;
 
 @Controller
 @RequestMapping("/user")
@@ -43,6 +49,8 @@ public class UserController {
 	WxParamMapper wxParamMapper;
 	@Autowired
 	NewsMapper newsMapper;
+	@Autowired
+	WeiboParamMapper weiboParamMapper;
 	
 
 	public static int WX_TOKEN_EXPIRE = 7200*1000;
@@ -230,4 +238,62 @@ public class UserController {
 		return null;
 	}
 	
+	
+	/**
+	 * 获取微博JS config参数
+	 * @param url 当前页面的完整 URL (不进行 url encode,不包含 # 及 fragment)
+	 * @param response
+	 * @return
+	 * @throws Exception
+	 */
+	@RequestMapping(value="getWeiboConfigParam")
+	public String getWeiboConfigParam(
+			@RequestParam String url,
+			HttpServletResponse response) throws Exception {
+		HttpRespMsg msg = new HttpRespMsg();
+		System.out.println("微博接收到url=="+url);
+		WeiboParamExample example = new WeiboParamExample();
+		Date d = new Date();
+		example.createCriteria().andExpireTimeGreaterThan(d);
+		example.setOrderByClause("id desc limit 1");
+		String jsapiTicket = "";
+		if (weiboParamMapper.countByExample(example) == 0) {
+			JSONObject json = WechatAndMicroblogUtil.getWeiboSign();
+			if (json != null) {
+				//{"result":true,"appkey":"2141531565","js_ticket":"f67b26833f","expire_time":7199}
+				WeiboParam param = new WeiboParam();
+				param.setIndate(d);
+				Date exp = new Date();
+				//设置过期时间
+				exp.setTime(d.getTime() + json.getIntValue("expire_time")*1000L);
+				param.setExpireTime(exp);
+				jsapiTicket = json.getString("js_ticket");
+				param.setJsapiTicket(jsapiTicket);
+				weiboParamMapper.insertSelective(param);
+			} else {
+				throw new Exception("get weibo sign ticket fail");
+			}
+		} else {
+			jsapiTicket = weiboParamMapper.selectByExample(example).get(0).getJsapiTicket();
+		}
+		// 随机数
+		String nonce_str = Sha1Util.getNonceStr();
+		String timestamp = Sha1Util.getTimeStamp();
+//		long timestamp = System.currentTimeMillis();
+		// 对以下字段进行签名
+		SortedMap<String, String> packageParams = new TreeMap<String, String>();
+		packageParams.put("jsapi_ticket", jsapiTicket);
+		packageParams.put("noncestr", nonce_str);
+		packageParams.put("timestamp", timestamp);
+		packageParams.put("url", url);
+		String sign = Sha1Util.createSHA1Sign(packageParams);
+		packageParams.put("sign", sign);
+		packageParams.put("appkey", Constant.MICROBLOG_APPKEY);
+		msg.data = packageParams;
+		
+		response.setContentType("application/json");
+		response.setCharacterEncoding("UTF-8");
+		response.getWriter().println(msg.toJSONStr());
+		return null;
+	}
 }

+ 75 - 0
minigame/src/com/hssx/mapper/WeiboParamMapper.java

@@ -0,0 +1,75 @@
+package com.hssx.mapper;
+
+import com.hssx.model.WeiboParam;
+import com.hssx.model.WeiboParamExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface WeiboParamMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	long countByExample(WeiboParamExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int deleteByExample(WeiboParamExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int deleteByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int insert(WeiboParam record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int insertSelective(WeiboParam record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	List<WeiboParam> selectByExample(WeiboParamExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	WeiboParam selectByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int updateByExampleSelective(@Param("record") WeiboParam record, @Param("example") WeiboParamExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int updateByExample(@Param("record") WeiboParam record, @Param("example") WeiboParamExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int updateByPrimaryKeySelective(WeiboParam record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	int updateByPrimaryKey(WeiboParam record);
+}

+ 271 - 0
minigame/src/com/hssx/mapper/WeiboParamMapper.xml

@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hssx.mapper.WeiboParamMapper">
+  <resultMap id="BaseResultMap" type="com.hssx.model.WeiboParam">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="jsapi_ticket" jdbcType="VARCHAR" property="jsapiTicket" />
+    <result column="indate" jdbcType="TIMESTAMP" property="indate" />
+    <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    id, jsapi_ticket, indate, expire_time
+  </sql>
+  <select id="selectByExample" parameterType="com.hssx.model.WeiboParamExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from weibo_param
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from weibo_param
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    delete from weibo_param
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.hssx.model.WeiboParamExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    delete from weibo_param
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.hssx.model.WeiboParam">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into weibo_param (jsapi_ticket, indate, expire_time
+      )
+    values (#{jsapiTicket,jdbcType=VARCHAR}, #{indate,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.hssx.model.WeiboParam">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into weibo_param
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="jsapiTicket != null">
+        jsapi_ticket,
+      </if>
+      <if test="indate != null">
+        indate,
+      </if>
+      <if test="expireTime != null">
+        expire_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="jsapiTicket != null">
+        #{jsapiTicket,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="expireTime != null">
+        #{expireTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.hssx.model.WeiboParamExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    select count(*) from weibo_param
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    update weibo_param
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.jsapiTicket != null">
+        jsapi_ticket = #{record.jsapiTicket,jdbcType=VARCHAR},
+      </if>
+      <if test="record.indate != null">
+        indate = #{record.indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.expireTime != null">
+        expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    update weibo_param
+    set id = #{record.id,jdbcType=INTEGER},
+      jsapi_ticket = #{record.jsapiTicket,jdbcType=VARCHAR},
+      indate = #{record.indate,jdbcType=TIMESTAMP},
+      expire_time = #{record.expireTime,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hssx.model.WeiboParam">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    update weibo_param
+    <set>
+      <if test="jsapiTicket != null">
+        jsapi_ticket = #{jsapiTicket,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        indate = #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="expireTime != null">
+        expire_time = #{expireTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hssx.model.WeiboParam">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Sep 24 11:05:35 CST 2019.
+    -->
+    update weibo_param
+    set jsapi_ticket = #{jsapiTicket,jdbcType=VARCHAR},
+      indate = #{indate,jdbcType=TIMESTAMP},
+      expire_time = #{expireTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 99 - 0
minigame/src/com/hssx/model/WeiboParam.java

@@ -0,0 +1,99 @@
+package com.hssx.model;
+
+import java.util.Date;
+
+public class WeiboParam {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column weibo_param.id
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	private Integer id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column weibo_param.jsapi_ticket
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	private String jsapiTicket;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column weibo_param.indate
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	private Date indate;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column weibo_param.expire_time
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	private Date expireTime;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column weibo_param.id
+	 * @return  the value of weibo_param.id
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public Integer getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column weibo_param.id
+	 * @param id  the value for weibo_param.id
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column weibo_param.jsapi_ticket
+	 * @return  the value of weibo_param.jsapi_ticket
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public String getJsapiTicket() {
+		return jsapiTicket;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column weibo_param.jsapi_ticket
+	 * @param jsapiTicket  the value for weibo_param.jsapi_ticket
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setJsapiTicket(String jsapiTicket) {
+		this.jsapiTicket = jsapiTicket;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column weibo_param.indate
+	 * @return  the value of weibo_param.indate
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public Date getIndate() {
+		return indate;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column weibo_param.indate
+	 * @param indate  the value for weibo_param.indate
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setIndate(Date indate) {
+		this.indate = indate;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column weibo_param.expire_time
+	 * @return  the value of weibo_param.expire_time
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public Date getExpireTime() {
+		return expireTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column weibo_param.expire_time
+	 * @param expireTime  the value for weibo_param.expire_time
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setExpireTime(Date expireTime) {
+		this.expireTime = expireTime;
+	}
+}

+ 512 - 0
minigame/src/com/hssx/model/WeiboParamExample.java

@@ -0,0 +1,512 @@
+package com.hssx.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class WeiboParamExample {
+    /**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	protected String orderByClause;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	protected boolean distinct;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	protected List<Criteria> oredCriteria;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public WeiboParamExample() {
+		oredCriteria = new ArrayList<Criteria>();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setOrderByClause(String orderByClause) {
+		this.orderByClause = orderByClause;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public String getOrderByClause() {
+		return orderByClause;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void setDistinct(boolean distinct) {
+		this.distinct = distinct;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public boolean isDistinct() {
+		return distinct;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public List<Criteria> getOredCriteria() {
+		return oredCriteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void or(Criteria criteria) {
+		oredCriteria.add(criteria);
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public Criteria or() {
+		Criteria criteria = createCriteriaInternal();
+		oredCriteria.add(criteria);
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public Criteria createCriteria() {
+		Criteria criteria = createCriteriaInternal();
+		if (oredCriteria.size() == 0) {
+			oredCriteria.add(criteria);
+		}
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	protected Criteria createCriteriaInternal() {
+		Criteria criteria = new Criteria();
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public void clear() {
+		oredCriteria.clear();
+		orderByClause = null;
+		distinct = false;
+	}
+
+	/**
+	 * This class was generated by MyBatis Generator. This class corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	protected abstract static class GeneratedCriteria {
+		protected List<Criterion> criteria;
+
+		protected GeneratedCriteria() {
+			super();
+			criteria = new ArrayList<Criterion>();
+		}
+
+		public boolean isValid() {
+			return criteria.size() > 0;
+		}
+
+		public List<Criterion> getAllCriteria() {
+			return criteria;
+		}
+
+		public List<Criterion> getCriteria() {
+			return criteria;
+		}
+
+		protected void addCriterion(String condition) {
+			if (condition == null) {
+				throw new RuntimeException("Value for condition cannot be null");
+			}
+			criteria.add(new Criterion(condition));
+		}
+
+		protected void addCriterion(String condition, Object value, String property) {
+			if (value == null) {
+				throw new RuntimeException("Value for " + property + " cannot be null");
+			}
+			criteria.add(new Criterion(condition, value));
+		}
+
+		protected void addCriterion(String condition, Object value1, Object value2, String property) {
+			if (value1 == null || value2 == null) {
+				throw new RuntimeException("Between values for " + property + " cannot be null");
+			}
+			criteria.add(new Criterion(condition, value1, value2));
+		}
+
+		public Criteria andIdIsNull() {
+			addCriterion("id is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdIsNotNull() {
+			addCriterion("id is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdEqualTo(Integer value) {
+			addCriterion("id =", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotEqualTo(Integer value) {
+			addCriterion("id <>", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdGreaterThan(Integer value) {
+			addCriterion("id >", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+			addCriterion("id >=", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdLessThan(Integer value) {
+			addCriterion("id <", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdLessThanOrEqualTo(Integer value) {
+			addCriterion("id <=", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdIn(List<Integer> values) {
+			addCriterion("id in", values, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotIn(List<Integer> values) {
+			addCriterion("id not in", values, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdBetween(Integer value1, Integer value2) {
+			addCriterion("id between", value1, value2, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotBetween(Integer value1, Integer value2) {
+			addCriterion("id not between", value1, value2, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketIsNull() {
+			addCriterion("jsapi_ticket is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketIsNotNull() {
+			addCriterion("jsapi_ticket is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketEqualTo(String value) {
+			addCriterion("jsapi_ticket =", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketNotEqualTo(String value) {
+			addCriterion("jsapi_ticket <>", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketGreaterThan(String value) {
+			addCriterion("jsapi_ticket >", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketGreaterThanOrEqualTo(String value) {
+			addCriterion("jsapi_ticket >=", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketLessThan(String value) {
+			addCriterion("jsapi_ticket <", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketLessThanOrEqualTo(String value) {
+			addCriterion("jsapi_ticket <=", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketLike(String value) {
+			addCriterion("jsapi_ticket like", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketNotLike(String value) {
+			addCriterion("jsapi_ticket not like", value, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketIn(List<String> values) {
+			addCriterion("jsapi_ticket in", values, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketNotIn(List<String> values) {
+			addCriterion("jsapi_ticket not in", values, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketBetween(String value1, String value2) {
+			addCriterion("jsapi_ticket between", value1, value2, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andJsapiTicketNotBetween(String value1, String value2) {
+			addCriterion("jsapi_ticket not between", value1, value2, "jsapiTicket");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateIsNull() {
+			addCriterion("indate is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateIsNotNull() {
+			addCriterion("indate is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateEqualTo(Date value) {
+			addCriterion("indate =", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateNotEqualTo(Date value) {
+			addCriterion("indate <>", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateGreaterThan(Date value) {
+			addCriterion("indate >", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateGreaterThanOrEqualTo(Date value) {
+			addCriterion("indate >=", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateLessThan(Date value) {
+			addCriterion("indate <", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateLessThanOrEqualTo(Date value) {
+			addCriterion("indate <=", value, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateIn(List<Date> values) {
+			addCriterion("indate in", values, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateNotIn(List<Date> values) {
+			addCriterion("indate not in", values, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateBetween(Date value1, Date value2) {
+			addCriterion("indate between", value1, value2, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andIndateNotBetween(Date value1, Date value2) {
+			addCriterion("indate not between", value1, value2, "indate");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeIsNull() {
+			addCriterion("expire_time is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeIsNotNull() {
+			addCriterion("expire_time is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeEqualTo(Date value) {
+			addCriterion("expire_time =", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeNotEqualTo(Date value) {
+			addCriterion("expire_time <>", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeGreaterThan(Date value) {
+			addCriterion("expire_time >", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeGreaterThanOrEqualTo(Date value) {
+			addCriterion("expire_time >=", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeLessThan(Date value) {
+			addCriterion("expire_time <", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeLessThanOrEqualTo(Date value) {
+			addCriterion("expire_time <=", value, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeIn(List<Date> values) {
+			addCriterion("expire_time in", values, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeNotIn(List<Date> values) {
+			addCriterion("expire_time not in", values, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeBetween(Date value1, Date value2) {
+			addCriterion("expire_time between", value1, value2, "expireTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andExpireTimeNotBetween(Date value1, Date value2) {
+			addCriterion("expire_time not between", value1, value2, "expireTime");
+			return (Criteria) this;
+		}
+	}
+
+	/**
+	 * This class was generated by MyBatis Generator. This class corresponds to the database table weibo_param
+	 * @mbg.generated  Tue Sep 24 11:05:35 CST 2019
+	 */
+	public static class Criterion {
+		private String condition;
+		private Object value;
+		private Object secondValue;
+		private boolean noValue;
+		private boolean singleValue;
+		private boolean betweenValue;
+		private boolean listValue;
+		private String typeHandler;
+
+		public String getCondition() {
+			return condition;
+		}
+
+		public Object getValue() {
+			return value;
+		}
+
+		public Object getSecondValue() {
+			return secondValue;
+		}
+
+		public boolean isNoValue() {
+			return noValue;
+		}
+
+		public boolean isSingleValue() {
+			return singleValue;
+		}
+
+		public boolean isBetweenValue() {
+			return betweenValue;
+		}
+
+		public boolean isListValue() {
+			return listValue;
+		}
+
+		public String getTypeHandler() {
+			return typeHandler;
+		}
+
+		protected Criterion(String condition) {
+			super();
+			this.condition = condition;
+			this.typeHandler = null;
+			this.noValue = true;
+		}
+
+		protected Criterion(String condition, Object value, String typeHandler) {
+			super();
+			this.condition = condition;
+			this.value = value;
+			this.typeHandler = typeHandler;
+			if (value instanceof List<?>) {
+				this.listValue = true;
+			} else {
+				this.singleValue = true;
+			}
+		}
+
+		protected Criterion(String condition, Object value) {
+			this(condition, value, null);
+		}
+
+		protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+			super();
+			this.condition = condition;
+			this.value = value;
+			this.secondValue = secondValue;
+			this.typeHandler = typeHandler;
+			this.betweenValue = true;
+		}
+
+		protected Criterion(String condition, Object value, Object secondValue) {
+			this(condition, value, secondValue, null);
+		}
+	}
+
+	/**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table weibo_param
+     *
+     * @mbg.generated do_not_delete_during_merge Tue Sep 24 10:57:31 CST 2019
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+}

+ 26 - 4
minigame/src/com/hssx/utils/WechatAndMicroblogUtil.java

@@ -1,12 +1,16 @@
 package com.hssx.utils;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-
-import java.util.Date;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
 
 import org.apache.commons.lang.StringEscapeUtils;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.hssx.constant.Constant;
+
 /**
  * Author: 吴涛涛 cuiyi@itany.com
  * Date : 2019 - 09 - 17 10:02
@@ -29,4 +33,22 @@ public class WechatAndMicroblogUtil {
         }
         return wechatUserNews;
     }
+    
+    public static JSONObject getWeiboSign() {
+    	String url = "https://api.weibo.com/oauth2/js_ticket/generate?client_id=APPKEY&client_secret=APPSECRET";
+    	url = url.replaceAll("APPKEY", Constant.MICROBLOG_APPKEY);
+    	url = url.replaceAll("APPSECRET", Constant.MICROBLOG_APPSECRET);
+    	try {
+			String resp = HttpKit.post(url, "");
+			System.out.println("resp=" + resp);
+			return JSONObject.parseObject(resp);
+		} catch (KeyManagementException | NoSuchAlgorithmException | NoSuchProviderException | IOException e) {
+			e.printStackTrace();
+		}
+    	return null;
+    }
+    
+    public static void main(String[] args) {
+    	getWeiboSign();
+    }
 }