微赞自定义二维码功能增强
修改web/source/platform/qr.ctrl.php,第168行,修改为
if($do == 'display') {
$_W['page']['title'] = '扫描统计 - 二维码管理 - 高级功能'.$_GPC['type'];
$starttime = empty($_GPC['time']['start']) ? TIMESTAMP - 86399 * 30 : strtotime($_GPC['time']['start']);
$endtime = empty($_GPC['time']['end']) ? TIMESTAMP + 6*86400: strtotime($_GPC['time']['end']) + 86399;
$where .= " WHERE uniacid = :uniacid AND acid = :acid AND createtime >= :starttime AND createtime < :endtime";
$param = array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid'], ':starttime' => $starttime, ':endtime' => $endtime);
!empty($_GPC['keyword']) && $where .= " AND scene_str LIKE '%{$_GPC['keyword']}%'";
!empty($_GPC['type']) && $where .= ' AND type = '.$_GPC['type'];
$pindex = max(1, intval($_GPC['page']));
$psize = 10;
$type = $_GPC['type'];
$type1 = ' AND type = 1';
$type2 = ' AND type = 2';
$count = pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('qrcode_stat'). $where, $param);
$countt1 = pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('qrcode_stat'). $where. $type1, $param);
$countt2 = pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('qrcode_stat'). $where. $type2, $param);
if($_GPC['type']==2){
//$countt2 = $countt2 / 2;
$count = $countt2;
$typetext = '扫描';
}elseif($_GPC['type']==1){
$count = $countt1;
$typetext = '关注';
}else{
//$countt2 = $countt2 / 2;
$count = $countt1 + $countt2;
$typetext = '关注+扫描';
}
$list = pdo_fetchall("SELECT * FROM ".tablename('qrcode_stat')." $where ORDER BY id DESC LIMIT ".($pindex - 1) * $psize.','. $psize, $param);
if (!empty($list)) {
$openid = array();
foreach ($list as $index => &$qrcode) {
if ($qrcode['type'] == 1) {
$qrcode['type']="关注";
} else {
$qrcode['type']="扫描";
}
if(!in_array($qrcode['openid'], $openid)) {
$openid[] = $qrcode['openid'];
}
}
$openids = implode("','", $openid);
$param_temp[':uniacid'] = $_W['uniacid'];
$param_temp[':acid'] = $_W['acid'];
$nickname = pdo_fetchall('SELECT nickname, openid FROM ' . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND acid = :acid AND openid IN ('{$openids}')", $param_temp, 'openid');
}
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('qrcode_stat') . $where, $param);
$pager = pagination($total, $pindex, $psize);
template('platform/qr-display');
}
修改web/themes/default/qr-display.html,第19行,修改为
<select name="type" class="form-control" style="width: 80px;">
<option value="0" {php if(empty($type))echo "selected";}>全部</option>
<option value="1" {php if($type==1)echo "selected";}>关注</option>
<option value="2" {php if($type==2)echo "selected";}>扫描</option>
</select>
第38行
<div class="panel-heading">详细数据 <span class="text-muted" style="color:red;">扫描次数:{$count}</span></div>
修改为:
<div class="panel-heading">详细数据 <span class="text-muted" style="color:red;">{$typetext}次数:{$count}</span></div>
文章评论