From edd5b55afa0af3daf943c29fa52be2725a30aec4 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Fri, 13 Dec 2019 20:34:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>=E5=85=85?= =?UTF-8?q?=E5=80=BC=E7=8E=A9=E5=AE=B6|=E6=88=91=E7=9A=84=E6=B8=B8?= =?UTF-8?q?=E6=88=8F--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/QueryController.class.php | 5 ++-- .../Home/View/default/Apply/my_game.html | 27 ++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index cb6ed2018..8f8e65c35 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1869,16 +1869,15 @@ class QueryController extends BaseController $field = $fieldUC . ',' . $fieldUI . ',' . $fieldLR . ' as user_game_login_count'; $subQuery = M('user_play_data_count', 'tab_')->alias('uc') ->field($field) - ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') + ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.role_id = uc.role_id') ->where($map) - ->group('uc.role_id,uc.server_id,uc.game_id') + ->group('uc.role_id,uc.game_id,uc.user_id,uc.id') ->buildSql(); $query = M()->alias('record') ->table($subQuery) ->order($orderBy); $total = M('user_play_data_count', 'tab_')->alias('uc') ->field($fieldUC) - ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->where($map) ->find(); diff --git a/Application/Home/View/default/Apply/my_game.html b/Application/Home/View/default/Apply/my_game.html index 2fae01956..094ca87ec 100644 --- a/Application/Home/View/default/Apply/my_game.html +++ b/Application/Home/View/default/Apply/my_game.html @@ -876,9 +876,19 @@ fontname: 'Ubuntu', fontcolor: '#ff9818', }; - var logo = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img')[0] - $('#game_link_ercode').empty().qrcode(options); - $("#game_link_ercode canvas")[0].getContext('2d').drawImage(logo, (qrcodeWidth - logoWidth) / 2, (qrcodeHeight - logoHeight) / 2, logoWidth, logoHeight); + + var logo = null; + var logoSrc = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img').attr('src'); + if (isImg(logoSrc)) { + logo = $(linkTag).parents('.game-li').eq(0).find('.img-box').children('img')[0] + } else { + var img = document.createElement('img'); + img.src = '__IMG__/game_icon.png'; + logo = img; + } + + $('#game_link_ercode').empty().qrcode(options); + $("#game_link_ercode canvas")[0].getContext('2d').drawImage(logo, (qrcodeWidth - logoWidth) / 2, (qrcodeHeight - logoHeight) / 2, logoWidth, logoHeight); $('#clipboard-btn').attr('data-text', response.data.url) $('#clipboard-btn').click() @@ -896,6 +906,17 @@ }); }); + function isImg(src) { + var img = new Image(); + img.src = src; + img.onload = function () { + if (img.width > 0 || img.height > 0) { + return true; + } + } + return false; + } + var clipboard = new ClipboardJS('#clipboard-btn', { text: function(trigger) { return trigger.getAttribute('data-text');