From 827c7ee446807746918497eb588d3fcad9c10145 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 30 Sep 2019 22:26:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/View/default/Apply/my_game.html | 55 ++++++------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 235e9ceb5..f7739b1e4 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -235,20 +235,6 @@ 游戏类型:{$vo.game_type_name}
- 添加推广员游戏 - 复制下载链接 + 复制下载链接 $vo['id'],'pid'=>$vo['promote_id']));?> - 落地页链接 + 落地页链接 下架 @@ -988,36 +974,27 @@ $('.game-link').on('click', function () { var url = $(this).attr('data-url'); var qrcode = $(this).attr('data-qrcode'); - var enableStatus = $(this).attr('data-status'); + var enableStatus = parseInt($(this).attr('data-status')); - if (enableStatus != '已打包') { + if (enableStatus != 1) { var iconIndex = 7; - if (enableStatus == '打包失败') { - iconIndex = 5; + var enableStatusName = ''; + + switch (enableStatus) { + case 2: + case 3: + enableStatusName = '打包中'; + break; + case -1: + iconIndex = 5; + enableStatusName = '打包失败'; + break; } - layer.msg(enableStatus, {icon: iconIndex}); + layer.alert(enableStatusName, {icon: iconIndex}); return false; } - // $.ajax({ - // type: "post", - // url: "__URL__/qrcodeNew", - // dataType: "json", - // data: {'url':url}, - // success: function (data) { - // console.log(data); - // }, - // error: function (result) { - // layer.msg('网络异常', {icon: 5}); - // } - // }); - - // $.get("__URL__/qrcodeNew/url/" + url,function(data,status){ - // console.log(data); - // qrcode = data; - // }); - // $('#download_copy').attr('data-url',url); $('#game_link_ercode').attr('src',qrcode); $('#game_link_address').text(url); From c2a19ceb45549e3736d1cc8fc4b216c0378b9836 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 30 Sep 2019 22:32:26 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=90=BD=E5=9C=B0=E9=A1=B5=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/Home/promitionofregestion.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Application/Home/View/default/Home/promitionofregestion.html b/Application/Home/View/default/Home/promitionofregestion.html index 406287833..9a3818a06 100644 --- a/Application/Home/View/default/Home/promitionofregestion.html +++ b/Application/Home/View/default/Home/promitionofregestion.html @@ -2,7 +2,19 @@ - + + + + @@ -57,7 +69,7 @@ - + @@ -152,7 +164,8 @@ }) var title = $('[name=title]').val(); var description = $('[name=desc]').val(); - var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); + // var icon = window.location.protocol + "//" + window.location.host + $('[name=icon]').val(); + var icon = $('[name=icon]').val(); wxReady(title, description, icon) } } From 7bc6cac01a6958df57bf736d244953c910ed426a Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 30 Sep 2019 22:42:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Apply/my_game.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index f7739b1e4..ce8a3b1f1 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -981,6 +981,9 @@ var enableStatusName = ''; switch (enableStatus) { + case 0: + enableStatusName = '未打包'; + break; case 2: case 3: enableStatusName = '打包中'; From d29984aaeb02e053cac15fc4d1e3cfd53b879ff9 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 30 Sep 2019 22:51:56 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/HomeController.class.php | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/Application/Home/Controller/HomeController.class.php b/Application/Home/Controller/HomeController.class.php index 8e4344851..8b3c61d2a 100644 --- a/Application/Home/Controller/HomeController.class.php +++ b/Application/Home/Controller/HomeController.class.php @@ -55,26 +55,42 @@ class HomeController extends Controller $secret = 'd3219c70a45c5e1954be4608b288d38b'; $tokenUrl = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $appid . '&secret=' . $secret; - $result = file_get_contents($tokenUrl); - $result = json_decode($result, true); - if (!$result || isset($result['errcode'])) { - $this->ajaxReturn([ - 'status' => false, - 'msg' => '获取失败', - ]); + $content = file_get_contents(RUNTIME_PATH . 'Data/wechat_ticket'); + $ticketData = null; + if ($content) { + $ticketData = json_decode($content, true); } - $accessToken = $result['access_token']; - - $ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi'; - $result = file_get_contents($ticketUrl); - $result = json_decode($result, true); - if (!$result || $result['errcode'] != 0) { - $this->ajaxReturn([ - 'status' => false, - 'msg' => '获取失败', - ]); + + $isExpired = false; + if ($ticketData) { + $isExpired = time() > $ticketData['expired_at'] ? true : false; + } + + $ticket = ''; + if (!$ticketData || $isExpired) { + $ticket = $ticketData['ticket']; + $result = file_get_contents($tokenUrl); + $result = json_decode($result, true); + if (!$result || isset($result['errcode'])) { + $this->ajaxReturn([ + 'status' => false, + 'msg' => '获取失败', + ]); + } + $accessToken = $result['access_token']; + + $ticketUrl = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=' . $accessToken . '&type=jsapi'; + $result = file_get_contents($ticketUrl); + $result = json_decode($result, true); + if (!$result || $result['errcode'] != 0) { + $this->ajaxReturn([ + 'status' => false, + 'msg' => '获取失败', + ]); + } + $ticket = $result['ticket']; + file_put_contents(RUNTIME_PATH . 'Data/wechat_ticket', json_encode(['ticket' => $ticket, 'expired_at' => time() + 3600])); } - $ticket = $result['ticket']; $randStr = 'aaabbbxeclsx'; $time = time();