Exemplo n.º 1
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('wechat_manage');
$dos = array('display', 'location_post', 'logo', 'location_list', 'location_view', 'location_del', 'whitelist', 'location_edit', 'export', 'location_sync');
$do = in_array($do, $dos) ? $do : 'logo';
$acid = $_W['acid'];
if ($do == 'logo') {
    $coupon_setting = pdo_fetch('SELECT * FROM ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :acid', array(':aid' => $_W['uniacid'], ':acid' => $acid));
    if (checksubmit('submit')) {
        $_GPC['logo'] = trim($_GPC['logo']);
        empty($_GPC['logo']) && message('请上传商户logo', referer(), 'info');
        $data = array('uniacid' => $_W['uniacid'], 'acid' => $acid, 'logourl' => $_GPC['logo']);
        if (empty($coupon_setting)) {
            pdo_insert('coupon_setting', $data);
        } else {
            pdo_update('coupon_setting', $data, array('uniacid' => $_W['uniacid']));
        }
        message('上传商户LOGO成功', referer(), 'success');
    }
}
if ($do == 'location_post') {
    if (checksubmit('submit')) {
        $data['business_name'] = trim($_GPC['business_name']) ? urlencode(trim($_GPC['business_name'])) : message('门店名称不能为空');
        $data['branch_name'] = urlencode(trim($_GPC['branch_name']));
        $cate = array();
        $in_cate = array();
Exemplo n.º 2
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_member');
$dos = array('display', 'post', 'del', 'add', 'group');
$do = in_array($do, $dos) ? $do : 'display';
load()->model('mc');
if ($do == 'display') {
    $_W['page']['title'] = '会员列表 - 会员 - 会员中心';
    $groups = mc_groups();
    $pindex = max(1, intval($_GPC['page']));
    $psize = 50;
    $condition = '';
    $starttime = empty($_GPC['createtime']['start']) ? strtotime('-90 days') : strtotime($_GPC['createtime']['start']);
    $endtime = empty($_GPC['createtime']['end']) ? TIMESTAMP + 86399 : strtotime($_GPC['createtime']['end']) + 86399;
    $condition .= " AND createtime >= {$starttime} AND createtime <= {$endtime}";
    $condition .= empty($_GPC['username']) ? '' : " AND (( `realname` LIKE '%" . trim($_GPC['username']) . "%' ) OR ( `nickname` LIKE '%" . trim($_GPC['username']) . "%' ) OR ( `mobile` LIKE '%" . trim($_GPC['username']) . "%' )) ";
    $condition .= intval($_GPC['groupid']) > 0 ? " AND `groupid` = '" . intval($_GPC['groupid']) . "'" : '';
    if (checksubmit('export_submit', true)) {
        $sql = "SELECT uid, uniacid, groupid, realname, nickname, email, mobile, credit1, credit2, credit6, createtime  FROM " . tablename('mc_members') . " WHERE uniacid = '{$_W['uniacid']}' " . $condition . " ORDER BY createtime";
        $list = pdo_fetchall($sql);
        $header = array('uid' => 'UID', 'realname' => '姓名', 'groupid' => '会员组', 'mobile' => '手机', 'email' => '邮箱', 'credit1' => '积分', 'credit2' => '余额', 'createtime' => '注册时间');
        $keys = array_keys($header);
        $html = "";
        foreach ($header as $li) {
            $html .= $li . "\t ,";
        }
Exemplo n.º 3
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('platform_special');
$dos = array('display', 'set', 'cancel', 'message', 'search_key');
$do = !empty($_GPC['do']) && in_array($do, $dos) ? $do : 'display';
load()->model('reply');
load()->model('account');
$_W['account']['modules'] = uni_modules();
if ($_W['isajax']) {
    if ($do == 'search_key') {
        $condition = '';
        $key_word = trim($_GPC['key_word']);
        if (!empty($key_word)) {
            $condition = " AND content LIKE '%{$key_word}%' ";
        }
        $data = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . " WHERE (uniacid = 0 OR uniacid = :uniacid) AND status != 0 " . $condition . ' ORDER BY uniacid DESC,displayorder DESC LIMIT 100', array(':uniacid' => $_W['uniacid']));
        $exit_da = array();
        if (!empty($data)) {
            foreach ($data as $da) {
                $exit_da[] = $da['content'];
            }
        }
        exit(json_encode($exit_da));
    }
    exit('error');
}
Exemplo n.º 4
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$_W['page']['title'] = '常用接入服务 - 常用接入服务 - 高级功能';
uni_user_permission_check('platform_service');
load()->model('module');
load()->model('reply');
$m = module_fetch('userapi');
$cfg = $m['config'];
$ds = reply_search("`uniacid` = 0 AND module = 'userapi' AND `status`=1");
$apis = array();
foreach ($ds as $row) {
    $apis[$row['id']] = $row;
}
if ($_W['ispost'] && $_W['isajax']) {
    $rids = explode(',', $_GPC['rids']);
    if (is_array($rids)) {
        $cfg = array();
        foreach ($rids as $rid) {
            if (!empty($apis[$rid])) {
                $cfg[intval($rid)] = true;
            }
        }
        $module = WeUtility::createModule('userapi');
        $module->saveSettings($cfg);
    }
    exit;
Exemplo n.º 5
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'setting', 'shortcut', 'enable', 'form');
$do = !empty($_GPC['do']) ? $_GPC['do'] : 'display';
if ($do != 'setting') {
    uni_user_permission_check('profile_module');
}
$modulelist = uni_modules(false);
if (empty($modulelist)) {
    message('没有可用功能.');
}
if ($do == 'display') {
    $_W['page']['title'] = '模块列表 - 公众号选项';
    $setting = uni_setting($_W['uniacid'], array('shortcuts'));
    $shortcuts = $setting['shortcuts'];
    if (!empty($modulelist)) {
        foreach ($modulelist as $i => &$module) {
            if (!empty($_W['setting']['permurls']['modules']) && !in_array($module['name'], $_W['setting']['permurls']['modules'])) {
                unset($modulelist[$i]);
                continue;
            }
            $module['shortcut'] = !empty($shortcuts[$module['name']]);
            $module['official'] = empty($module['issystem']) && (strexists($module['author'], 'WeEngine Team') || strexists($module['author'], '微擎团队'));
            if ($module['issystem']) {
                $path = '../framework/builtin/' . $module['name'];
            } else {
Exemplo n.º 6
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_material_display');
$_W['page']['title'] = '永久素材-微信素材';
$dos = array('image', 'del', 'export', 'news', 'down', 'list', 'purview', 'modal', 'send');
$do = in_array($do, $dos) ? $do : 'list';
if ($do == 'down') {
    load()->func('file');
    set_time_limit(0);
    $acc = WeAccount::create();
    if (is_error($acc)) {
        message($acc, '', 'ajax');
    }
    $post = $_GPC['__input'];
    $type = $types = $post['type'];
    $pindex = max(1, intval($post['page']));
    $psize = 15;
    $offset = ($pindex - 1) * $psize;
    $result = $acc->batchGetMaterial($type, $offset, $psize);
    if (is_error($result)) {
        message($result, '', 'ajax');
    }
    if ($result['item_count'] == 0 || count($result['data']) == 0) {
        message(error(-2, $result['total_count']), '', 'ajax');
    }
    $fail = array();
Exemplo n.º 7
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_tplnotice');
$_W['page']['title'] = '会员微信通知-会员中心';
$dos = array('set');
$do = in_array($do, $dos) ? $do : 'set';
if ($do == 'set') {
    if (checksubmit()) {
        $data = array('type' => trim($_GPC['type']), 'recharge' => trim($_GPC['recharge']), 'credit1' => trim($_GPC['credit1']), 'credit2' => trim($_GPC['credit2']), 'group' => trim($_GPC['group']), 'nums_plus' => trim($_GPC['nums_plus']), 'nums_times' => trim($_GPC['nums_times']), 'times_plus' => trim($_GPC['times_plus']), 'times_times' => trim($_GPC['times_times']));
        $data = iserializer($data);
        pdo_update('uni_settings', array('tplnotice' => $data), array('uniacid' => $_W['uniacid']));
        message('设置通知模板成功', referer(), 'success');
    }
    $setting = uni_setting($_W['uniacid'], '*', true);
    $tpl = $setting['tplnotice'];
    if (!is_array($tpl)) {
        $tpl = array();
    }
    template('mc/tplnotice');
}
Exemplo n.º 8
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_trade');
$_W['page']['title'] = '会员交易-会员管理';
$dos = array('consume', 'user', 'modal', 'clerk', 'credit', 'card', 'cardsn', 'tpl');
$do = in_array($do, $dos) ? $do : 'tpl';
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' => '用户不唯一,请重新输入用户信息')));
Exemplo n.º 9
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
$type = $do;
$do = $_GPC['foo'];
$m = $_GPC['m'];
uni_user_permission_check('platform_nav_' . $do, true, 'nav');
$dos = array('post', 'delete', 'saves', 'display');
$do = in_array($do, $dos) ? $do : 'display';
$types = array('home' => array('name' => 'home', 'title' => '首页', 'visiable' => true, 'position' => 1), 'profile' => array('name' => 'profile', 'title' => '个人中心', 'visiable' => true, 'position' => 2));
$type = array_key_exists($type, $types) ? $types[$type] : $types['home'];
$titles = array('home' => '微站首页导航图标', 'profile' => '个人中心功能条目');
$_W['page']['title'] = $titles[$type['name']];
$setting = uni_setting($_W['uniacid'], 'default_site');
$default_site = intval($setting['default_site']);
load()->model('module');
$modules = uni_modules();
if (!empty($m)) {
    $module = module_fetch($m);
    if (empty($module)) {
        message('访问错误.');
    }
}
if ($do != 'display') {
    define('FRAME', 'site');
    $frames = buildframes(array(FRAME));
    $frames = $frames[FRAME];
Exemplo n.º 10
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('profile_payment');
$_W['page']['title'] = '支付参数 - 公众号选项';
$setting = uni_setting($_W['uniacid'], array('payment', 'recharge'));
$pay = $setting['payment'];
$recharge = $setting['recharge'];
if (!is_array($pay)) {
    $pay = array();
}
if ($_W['ispost']) {
    $credit = array_elements(array('switch'), $_GPC['credit']);
    $credit['switch'] = $credit['switch'] == 'true';
    $card = array_elements(array('switch'), $_GPC['card']);
    $card['switch'] = intval($card['switch']);
    $alipay = array_elements(array('switch', 'account', 'partner', 'secret'), $_GPC['alipay']);
    $alipay['switch'] = $alipay['switch'] == 'true';
    $alipay['account'] = trim($alipay['account']);
    $alipay['partner'] = trim($alipay['partner']);
    $alipay['secret'] = trim($alipay['secret']);
    $delivery = array_elements(array('switch'), $_GPC['delivery']);
    $delivery['switch'] = $delivery['switch'] == 'true';
    $line = array_elements(array('switch'), $_GPC['line']);
    $line['switch'] = $line['switch'] == 'true';
    if ($alipay['switch'] && (empty($alipay['account']) || empty($alipay['partner']) || empty($alipay['secret']))) {
        message('请输入完整的支付宝接口信息.');
Exemplo n.º 11
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
load()->model('reply');
load()->model('module');
$dos = array('display', 'post', 'delete');
$do = in_array($do, $dos) ? $do : 'display';
$m = $_GPC['m'];
if (empty($m)) {
    message('错误访问.');
}
uni_user_permission_check('platform_reply_' . $m, true, 'reply');
$module = module_fetch($m);
if (empty($module) || empty($module['isrulefields'])) {
    message('访问无权限.');
}
if (!in_array($m, $sysmods)) {
    define('FRAME', 'ext');
    $types = module_types();
    define('ACTIVE_FRAME_URL', url('home/welcome/ext', array('m' => $m)));
    $frames = buildframes(array(FRAME), $m);
    $frames = $frames[FRAME];
}
$_W['page']['title'] = $module['title'];
load()->model('extension');
if (ext_module_checkupdate($module['name'])) {
    message('系统检测到该模块有更新,请点击“<a href="' . url('extension/module/upgrade', array('m' => $m)) . '">更新模块</a>”后继续使用!', '', 'error');
}
Exemplo n.º 12
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('activity_offline');
$dos = array('introduce', 'clerk', 'post', 'del', 'edit', 'verify');
$do = in_array($do, $dos) ? $do : 'introduce';
$_W['page']['title'] = '功能说明 - 门店营销参数 - 会员营销';
if ($do == 'introduce') {
    template('activity/offline');
    exit;
}
if ($do == 'clerk') {
    $pindex = max(1, intval($_GPC['page']));
    $psize = 30;
    $limit = 'ORDER BY id DESC LIMIT ' . ($pindex - 1) * $psize . ", {$psize}";
    $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('activity_coupon_password') . " WHERE uniacid = :uniacid ", array(':uniacid' => $_W['uniacid']));
    $list = pdo_fetchall("SELECT * FROM " . tablename('activity_coupon_password') . " WHERE uniacid = :uniacid {$limit}", array(':uniacid' => $_W['uniacid']));
    $pager = pagination($total, $pindex, $psize);
    $stores = pdo_getall('activity_stores', array('uniacid' => $_W['uniacid']), array('id', 'business_name', 'branch_name'), 'id');
}
if ($do == 'edit') {
    $id = intval($_GPC['id']);
    if ($id > 0) {
        $sql = 'SELECT * FROM ' . tablename('activity_coupon_password') . " WHERE id = :id AND uniacid = :uniacid";
        $clerk = pdo_fetch($sql, array(':id' => $id, ':uniacid' => $_W['uniacid']));
        if (empty($clerk)) {
            message('店员不存在', referer(), 'error');
Exemplo n.º 13
0
                        $accounts[$account['acid']] = $account['name'];
                    }
                }
            }
        }
    }
    $oauth = pdo_fetchcolumn('SELECT `oauth` FROM ' . tablename('uni_settings') . ' WHERE `uniacid` = :uniacid LIMIT 1', array(':uniacid' => $_W['uniacid']));
    $oauth = iunserializer($oauth) ? iunserializer($oauth) : array();
    if (checksubmit('submit')) {
        $host = rtrim($_GPC['host'], '/');
        if (!empty($host) && !preg_match('/^http(s)?:\\/\\//', $host)) {
            $host = 'http://' . $host;
        }
        $data = array('host' => $host, 'account' => intval($_GPC['oauth']));
        pdo_update('uni_settings', array('oauth' => iserializer($data)), array('uniacid' => $_W['uniacid']));
        cache_delete("unisetting:{$_W['uniacid']}");
        message('设置公众平台oAuth成功', referer(), 'success');
    }
}
if ($do == 'sync') {
    uni_user_permission_check('mc_passport_sync');
    $_W['page']['title'] = '更新粉丝信息 - 公众号选项';
    $setting = uni_setting($_W['uniacid'], array('sync'));
    $sync = $setting['sync'];
    if (checksubmit('submit')) {
        pdo_update('uni_settings', array('sync' => intval($_GPC['sync'])), array('uniacid' => $_W['uniacid']));
        cache_delete("unisetting:{$_W['uniacid']}");
        message('更新设置成功', referer(), 'success');
    }
}
template('mc/passport');
Exemplo n.º 14
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('profile_notify');
$row = pdo_fetchcolumn("SELECT `notify` FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid']));
$notify = iunserializer($row);
if (!is_array($notify)) {
    $notify['sms'] = array();
    $notify['sms']['balance'] = 0;
    $notify['sms']['signature'] = '系统默认';
    $notify['mail'] = array();
}
$dos = array('mail', 'sms', 'wechat');
$do = in_array($do, $dos) ? $do : 'mail';
$_W['page']['title'] = 'APP通知 - 通知参数 - 通知中心';
if ($do == 'mail') {
    $_W['page']['title'] = '邮件通知 - 通知参数 - 通知中心';
    if (checksubmit('submit')) {
        $notify['mail'] = array('username' => $_GPC['username'], 'password' => $_GPC['password'], 'smtp' => $_GPC['smtp'], 'sender' => $_GPC['sender'], 'signature' => $_GPC['signature']);
        $row = array();
        $row['notify'] = iserializer($notify);
        pdo_update('uni_settings', $row, array('uniacid' => $_W['uniacid']));
        if (!empty($_GPC['testsend']) && !empty($_GPC['receiver'])) {
            load()->func('communication');
            $result = ihttp_email($_GPC['receiver'], $_W['account']['name'] . '验证邮件' . date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!');
            if (is_error($result)) {
                message($result['message']);
Exemplo n.º 15
0
    uni_user_permission_check('site_editor_page');
    $page = max(1, intval($_GPC['page']));
    $pagesize = 20;
    $list = pdo_fetchall("SELECT * FROM " . tablename('site_page') . " WHERE type = '1' AND uniacid = :uniacid LIMIT " . ($page - 1) * $pagesize . ',' . $pagesize, array(':uniacid' => $_W['uniacid']));
    if (!empty($list)) {
        foreach ($list as &$row) {
            $row['params'] = json_decode($row['params'], true);
        }
        unset($row);
    }
    $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('site_page') . " WHERE type = '1'");
    $pager = pagination($total, $page, $pagesize);
    template('site/editor');
} elseif ($do == 'uc') {
    $_W['page']['title'] = '会员中心 - 微站功能';
    uni_user_permission_check('site_editor_uc');
    if (!empty($_GPC['wapeditor'])) {
        $params = $_GPC['wapeditor']['params'];
        if (empty($params)) {
            message('请您先设计手机端页面.', '', 'error');
        }
        $params = json_decode(html_entity_decode(urldecode($params)), true);
        if (empty($params)) {
            message('请您先设计手机端页面.', '', 'error');
        }
        $page = $params[0];
        $html = htmlspecialchars_decode($_GPC['wapeditor']['html'], ENT_QUOTES);
        $data = array('uniacid' => $_W['uniacid'], 'multiid' => '0', 'title' => $page['params']['title'], 'description' => $page['params']['description'], 'type' => 3, 'status' => 1, 'params' => json_encode($params), 'html' => $html, 'createtime' => TIMESTAMP);
        $id = pdo_fetchcolumn("SELECT id FROM " . tablename('site_page') . " WHERE uniacid = :uniacid AND type = '3'", array(':uniacid' => $_W['uniacid']));
        if (empty($id)) {
            pdo_insert('site_page', $data);
Exemplo n.º 16
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
load()->model('reply');
$dos = array('mc', 'card', 'module', 'clerk');
$do = in_array($do, $dos) ? $do : 'module';
uni_user_permission_check('platform_cover_' . $do, true, 'cover');
$entries['mc']['title'] = '个人中心入口设置';
$entries['mc']['module'] = 'mc';
$entries['mc']['do'] = '';
$entries['mc']['url'] = url('mc/home', array('i' => $_W['uniacid']));
$entries['mc']['url_show'] = murl('mc/home', array(), true, true);
$entries['card']['title'] = '会员卡入口设置';
$entries['card']['module'] = 'card';
$entries['card']['do'] = '';
$entries['card']['url'] = url('mc/bond/card', array('i' => $_W['uniacid']));
$entries['card']['url_show'] = murl('mc/bond/card', array(), true, true);
$entries['clerk']['title'] = '店员操作入口设置';
$entries['clerk']['module'] = 'clerk';
$entries['clerk']['do'] = '';
$entries['clerk']['url'] = url('clerk/check', array('i' => $_W['uniacid']));
$entries['clerk']['url_show'] = murl('clerk/check', array(), true, true);
if ($do != 'module') {
    $entry = $entries[$do];
    if ($do == 'mc') {
        $_W['page']['title'] = '个人中心入口设置 - 会员中心访问入口- 会员中心';
    }
Exemplo n.º 17
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('wechat_consume');
$dos = array('account', 'record');
$do = in_array($do, $dos) ? $do : 'record';
if ($do == 'record') {
    $acid = $_W['acid'];
    $op = empty($_GPC['op']) ? 'list' : $_GPC['op'];
    if ($op == 'list') {
        $condition = ' WHERE acid = :acid';
        $parma[':acid'] = $acid;
        $cid = intval($_GPC['cid']);
        $card_id = trim($_GPC['card_id']);
        if ($cid > 0) {
            $coupon = pdo_fetch('SELECT title,card_id FROM ' . tablename('coupon') . ' WHERE acid = :acid AND id = :id', array(':acid' => $acid, ':id' => $cid));
            $card_id = $coupon['card_id'];
        } else {
            $coupon = pdo_fetch('SELECT title FROM ' . tablename('coupon') . ' WHERE acid = :acid AND card_id = :card_id', array(':acid' => $acid, ':card_id' => $card_id));
        }
        if (!empty($card_id)) {
            $condition .= ' AND card_id = :card_id';
            $parma[':card_id'] = $card_id;
        }
        $code = trim($_GPC['code']);
        if (!empty($code)) {
            $condition .= " AND code LIKE '%{$code}%'";
Exemplo n.º 18
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_fields');
$dos = array('display', 'post');
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'display') {
    $_W['page']['title'] = '字段管理 - 会员字段管理 - 会员中心';
    if (checksubmit('submit')) {
        if (!empty($_GPC['displayorder'])) {
            $data = array('uniacid' => $_W['uniacid']);
            foreach ($_GPC['displayorder'] as $id => $displayorder) {
                $data['id'] = intval($_GPC['id'][$id]);
                $data['fieldid'] = intval($_GPC['fieldid'][$id]);
                $data['displayorder'] = intval($displayorder);
                $data['available'] = intval($_GPC['available'][$id]);
                if (empty($data['id'])) {
                    $data['title'] = $_GPC['title'][$id];
                    pdo_insert('mc_member_fields', $data);
                } else {
                    pdo_update('mc_member_fields', $data, array('id' => $data['id']));
                }
            }
        }
        message('会员字段更新成功!', referer(), 'success');
    }
    $sql = 'SELECT `f`.`field`, `f`.`id` AS `fid`, `mf`.* FROM ' . tablename('profile_fields') . " AS `f` LEFT JOIN " . tablename('mc_member_fields') . " AS `mf` ON `f`.`id` = `mf`.`fieldid` WHERE `mf`.`uniacid` = :uniacid ORDER BY\r\n\t\t\t`displayorder` DESC";
Exemplo n.º 19
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_mass');
$dos = array('default', 'post', 'send', 'ajax', 'news', 'fans', 'page', 'add', 'material');
$_W['page']['title'] = '微信群发-粉丝管理';
$do = in_array($do, $dos) ? $do : 'default';
if ($do == 'page') {
    template('mc/page');
}
if ($do == 'default') {
    if ($_W['account']['level'] > 2) {
        $groups_data = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid']));
        if (!empty($groups_data)) {
            $groups = iunserializer($groups_data['groups']);
        } else {
            message('未获取到粉丝分组信息,现在去拉取粉丝分组', url('mc/fangroup'), 'info');
        }
    }
    template('mc/mass');
}
if ($do == 'news') {
    $condition = ' WHERE uniacid = :uniacid AND status = 1 AND module = :module';
    $param = array(':uniacid' => $_W['uniacid'], ':module' => 'news');
    if (!empty($_GPC['keyword'])) {
        $condition .= ' AND name LIKE :keyword';
        $param[':keyword'] = "%{$_GPC['keyword']}%";
Exemplo n.º 20
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_business');
$dos = array('display', 'post', 'delete');
$do = in_array($do, $dos) ? $do : 'display';
$_W['page']['title'] = '商家设置-粉丝营销';
if ($do == 'post') {
    $id = intval($_GPC['id']);
    if ($id > 0) {
        $sql = 'SELECT * FROM ' . tablename('activity_stores') . ' WHERE id = :id AND uniacid = :uniacid';
        $item = pdo_fetch($sql, array(':id' => $id, ':uniacid' => $_W['uniacid']));
        if (empty($item)) {
            message('商家不存在', referer(), 'info');
        }
        $item['category'] = iunserializer($item['category']);
        $item['photo_list'] = iunserializer($item['photo_list']);
        $item['opentime'] = explode('-', $item['opentime']);
        $item['open_time_start'] = $item['opentime'][0];
        $item['open_time_end'] = $item['opentime'][1];
    } else {
        $item['open_time_start'] = '8:00';
        $item['open_time_end'] = '24:00';
    }
    if (checksubmit('submit')) {
        $insert = array();
        $insert['uniacid'] = intval($_W['uniacid']);
Exemplo n.º 21
0
                        pdo_insert('site_styles_vars', array('content' => $value, 'templateid' => $templateid, 'styleid' => $styleid, 'variable' => $variable, 'description' => $desc, 'uniacid' => $_W['uniacid']));
                    }
                }
            }
        }
        if (!empty($styles)) {
            pdo_query("DELETE FROM " . tablename('site_styles_vars') . " WHERE variable IN ('" . implode("','", array_keys($styles)) . "') AND styleid = :styleid AND uniacid = '{$_W['uniacid']}'", array(':styleid' => $styleid));
        }
        pdo_update('site_styles', array('name' => $_GPC['name']), array('id' => $styleid));
        message('更新风格成功!', url('site/style/template'), 'success');
    }
    $systemtags = array('imgdir', 'indexbgcolor', 'indexbgimg', 'indexbgextra', 'fontfamily', 'fontsize', 'fontcolor', 'fontnavcolor', 'linkcolor', 'css');
    template('site/style');
}
if ($do == 'module') {
    uni_user_permission_check('site_style_module');
    $_W['page']['title'] = '模块扩展模板说明 - 网站风格设置 - 微站功能';
    if (empty($_W['isfounder'])) {
        message('您无权进行该操作!');
    }
    $setting = uni_setting($_W['uniacid'], array('default_site'));
    $styleid = pdo_fetchcolumn("SELECT styleid FROM " . tablename('site_multi') . " WHERE id = :id", array(':id' => $setting['default_site']));
    $templateid = pdo_fetchcolumn("SELECT templateid FROM " . tablename('site_styles') . " WHERE id = :id", array(':id' => $styleid));
    $ts = uni_templates();
    $currentTemplate = !empty($ts[$templateid]) ? $ts[$templateid]['name'] : 'default';
    $modules = uni_modules();
    $path = IA_ROOT . '/addons';
    if (is_dir($path)) {
        if ($handle = opendir($path)) {
            while (false !== ($modulepath = readdir($handle))) {
                if ($modulepath != '.' && $modulepath != '..' && !empty($modules[$modulepath])) {
Exemplo n.º 22
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_uc');
$_W['page']['title'] = 'UC站点整合 - 会员中心选项 - 会员中心';
$uc = pdo_fetch("SELECT `uc`,`passport` FROM " . tablename('uni_settings') . " WHERE uniacid = :weid", array(':weid' => $_W['weid']));
$uc = @iunserializer($uc['uc']);
if (!is_array($uc)) {
    $uc = array();
}
if (checksubmit('submit')) {
    $rec = array();
    $uc['status'] = intval($_GPC['status']);
    if ($uc['status'] == '1') {
        $connect = $_GPC['connect'];
        $uc['connect'] = trim($_GPC['connect']);
        $uc['title'] = empty($_GPC['title']) ? message('请填写正确的站点名称!', referer(), 'error') : trim($_GPC['title']);
        $uc['appid'] = empty($_GPC['appid']) ? message('请填写正确的应用id!', referer(), 'error') : intval($_GPC['appid']);
        $uc['key'] = empty($_GPC['key']) ? message('请填写与UCenter的通信密钥!', referer(), 'error') : trim($_GPC['key']);
        $uc['charset'] = empty($_GPC['charset']) ? message('请填写UCenter的字符集!', referer(), 'error') : trim($_GPC['charset']);
        if ($connect == 'mysql') {
            $uc['dbhost'] = empty($_GPC['dbhost']) ? message('请填写UCenter数据库主机地址!', referer(), 'error') : trim($_GPC['dbhost']);
            $uc['dbuser'] = empty($_GPC['dbuser']) ? message('请填写UCenter数据库用户名!', referer(), 'error') : trim($_GPC['dbuser']);
            $uc['dbpw'] = empty($_GPC['dbpw']) ? message('请填写UCenter数据库密码!', referer(), 'error') : trim($_GPC['dbpw']);
            $uc['dbname'] = empty($_GPC['dbname']) ? message('请填写UCenter数据库名称!', referer(), 'error') : trim($_GPC['dbname']);
            $uc['dbcharset'] = empty($_GPC['dbcharset']) ? message('请填写UCenter数据库字符集!', referer(), 'error') : trim($_GPC['dbcharset']);
            $uc['dbtablepre'] = empty($_GPC['dbtablepre']) ? message('请填写UCenter数据表前缀!', referer(), 'error') : trim($_GPC['dbtablepre']);
Exemplo n.º 23
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_broadcast');
$dos = array('display', 'send');
if ($_W['isajax']) {
    $post = $_GPC['__input'];
    if (!empty($post['method'])) {
        $do = $post['method'];
    }
}
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'display') {
    $_W['page']['title'] = '发送通知消息 - 群发消息&通知 - 通知中心';
    if ($_W['ispost']) {
        $sql = 'SELECT COUNT(*) FROM ' . tablename('mc_members') . ' WHERE `uniacid`=:uniacid';
        $pars = array();
        $pars[':uniacid'] = $_W['uniacid'];
        if (!empty($_GPC['group'])) {
            $sql .= ' AND `groupid`=:group';
            $pars[':group'] = intval($_GPC['group']);
        }
        if (!empty($_GPC['username'])) {
            $sql .= ' AND `nickname` LIKE :nickname';
            $pars[':nickname'] = "%{$_GPC['username']}%";
        }
        if ($_GPC['type'] == 'email') {
Exemplo n.º 24
0
<?php

/**
 * [Weizan System] Copyright (c) 2014 012WZ.COM
 * Weizan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('platform_url2qr');
$dos = array('display', 'change', 'qr', 'chat');
$do = !empty($_GPC['do']) && in_array($do, $dos) ? $do : 'display';
load()->model('account');
if ($do == 'display') {
    template('platform/url2qr');
}
if ($do == 'change') {
    if ($_W['ispost']) {
        load()->func('communication');
        $longurl = trim($_GPC['longurl']);
        $token = WeAccount::token(WeAccount::TYPE_WEIXIN);
        $url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token={$token}";
        $send = array();
        $send['action'] = 'long2short';
        $send['long_url'] = $longurl;
        $response = ihttp_request($url, json_encode($send));
        if (is_error($response)) {
            $result = error(-1, "访问公众平台接口失败, 错误: {$response['message']}");
        }
        $result = @json_decode($response['content'], true);
        if (empty($result)) {
            $result = error(-1, "接口调用失败, 元数据: {$response['meta']}");
        } elseif (!empty($result['errcode'])) {
Exemplo n.º 25
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_group');
$dos = array('display');
$do = in_array($do, $dos) ? $do : 'display';
if ($do == 'display') {
    if (checksubmit()) {
        $data = array('user_reg' => intval($_GPC['user_reg']), 'verify_mobile' => intval($_GPC['verify_mobile']), 'verify_email' => intval($_GPC['verify_email']), 'grant_credit_rate' => intval($_GPC['grant_credit_rate']), 'consume_credit_rate' => intval($_GPC['consume_credit_rate']), 'consume_credit_max' => intval($_GPC['consume_credit_max']));
        $data = iserializer($data);
        pdo_update('uni_settings', array('creditrule' => $data), array('uniacid' => $_W['uniacid']));
        message('更新积分规则成功', referer(), 'success');
    }
    $setting = uni_setting($_W['uniacid'], '*', true);
    $item = $setting['creditrule'];
}
template('mc/creditrule');
Exemplo n.º 26
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_card');
$_W['page']['title'] = '会员卡管理 - 会员中心';
$dos = array('display', 'manage', 'delete', 'coupon', 'submit', 'modal', 'record', 'notice', 'care', 'credit', 'recommend', 'stat');
$do = in_array($do, $dos) ? $do : 'display';
load()->model('mc');
$setting = pdo_fetch("SELECT * FROM " . tablename('mc_card') . " WHERE uniacid = '{$_W['uniacid']}'");
if ($do == 'display') {
    if ($_W['ispost'] && $_W['isajax']) {
        $sql = 'SELECT `uniacid` FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid";
        $status = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
        if (empty($status)) {
            $open = array('uniacid' => $_W['uniacid']);
            pdo_insert('mc_card', $open);
        }
        $data['status'] = intval($_GPC['status']);
        if (false === pdo_update('mc_card', $data, array('uniacid' => $_W['uniacid']))) {
            exit('error');
        }
        exit('success');
    }
    $groups = $_W['account']['groups'];
    $fields = mc_fields();
    if (!empty($setting)) {
        if (!empty($setting['color'])) {
Exemplo n.º 27
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('mc_creditmanage');
$_W['page']['title'] = '积分列表 - 会员积分管理 - 会员中心';
$dos = array('display', 'manage', 'modal', 'credit_record', 'stat');
$do = in_array($do, $dos) ? $do : 'display';
$creditnames = uni_setting($_W['uniacid'], array('creditnames'));
$creditnames = $creditnames['creditnames'];
if ($creditnames) {
    foreach ($creditnames as $index => $creditname) {
        if (empty($creditname['enabled'])) {
            unset($creditnames[$index]);
        }
    }
    $select_credit = implode(', ', array_keys($creditnames));
} else {
    $select_credit = '';
}
if ($do == 'display') {
    $where = ' WHERE uniacid = :uniacid ';
    $params = array(':uniacid' => $_W['uniacid']);
    $type = intval($_GPC['type']);
    if (!$type) {
        $type = intval($_GPC['cookietype']);
    } else {
        isetcookie('cookietype', $type, 86400 * 7);
Exemplo n.º 28
0
<?php

/**
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('platform_menu');
$current['designer'] = ' class="current"';
$acc = account_fetch($_W['acid']);
$acc = array_elements(array('name', 'acid', 'level'), $acc);
$dos = array('display', 'save', 'remove', 'refresh', 'search_key');
if ($_W['isajax']) {
    if ($do == 'search_key') {
        $condition = '';
        $key_word = trim($_GPC['key_word']);
        if (!empty($key_word)) {
            $condition = " AND content LIKE '%{$key_word}%' ";
        }
        $data = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . " WHERE (uniacid = 0 OR uniacid = :uniacid) AND status != 0 " . $condition . ' ORDER BY uniacid DESC,displayorder DESC LIMIT 15', array(':uniacid' => $_W['uniacid']));
        $exit_da = array();
        if (!empty($data)) {
            foreach ($data as $da) {
                $exit_da[] = $da['content'];
            }
        }
        exit(json_encode($exit_da));
    }
    $post = $_GPC['__input'];
    if (!empty($post['method'])) {
        $do = $post['method'];
Exemplo n.º 29
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('site_article');
$do = in_array($do, array('display', 'post', 'delete')) ? $do : 'display';
$category = pdo_fetchall("SELECT id,parentid,name FROM " . tablename('site_category') . " WHERE uniacid = '{$_W['uniacid']}' ORDER BY parentid ASC, displayorder ASC, id ASC ", array(), 'id');
$parent = array();
$children = array();
if (!empty($category)) {
    $children = '';
    foreach ($category as $cid => $cate) {
        if (!empty($cate['parentid'])) {
            $children[$cate['parentid']][] = $cate;
        } else {
            $parent[$cate['id']] = $cate;
        }
    }
}
if ($do == 'display') {
    $pindex = max(1, intval($_GPC['page']));
    $psize = 20;
    $condition = '';
    $params = array();
    if (!empty($_GPC['keyword'])) {
        $condition .= " AND title LIKE :keyword";
        $params[':keyword'] = "%{$_GPC['keyword']}%";
    }
Exemplo n.º 30
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
uni_user_permission_check('material_mass');
$_W['page']['title'] = '定时群发-微信素材';
$dos = array('list', 'post', 'cron', 'send', 'del');
$do = in_array($do, $dos) ? $do : 'list';
if ($do == 'list') {
    set_time_limit(0);
    load()->model('cloud');
    $cloud = cloud_prepare();
    $cloud_error = 0;
    if (is_error($cloud)) {
        $cloud_error = 1;
    }
    $groups = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid']));
    $groups = iunserializer($groups['groups']);
    $time = strtotime(date('Y-m-d'));
    $record = pdo_fetchall('SELECT * FROM ' . tablename('mc_mass_record') . ' WHERE uniacid = :uniacid AND sendtime >= :time ORDER BY sendtime ASC LIMIT 7', array(':uniacid' => $_W['uniacid'], ':time' => $time), 'sendtime');
    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']);