public function fieldsFormDisplay($rid = 0) { if (!empty($rid)) { $replies = pdo_getall($this->tablename, array('rid' => $rid)); } include $this->template('display'); }
$data['email'] = '未完善'; } $data ? template('mc/modal') : exit('dataerr'); exit; } } if ($do == 'credit_record') { $uid = intval($_GPC['uid']); $credits = array_keys($creditnames); $type = trim($_GPC['type']) ? trim($_GPC['type']) : $credits[0]; $pindex = max(1, intval($_GPC['page'])); $psize = 50; $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('mc_credits_record') . ' WHERE uid = :uid AND uniacid = :uniacid AND credittype = :credittype ', array(':uniacid' => $_W['uniacid'], ':uid' => $uid, ':credittype' => $type)); $data = pdo_fetchall("SELECT r.*, u.username FROM " . tablename('mc_credits_record') . ' AS r LEFT JOIN ' . tablename('users') . ' AS u ON r.operator = u.uid ' . ' WHERE r.uid = :uid AND r.uniacid = :uniacid AND r.credittype = :credittype ORDER BY id DESC LIMIT ' . ($pindex - 1) * $psize . ',' . $psize, array(':uniacid' => $_W['uniacid'], ':uid' => $uid, ':credittype' => $type)); $pager = pagination($total, $pindex, $psize); $modules = pdo_getall('modules', array('issystem' => 0), array('title', 'name'), 'name'); $modules['card'] = array('title' => '会员卡', 'name' => 'card'); template('mc/credit_record'); exit; } if ($do == 'stat') { $uid = intval($_GPC['uid']); $credits = array_keys($creditnames); $count = 5 - count($creditnames); for ($i = $count; $i > 0; $i--) { $creditnames[] = array('title' => '***'); } $type = intval($_GPC['type']); $starttime = strtotime('-7 day'); $endtime = strtotime('7 day'); if ($type == 1) {
$settings = uni_setting($uniacid, array('notify')); $notify = $settings['notify'] ? $settings['notify'] : array(); $ownerid = pdo_fetchcolumn("SELECT uid FROM " . tablename('uni_account_users') . " WHERE uniacid = :uniacid AND role = 'owner'", array(':uniacid' => $uniacid)); if (!empty($ownerid)) { $owner = user_single(array('uid' => $ownerid)); $owner['group'] = pdo_fetch("SELECT id, name, package FROM " . tablename('users_group') . " WHERE id = :id", array(':id' => $owner['groupid'])); $owner['group']['package'] = iunserializer($owner['group']['package']); } $extend = pdo_fetch("SELECT * FROM " . tablename('uni_group') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid)); $extend['modules'] = iunserializer($extend['modules']); $extend['templates'] = iunserializer($extend['templates']); if (!empty($extend['modules'])) { $owner['extend']['modules'] = pdo_getall('modules', array('name' => $extend['modules'])); } if (!empty($extend['templates'])) { $owner['extend']['templates'] = pdo_getall('site_templates', array('id' => $extend['templates'])); } $extend['package'] = pdo_getall('uni_account_group', array('uniacid' => $uniacid), array(), 'groupid'); $groups = pdo_fetchall("SELECT id, name, package FROM " . tablename('users_group') . " ORDER BY id ASC", array(), 'id'); $modules = pdo_fetchall("SELECT mid, name, title FROM " . tablename('modules') . ' WHERE issystem != 1', array(), 'name'); $templates = pdo_fetchall("SELECT * FROM " . tablename('site_templates')); } elseif ($step == '4') { $uniacid = intval($_GPC['uniacid']); $acid = intval($_GPC['acid']); $uni_account = pdo_fetch('SELECT * FROM ' . tablename('uni_account') . ' WHERE uniacid = ' . $uniacid); if (empty($uni_account)) { message('非法访问'); } $account = account_fetch($uni_account['default_acid']); } template('account/post-step');
$id = intval($_GPC['id']); if ($id > 0) { $condition .= ' AND id = :id'; $params[':id'] = $id; } $pindex = max(1, intval($_GPC['page'])); $psize = 20; $limit = " ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ", {$psize}"; $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('wechat_attachment') . $condition, $params); $lists = pdo_fetchall('SELECT * FROM ' . tablename('wechat_attachment') . $condition . $limit, $params); if (!empty($lists)) { foreach ($lists as &$row) { if ($type == 'video') { $row['tag'] = iunserializer($row['tag']); } elseif ($type == 'news') { $row['items'] = pdo_getall('wechat_news', array('uniacid' => $_W['uniacid'], 'attach_id' => $row['id'])); } } } $pager = pagination($total, $pindex, $psize); $groups = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid'])); if (!empty($groups)) { $groups = iunserializer($groups['groups']); } } if ($do == 'purview') { $wxname = trim($_GPC['wxname']); if (empty($wxname)) { exit('微信号不能为空'); } $type = trim($_GPC['type']);
$list = pdo_fetchall($sql, $param); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_members') . " AS a LEFT JOIN " . tablename('mc_members') . " AS b ON a.uid = b.uid WHERE a.uniacid = :uniacid {$where}", $param); $pager = pagination($total, $pindex, $psize); foreach ($list as &$value) { $value['is_birth'] = 0; if ($value['birthmonth'] == date('m') && $value['birthday'] == date('d')) { $value['is_birth'] = 1; } } $has_members = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'])); if ($has_members) { for ($i = 0; $i < 3; $i++) { $time = strtotime(date('Y-m-d')) + $i * 86400; $month = date('m', $time); $day = date('d', $time); $uids = pdo_getall('mc_card_members', array('uniacid' => $_W['uniacid']), array('uid')); $uids = implode(', ', array_keys($uids)); $sql = 'SELECT COUNT(*) FROM ' . tablename('mc_members') . " WHERE uniacid = :uniacid AND uid IN ({$uids})AND birthmonth = :month AND birthday = :day"; $param = array(':uniacid' => $_W['uniacid'], ':month' => $month, ':day' => $day); $total[$i] = intval(pdo_fetchcolumn($sql, $param)); } } template('mc/card'); } if ($do == 'delete') { $cardid = intval($_GPC['cardid']); if (pdo_delete('mc_card_members', array('id' => $cardid))) { message('删除会员卡成功', url('mc/card/manage'), 'success'); } else { message('删除会员卡失败', url('mc/card/manage'), 'error'); }
function uni_setmeal($uniacid = 0) { global $_W; if (!$uniacid) { $uniacid = $_W['uniacid']; } $owneruid = pdo_fetchcolumn("SELECT uid FROM " . tablename('uni_account_users') . " WHERE uniacid = :uniacid AND role = 'owner'", array(':uniacid' => $uniacid)); if (empty($owneruid)) { $user = array('uid' => -1, 'username' => '创始人', 'timelimit' => '未设置', 'groupid' => '-1', 'groupname' => '所有服务'); return $user; } load()->model('user'); $groups = pdo_getall('users_group', array(), array('id', 'name'), 'id'); $owner = user_single(array('uid' => $owneruid)); $user = array('uid' => $owner['uid'], 'username' => $owner['username'], 'groupid' => $owner['groupid'], 'groupname' => $groups[$owner['groupid']]['name']); if (empty($owner['endtime'])) { $user['timelimit'] = date('Y-m-d', $owner['starttime']) . ' ~ 无限制'; } else { if ($owner['endtime'] <= TIMESTAMP) { $add = ' <strong class="text-danger"> 已到期</strong>'; } $user['timelimit'] = date('Y-m-d', $owner['starttime']) . ' ~ ' . date('Y-m-d', $owner['endtime']) . $add; } return $user; }
if (!empty($user)) { $condition .= ' AND (uid IN (SELECT uid FROM ' . tablename('mc_members') . ' WHERE uniacid = :uniacid AND (realname LIKE :username OR uid = :uid OR mobile LIKE :mobile)))'; $params[':username'] = "******"; $params[':uid'] = intval($user); $params[':mobile'] = "%{$user}%"; } $psize = 30; $pindex = max(1, intval($_GPC['page'])); $limit = " ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ", {$psize}"; $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename($tablename) . $condition, $params); $data = pdo_fetchall('SELECT * FROM ' . tablename($tablename) . $condition . $limit, $params); if (!empty($data)) { $uids = array(); $clerks = array(); foreach ($data as $da) { if (!in_array($da['uid'], $uids)) { $uids[] = $da['uid']; } if (!in_array($da['clerk_id'], $clerks)) { $clerks[] = $da['clerk_id']; } } $uids = implode(',', $uids); $users = pdo_fetchall('SELECT mobile,uid,realname FROM ' . tablename('mc_members') . " WHERE uniacid = :uniacid AND uid IN ({$uids})", array(':uniacid' => $_W['uniacid']), 'uid'); $clerks = implode(',', $clerks); $clerks = pdo_fetchall('SELECT name,id FROM ' . tablename('activity_coupon_password') . " WHERE uniacid = :uniacid AND id IN ({$clerks})", array(':uniacid' => $_W['uniacid']), 'id'); $stores = pdo_getall('activity_stores', array('uniacid' => $_W['uniacid']), array('id', 'business_name', 'branch_name'), 'id'); } $pager = pagination($total, $pindex, $psize); } template('mc/stat');
load()->model('mc'); if ($do == 'clerk') { $clerk = pdo_get('activity_coupon_password', array('uniacid' => $_W['uniacid'], 'password' => trim($_GPC['password']))); if (empty($clerk)) { exit(json_encode(array('valid' => false))); } else { exit(json_encode(array('valid' => true))); } } if ($do == 'user') { $type = trim($_GPC['type']); if (!in_array($type, array('uid', 'mobile'))) { $type = 'mobile'; } $username = trim($_GPC['username']); $data = pdo_getall('mc_members', array('uniacid' => $_W['uniacid'], $type => $username)); if (empty($data)) { exit(json_encode(array('error' => 'empty', 'message' => '没有找到对应用户'))); } elseif (count($data) > 1) { exit(json_encode(array('error' => 'not-unique', 'message' => '用户不唯一,请重新输入用户信息'))); } else { load()->model('card'); $user = $data[0]; $user['groupname'] = $_W['account']['groups'][$user['groupid']]['title']; $card = card_setting(); $member = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $user['uid'])); if (!empty($card) && $card['status'] == 1) { if (!empty($member)) { $str = "会员卡号:{$member['cardsn']}."; $user['discount'] = $card['discount'][$user['groupid']]; $user['cardsn'] = $member['cardsn'];
for ($i = 0; $i < 7; $i++) { $time_key = date('Y-m-d', strtotime("+{$i} days", $time)); $mass_old[$time_key] = array('msgtype' => 'news', 'group' => -1, 'time' => $time_key, 'status' => 1, 'clock' => '20:00', 'media' => array('items' => array(array('title' => '请选择素材')))); } $mass_new = array(); if (!empty($record)) { foreach ($record as &$li) { $time_key = date('Y-m-d', $li['sendtime']); $li['time'] = $time_key; $li['clock'] = date('H:i', $li['sendtime']); $li['media'] = pdo_get('wechat_attachment', array('id' => $li['attach_id'])); $li['media']['attach'] = tomedia($li['media']['attachment']); if ($li['msgtype'] == 'video') { $li['media']['attach']['tag'] = iunserializer($li['media']['tag']); } elseif ($li['msgtype'] == 'news') { $li['media']['items'] = pdo_getall('wechat_news', array('attach_id' => $li['attach_id'])); foreach ($li['media']['items'] as &$row) { $row['thumb'] = media2local($row['thumb_media_id']); } } elseif ($li['msgtype'] == 'wxcard') { $li['media'] = pdo_get('coupon', array('id' => $li['attach_id'])); $li['media']['media_id'] = $li['media']['card_id']; $li['media']['logo_url'] = url('utility/wxcode/image', array('attach' => $li['media']['logo_url'])); $li['media']['type'] = 'wxcard'; } $li['media']['createtime_cn'] = date('Y-m-d H:i', $li['media']['createtime']); $li['media_id'] = $li['media']['media_id']; $mass_new[$time_key] = $li; } unset($record); }
<?php defined('IN_IA') or exit('Access Denied'); error_reporting(0); global $_W; if (!in_array($do, array('log'))) { exit('Access Denied'); } if ($do == 'log') { $tid = intval($_GPC['tid']); $module = trim($_GPC['module']); $type = trim($_GPC['type']); $data = pdo_getall('core_cron_record', array('uniacid' => $_W['uniacid'], 'tid' => $tid, 'module' => $module, 'type' => $type)); if (!empty($data)) { foreach ($data as &$da) { $da['createtime'] = date('Y-m-d H:i:s', $da['createtime']); } } message(array('items' => $data), '', 'ajax'); }