From 9783acc3c1ed0fd0b6c3e8fdbfc1bf2fc87c5e3b Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 25 Sep 2019 18:17:03 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=90=BD=E5=9C=B0=E9=A1=B5=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1jssdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/Home/promitionofregestion.html | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index cffc09800..756db55be 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -9,7 +9,7 @@ - + {$data[0]['relation_game_name']} @@ -133,29 +133,29 @@ var dataIndex = getVs(); $('#data-' + dataIndex).css('display','unset'); - // $.ajax({ - // url: "{:U('Home/generateWechatSign')}", - // dataType: 'json', - // type: 'post', - // data: {url: window.location.href}, - // success: function(response) { - // if (response.status) { - // wx.config({ - // debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 - // appId: response.data.appid, - // timestamp: response.data.time, - // nonceStr: response.data.randStr, - // signature: response.data.sign, - // jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] - // }) - // var title = $('[name=title]').val(); - // var description = $('[name=description]').val(); - // var icon = $('[name=icon]').val(); - // - // wxReady(title, description, icon) - // } - // } - // }); + $.ajax({ + url: "{:U('Home/generateWechatSign')}", + dataType: 'json', + type: 'post', + data: {url: window.location.href}, + success: function(response) { + if (response.status) { + wx.config({ + debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + appId: response.data.appid, + timestamp: response.data.time, + nonceStr: response.data.randStr, + signature: response.data.sign, + jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] + }) + var title = $('[name=title]').val(); + var description = $('[name=description]').val(); + var icon = $('[name=icon]').val(); + + wxReady(title, description, icon) + } + } + }); function wxReady(title, description, img) { wx.ready(function () { From 2b721a2e04aee05e6a1835102aa59df68e1b8514 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 25 Sep 2019 18:21:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Home/promitionofregestion.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index 756db55be..3afc01433 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -9,7 +9,7 @@ - + {$data[0]['relation_game_name']} From ead247849ddb710092a3ad083123de36d3efb7fb Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Wed, 25 Sep 2019 20:01:55 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=90=BD=E5=9C=B0=E9=A1=B5QQ=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/HomeController.class.php | 6 ++--- .../default/Home/promitionofregestion.html | 23 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 5429d7048..8e291b6f2 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -51,8 +51,8 @@ class HomeController extends Controller { $url = I('url', ''); - $appid = 'wx0ba5be5c8bb9f1b7'; - $secret = '0adcf03d6fd637c578db343c74ee931e'; + $appid = 'wx5a1463c00253851b'; + $secret = 'd3219c70a45c5e1954be4608b288d38b'; $tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret; $result = file_get_contents($tokenUrl); @@ -76,7 +76,7 @@ class HomeController extends Controller } $ticket = $result['ticket']; - $randStr = rand(100000, 999999); + $randStr = 'aaabbbxeclsx'; $time = time(); $signStr = 'jsapi_ticket=' . $ticket . '&noncestr=' . $randStr . '×tamp=' . $time . '&url=' . $url; diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index 3afc01433..c178e5a90 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -2,7 +2,7 @@ - + @@ -56,7 +56,9 @@ - + + +
@@ -141,7 +143,7 @@ success: function(response) { if (response.status) { wx.config({ - debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 + // debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: response.data.appid, timestamp: response.data.time, nonceStr: response.data.randStr, @@ -149,9 +151,8 @@ jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone'] }) var title = $('[name=title]').val(); - var description = $('[name=description]').val(); - var icon = $('[name=icon]').val(); - + var description = $('[name=desc]').val(); + var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); wxReady(title, description, icon) } } @@ -162,7 +163,7 @@ wx.onMenuShareAppMessage({ title: title, desc: description, - link: location.href, + link: window.location.href, imgUrl: img, type: '', dataUrl: '', @@ -171,7 +172,7 @@ }); wx.onMenuShareTimeline({ title: title, - link: location.href, + link: window.location.href, imgUrl: img, success: function () { } @@ -179,7 +180,7 @@ wx.onMenuShareQQ({ title: title, desc: description, - link: location.href, + link: window.location.href, imgUrl: img, success: function () { }, @@ -189,7 +190,7 @@ wx.onMenuShareWeibo({ title: title, desc: description, - link: location.href, + link: window.location.href, imgUrl: img, success: function () { }, @@ -199,7 +200,7 @@ wx.onMenuShareQZone({ title: title, desc: description, - link: location.href, + link: window.location.href, imgUrl: img, success: function () { },