From 0e192a2f7524d49d4e21a7c581d14404e44fb99e Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 30 Sep 2019 22:54:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=B8=B8=E6=88=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/ApplyController.class.php | 14 ++++ .../Home/View/default/Apply/my_game.html | 84 +++++++++++-------- 2 files changed, 65 insertions(+), 33 deletions(-) diff --git a/Application/Home/Controller/ApplyController.class.php b/Application/Home/Controller/ApplyController.class.php index 32bc8c359..156950d71 100644 --- a/Application/Home/Controller/ApplyController.class.php +++ b/Application/Home/Controller/ApplyController.class.php @@ -1557,4 +1557,18 @@ class ApplyController extends BaseController $this->ajaxReturn(array("status" => 0, "msg" => "添加成功")); } + + public function getEnableStatus() + { + $applyId = I('post.apply_id'); + + if (empty($applyId)) { + $this->ajaxReturn(['status' => 0, 'msg' => '数据异常']); + } + + $map['id'] = $applyId; + $enableStatus = M('Apply', 'tab_')->where($map)->getField('enable_status'); + + $this->ajaxReturn(['status' => 1, 'data' => $enableStatus]); + } } diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index ce8a3b1f1..5d9c45901 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -257,9 +257,9 @@ 添加推广员游戏 - 复制下载链接 + 复制下载链接 $vo['id'],'pid'=>$vo['promote_id']));?> - 落地页链接 + 落地页链接 下架 @@ -974,40 +974,58 @@ $('.game-link').on('click', function () { var url = $(this).attr('data-url'); var qrcode = $(this).attr('data-qrcode'); - var enableStatus = parseInt($(this).attr('data-status')); - - if (enableStatus != 1) { - var iconIndex = 7; - var enableStatusName = ''; - - switch (enableStatus) { - case 0: - enableStatusName = '未打包'; - break; - case 2: - case 3: - enableStatusName = '打包中'; - break; - case -1: - iconIndex = 5; - enableStatusName = '打包失败'; - break; - } + var applyId = parseInt($(this).attr('data-apply-id')); - layer.alert(enableStatusName, {icon: iconIndex}); - return false; - } + $.ajax({ + type: "post", + url: "__URL__/getEnableStatus", + dataType: "json", + data: {'apply_id': applyId}, + success: function (data) { + console.log(data); + if (data.status == 0) { + layer.msg(data.msg, {icon: 5}); + return false; + } - // $('#download_copy').attr('data-url',url); - $('#game_link_ercode').attr('src',qrcode); - $('#game_link_address').text(url); - $('#game_link_address_copy').text(url); - $('#game_link').show(); - $('.game-window-bg').show(); + var enableStatus = parseInt(data.data); + if (enableStatus == 1) { + // $('#download_copy').attr('data-url',url); + $('#game_link_ercode').attr('src',qrcode); + $('#game_link_address').text(url); + $('#game_link_address_copy').text(url); + $('#game_link').show(); + $('.game-window-bg').show(); + + var e = document.getElementById("game_link_address_copy"); + e.select(); // 选择对象 + document.execCommand("Copy"); // 执行浏览器复制命令 + } else { + var iconIndex = 7; + var enableStatusName = ''; + + switch (enableStatus) { + case 0: + enableStatusName = '未打包'; + break; + case 2: + case 3: + enableStatusName = '打包中'; + break; + case -1: + iconIndex = 5; + enableStatusName = '打包失败'; + break; + } - var e = document.getElementById("game_link_address_copy"); - e.select(); // 选择对象 - document.execCommand("Copy"); // 执行浏览器复制命令 + layer.alert(enableStatusName, {icon: iconIndex}); + return false; + } + }, + error: function (result) { + layer.msg('网络异常', {icon: 5}); + } + }); }); // $("#download_copy").zclip({