function cron_run($id) { global $_W; $cron = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($cron)) { return false; } $extra = array(); $extra['Host'] = $_SERVER['HTTP_HOST']; load()->func('communication'); $urlset = parse_url($_W['siteurl']); $urlset = pathinfo($urlset['path']); $response = ihttp_request('http://127.0.0.1/' . $urlset['dirname'] . '/' . url('cron/entry', array('id' => $cron['cloudid'])), array(), $extra); $response = json_decode($response['content'], true); if (is_error($response['message'])) { return $response['message']; } else { cron_setnexttime($cron); $cron_new = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($cron_new)) { return true; } if ($cron_new['status'] != $cron['status'] || $cron_new['lastruntime'] != $cron['lastruntime'] || $cron_new['nextruntime'] != $cron['nextruntime']) { load()->model('cloud'); $cron_new['id'] = $cron_new['cloudid']; $status = cloud_cron_update($cron_new); if (is_error($status)) { return $status; } } } return true; }
function card_credit_set() { global $_W; $set = array(); $set = pdo_get('mc_card_credit_set', array('uniacid' => $_W['uniacid'])); if (!empty($set)) { $set['sign'] = iunserializer($set['sign']); $set['share'] = iunserializer($set['share']); } return $set; }
function clerk_check() { global $_W; if (empty($_W['openid'])) { return error(-1, '获取粉丝openid失败'); } $data = pdo_get('activity_coupon_password', array('uniacid' => $_W['uniacid'], 'openid' => $_W['fans']['from_user'])); if (empty($data)) { return error(-1, '不是操作店员'); } return $data; }
function card_member($uid = 0) { global $_W; $uid = intval($uid); if ($uid <= 0) { $uid = $_W['member']['uid']; } $data = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $uid)); if (empty($data)) { return error(-1, '会员还没有领取会员卡'); } return $data; }
<?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', 'post', 'delete', 'set'); $do = in_array($do, $dos) ? $do : 'display'; cache_delete("uniaccount:{$_W['uniacid']}"); if ($do == 'display') { $_W['page']['title'] = '会员组列表 - 会员组 - 会员中心'; $setting = pdo_get('uni_settings', array('uniacid' => $_W['uniacid']), array('grouplevel')); if (checksubmit('submit')) { $grouplevel = intval($_GPC['grouplevel']); pdo_update('uni_settings', array('grouplevel' => $grouplevel), array('uniacid' => $_W['uniacid'])); cache_delete("unisetting:{$_W['uniacid']}"); foreach ($_GPC['credit'] as $key => $value) { $key = intval($key); $data['title'] = trim($_GPC['title'][$key]); $data['credit'] = intval($_GPC['credit'][$key]); pdo_update('mc_groups', $data, array('groupid' => $key, 'uniacid' => $_W['uniacid'])); unset($data); } message('用户组更新成功!', referer(), 'success'); } $list = pdo_fetchall("SELECT * FROM " . tablename('mc_groups') . " WHERE uniacid = :uniacid ORDER BY isdefault DESC,credit ASC", array(':uniacid' => $_W['uniacid'])); $count = pdo_fetchall('SELECT groupid,COUNT(*) AS num FROM ' . tablename('mc_members') . ' WHERE uniacid = :uniacid GROUP BY groupid', array(':uniacid' => $_W['uniacid']), 'groupid'); } if ($do == 'post') {
<?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', 'detail'); $do = in_array($do, $dos) ? $do : 'display'; if ($do == 'display') { $profile = mc_fetch($_W['member']['uid'], array('nickname', 'avatar', 'mobile', 'groupid')); $mcgroups = mc_groups(); $profile['group'] = $mcgroups[$profile['groupid']]; $stores = pdo_fetchall('SELECT * FROM ' . tablename('activity_stores') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid'])); } if ($do == 'detail') { $id = intval($_GPC['id']); $store = pdo_get('activity_stores', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($store)) { message('门店不存在或已删除', referer(), 'error'); } $store['photo_list'] = iunserializer($store['photo_list']); $store['category'] = iunserializer($store['category']); } template('mc/store');
if (empty($user)) { exit(json_encode(array('valid' => true))); } else { exit(json_encode(array('valid' => false))); } } if (checksubmit('form')) { $realname = trim($_GPC['realname']) ? trim($_GPC['realname']) : message('姓名不能为空'); $mobile = trim($_GPC['mobile']) ? trim($_GPC['mobile']) : message('手机不能为空'); $user = pdo_get('mc_members', array('uniacid' => $_W['uniacid'], 'mobile' => $mobile)); if (!empty($user)) { message('手机号被占用'); } $email = trim($_GPC['email']); if (!empty($email)) { $user = pdo_get('mc_members', array('uniacid' => $_W['uniacid'], 'email' => $email)); if (!empty($user)) { message('邮箱被占用'); } } $salt = random(8); $data = array('uniacid' => $_W['uniacid'], 'realname' => $realname, 'mobile' => $mobile, 'email' => $email, 'salt' => $salt, 'password' => md5(trim($_GPC['password']) . $salt . $_W['config']['setting']['authkey']), 'credit1' => intval($_GPC['credit1']), 'credit2' => intval($_GPC['credit2']), 'groupid' => intval($_GPC['groupid']), 'createtime' => TIMESTAMP); pdo_insert('mc_members', $data); $uid = pdo_insertid(); message('添加会员成功,将进入编辑页面', url('mc/member/post', array('uid' => $uid)), 'success'); } } if ($do == 'group') { if ($_W['isajax']) { $id = intval($_GPC['id']); $group = $_W['account']['groups'][$id];
public function receive() { global $_W; if ($this->message['event'] == 'subscribe' && !empty($this->message['ticket'])) { $sceneid = $this->message['scene']; $acid = $this->acid; $uniacid = $this->uniacid; $row = pdo_fetch("SELECT id, name, acid FROM " . tablename('qrcode') . " WHERE uniacid = :aid AND acid = :acid AND qrcid = :qrcid", array(':aid' => $uniacid, ':acid' => $acid, ':qrcid' => $sceneid)); if (empty($row)) { $row = pdo_fetch("SELECT id, name, acid FROM " . tablename('qrcode') . " WHERE uniacid = :aid AND acid = :acid AND scene_str = :scene_str", array(':aid' => $uniacid, ':acid' => $acid, ':scene_str' => $sceneid)); } $insert = array('uniacid' => $_W['uniacid'], 'acid' => $row['acid'], 'qid' => $row['id'], 'openid' => $this->message['from'], 'type' => 1, 'qrcid' => intval($sceneid), 'scene_str' => $sceneid, 'name' => $row['name'], 'createtime' => TIMESTAMP); pdo_insert('qrcode_stat', $insert); } elseif ($this->message['event'] == 'SCAN') { $sceneid = $this->message['scene']; $acid = $this->acid; $uniacid = $this->uniacid; $row = pdo_fetch("SELECT id, name, acid FROM " . tablename('qrcode') . " WHERE uniacid = :aid AND acid = :acid AND qrcid = :qrcid", array(':aid' => $uniacid, ':acid' => $acid, ':qrcid' => $sceneid)); if (empty($row)) { $row = pdo_fetch("SELECT id, name, acid FROM " . tablename('qrcode') . " WHERE uniacid = :aid AND acid = :acid AND scene_str = :scene_str", array(':aid' => $uniacid, ':acid' => $acid, ':scene_str' => $sceneid)); } $insert = array('uniacid' => $_W['uniacid'], 'acid' => $row['acid'], 'qid' => $row['id'], 'openid' => $this->message['from'], 'type' => 2, 'qrcid' => intval($sceneid), 'scene_str' => $sceneid, 'name' => $row['name'], 'createtime' => TIMESTAMP); pdo_insert('qrcode_stat', $insert); } $stat_setting = uni_setting($_W['uniacid'], 'stat'); $stat_setting = $stat_setting['stat']; if (!is_array($stat_setting) || empty($stat_setting)) { $stat_setting = array(); $stat_setting['msg_maxday'] = 0; $stat_setting['msg_history'] = 1; $stat_setting['use_ratio'] = 1; } if (!empty($stat_setting['msg_maxday']) && $stat_setting['msg_maxday'] > 0) { pdo_delete('stat_msg_history', " createtime < " . TIMESTAMP . ' - ' . $stat_setting['msg_maxday'] * 86400); } if ($stat_setting['msg_history']) { switch ($this->message['type']) { case 'text': $content = iserializer(array('content' => $this->message['content'], 'original' => $this->message['original'], 'redirection' => $this->message['redirection'], 'source' => $this->message['source'])); break; case 'image': $content = $this->message['url']; break; case 'voice': $content = iserializer(array('media' => $this->message['media'], 'format' => $this->message['format'])); break; case 'video': $content = iserializer(array('media' => $this->message['media'], 'thumb' => $this->message['thumb'])); break; case 'location': $content = iserializer(array('x' => $this->message['location_x'], 'y' => $this->message['location_y'])); break; case 'link': $content = iserializer(array('title' => $this->message['title'], 'description' => $this->message['description'], 'url' => $this->message['url'])); break; case 'subscribe': $content = iserializer(array('scene' => $this->message['scene'], 'ticket' => $this->message['ticket'])); break; case 'qr': $content = iserializer(array('scene' => $this->message['scene'], 'ticket' => $this->message['ticket'])); break; case 'click': $content = $this->message['content']; break; case 'view': $content = $this->message['url']; break; case 'trace': $content = iserializer(array('location_x' => $this->message['location_x'], 'location_y' => $this->message['location_y'], 'precision' => $this->message['precision'])); break; default: $content = $this->message['content']; } pdo_insert('stat_msg_history', array('uniacid' => $_W['uniacid'], 'module' => $this->params['module'], 'from_user' => $this->message['from'], 'rid' => intval($this->params['rule']), 'kid' => $this->keyword['id'], 'message' => $content, 'type' => $this->message['type'], 'createtime' => $this->message['time'])); } if (!empty($stat_setting['use_ratio'])) { if (!empty($this->params['rule'])) { $rule_stat_found = pdo_get('stat_rule', array('rid' => $this->params['rule'], 'createtime' => strtotime(date('Y-m-d')))); if (empty($rule_stat_found)) { pdo_insert('stat_rule', array('uniacid' => $_W['uniacid'], 'rid' => $this->params['rule'], 'createtime' => strtotime(date('Y-m-d')), 'hit' => 1, 'lastupdate' => $this->message['time'])); } else { pdo_query("UPDATE " . tablename('stat_rule') . " SET hit = hit + 1, lastupdate = '" . TIMESTAMP . "' WHERE rid = :rid AND createtime = :createtime", array(':rid' => $this->params['rule'], ':createtime' => strtotime(date('Y-m-d')))); } } if (!empty($this->keyword['id'])) { $keyword_stat_found = pdo_get('stat_keyword', array('rid' => $this->params['rule'], 'createtime' => strtotime(date('Y-m-d')))); if (empty($keyword_stat_found)) { pdo_insert('stat_keyword', array('uniacid' => $_W['uniacid'], 'rid' => $this->params['rule'], 'kid' => $this->keyword['id'], 'createtime' => strtotime(date('Y-m-d')), 'hit' => 1, 'lastupdate' => $this->message['time'])); } else { pdo_query("UPDATE " . tablename('stat_keyword') . " SET hit = hit + 1, lastupdate = '" . TIMESTAMP . "' WHERE kid = :kid AND createtime = :createtime", array(':kid' => $this->keyword['id'], ':createtime' => strtotime(date('Y-m-d')))); } } } }
$acc = WeAccount::create(); $data = $acc->fansSendAll($group, $type, $media['media_id']); if (is_error($data)) { exit($data['message']); } $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']); } $record = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'groupname' => $groups[$group]['name'], 'fansnum' => $groups[$group]['count'], 'msgtype' => $type, 'group' => $group, 'attach_id' => $id, 'status' => 0, 'type' => 0, 'sendtime' => TIMESTAMP, 'createtime' => TIMESTAMP); pdo_insert('mc_mass_record', $record); exit('success'); } if ($do == 'del') { $id = intval($_GPC['id']); $media = pdo_get('wechat_attachment', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($media)) { exit('素材不存在或已经删除'); } $media_id = trim($media['media_id']); $acc = WeAccount::create(); $data = $acc->delMaterial($media_id); if (is_error($data)) { exit($data['message']); } else { pdo_delete('wechat_attachment', array('uniacid' => $_W['uniacid'], 'id' => $id)); if ($type == 'image' || $type == 'voice') { $path = ATTACHMENT_ROOT . "/{$media['type']}s/{$_W['uniacid']}/material/{$media['$media_id']}"; @unlink($path); } elseif ($type == 'news') { pdo_delete('wechat_news', array('uniacid' => $_W['uniacid'], 'attach_id' => $id));
* 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('use'); $do = in_array($do, $dos) ? $do : 'use'; if ($do == 'use') { $id = intval($_GPC['id']); $code = trim($_GPC['code']); if ($id == 0 || empty($code)) { message('参数错误'); } $record = pdo_get('coupon_record', array('acid' => $_W['acid'], 'id' => $id, 'code' => $code)); if (empty($record)) { message('卡券领取记录不存在'); } $card = pdo_get('coupon', array('acid' => $_W['acid'], 'card_id' => $record['card_id'])); if (empty($card)) { message('卡券不存在或已删除'); } $card['date_info'] = iunserializer($card['date_info']); if (checksubmit()) { load()->classs('coupon'); $coupon = new coupon($_W['acid']); if (is_null($coupon)) { message('系统错误'); } $status = $coupon->ConsumeCode(array('code' => $record['code'])); if (is_error($status)) { message($status['message']); } pdo_update('coupon_record', array('status' => 3, 'clerk_id' => $clerk['id'], 'clerk_name' => $clerk['name']), array('acid' => $_W['acid'], 'code' => $record['code']));
if (empty($uniacid_arr)) { exit('非法访问'); } $receiver = trim($_GPC['receiver']); if ($receiver == '') { exit('请输入邮箱或手机号'); } elseif (preg_match(REGULAR_MOBILE, $receiver)) { $receiver_type = 'mobile'; } elseif (preg_match("/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\$/", $receiver)) { $receiver_type = 'email'; } else { exit('您输入的邮箱或手机号格式错误'); } $table = trim($_GPC['table']); if (!empty($table)) { $isexist = pdo_get($table, array($receiver_type => $receiver, 'uniacid' => $_W['uniacid'])); if (!empty($isexist)) { exit('手机或邮箱已被注册'); } } $sql = 'DELETE FROM ' . tablename('uni_verifycode') . ' WHERE `createtime`<' . (TIMESTAMP - 1800); pdo_query($sql); $sql = 'SELECT * FROM ' . tablename('uni_verifycode') . ' WHERE `receiver`=:receiver AND `uniacid`=:uniacid'; $pars = array(); $pars[':receiver'] = $receiver; $pars[':uniacid'] = $_W['uniacid']; $row = pdo_fetch($sql, $pars); $record = array(); if (!empty($row)) { if ($row['total'] >= 5) { exit('您的操作过于频繁,请稍后再试');
$drawing->draw(); } header('Content-Type: image/png'); header('Content-Disposition: inline; filename="barcode.png"'); $drawing->finish(BCGDrawing::IMG_FORMAT_PNG); } if ($do == 'qrcode') { require_once '../framework/library/qrcode/phpqrcode.php'; $errorCorrectionLevel = "L"; $matrixPointSize = "8"; $cardsn = $_W['member']['uid']; QRcode::png($cardsn, false, $errorCorrectionLevel, $matrixPointSize); } if ($do == 'record') { $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid']), array('nums_text', 'times_text')); $card = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid'])); $type = trim($_GPC['type']); $where = ' WHERE uniacid = :uniacid AND uid = :uid AND type = :type'; $params = array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':type' => $type); $pindex = max(1, intval($_GPC['page'])); $psize = 20; $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_record') . $where, $params); $limit = ' ORDER BY id DESC LIMIT ' . ($pindex - 1) * $psize . ', ' . $psize; $data = pdo_fetchall('SELECT * FROM ' . tablename('mc_card_record') . $where . $limit, $params); $pager = pagination($total, $pindex, $psize, '', array('before' => 0, 'after' => 0, 'ajaxcallback' => '')); } if ($do == 'mobile') { $profile = mc_fetch($_W['member']['uid'], array('mobile')); $mobile_exist = empty($profile['mobile']) ? 0 : 1; if (checksubmit('submit')) { if ($mobile_exist == 1) {
$status = cron_add($cron); if (is_error($status)) { $message .= "{$row['time']}的群发任务同步到云服务失败,请手动同步<br>"; $cron_status = 1; } else { pdo_update('mc_mass_record', array('cron_id' => $status), array('id' => $insert_id)); } } if ($cron_status) { message(error(-1000, $message), '', 'ajax'); } message(error(0, 'success'), '', 'ajax'); } if ($do == 'cron') { $id = intval($_GPC['id']); $record = pdo_get('mc_mass_record', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($record)) { message('群发任务不存在或已删除', referer(), 'error'); } load()->func('cron'); $cron = array('uniacid' => $_W['uniacid'], 'name' => date('Y-m-d', $record['sendtime']) . "微信群发任务", 'filename' => 'mass', 'type' => 1, 'lastruntime' => $record['sendtime'], 'extra' => $record['id'], 'module' => 'task', 'status' => 1); $status = cron_add($cron); if (is_error($status)) { message($status['message'], referer(), 'error'); } pdo_update('mc_mass_record', array('cron_id' => $status), array('uniacid' => $_W['uniacid'], 'id' => $id)); message('同步到云服务成功', referer(), 'success'); } if ($do == 'send') { $_W['page']['title'] = '群发记录-微信群发'; $pindex = max(1, intval($_GPC['page']));
<?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'); $dos = array('sign_display', 'sign', 'sign_record', 'recommend', 'notice', 'sign_strategy', 'share'); $do = in_array($do, $dos) ? $do : 'sign_display'; load()->model('user'); load()->model('card'); $notice_count = card_notice_stat(); $setting = pdo_get('mc_card', array('uniacid' => $_W['uniacid'])); if ($do == 'sign_display') { $title = '签到-会员卡'; $credits = mc_credit_fetch($_W['member']['uid']); $time = intval($_GPC['e']) ? intval($_GPC['e']) : TIMESTAMP; $pretime = strtotime('-1 month', $time); $nexttime = strtotime('+1 month', $time); $year = date('Y', $time); $month = date('m', $time); $day = date('d', $time); $record = pdo_fetch('SELECT id FROM ' . tablename('mc_card_sign_record') . ' WHERE uniacid = :uniacid AND uid = :uid AND addtime >= :addtime', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':addtime' => strtotime(date('Y-m-d')))); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_sign_record') . ' WHERE uniacid = :uniacid AND uid = :uid', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'])); $month_record = pdo_fetchall('SELECT id,addtime FROM ' . tablename('mc_card_sign_record') . ' WHERE uniacid = :uniacid AND uid = :uid AND addtime >= :starttime AND addtime <= :endtime', array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':starttime' => strtotime(date('Y-m', $time)), ':endtime' => strtotime('+1 month', strtotime(date('Y-m', $time))))); $flags = array(); if (!empty($month_record)) { foreach ($month_record as $li) { $flags[] = date('j', $li['addtime']); } }
exit; } if ($account_info['authorizer_info']['service_type_info'] = '0' || $account_info['authorizer_info']['service_type_info'] == '1') { if ($account_info['authorizer_info']['verify_type_info'] > -1) { $level = '3'; } else { $level = '1'; } } elseif ($account_info['authorizer_info']['service_type_info'] = '2') { if ($account_info['authorizer_info']['verify_type_info'] > -1) { $level = '4'; } else { $level = '2'; } } $account_found = pdo_get('account_wechats', array('account' => $account_info['authorizer_info']['alias'])); if (!empty($account_found)) { message('公众号已经在系统中接入,是否要更改为授权接入方式? <div><a class="btn btn-primary" href="' . url('account/auth/confirm', array('level' => $level, 'auth_refresh_token' => $auth_refresh_token, 'auth_appid' => $auth_appid, 'acid' => $account_found['acid'], 'uniacid' => $account_found['uniacid'])) . '">是</a> <a class="btn btn-default" href="index.php">否</a></div>', '', 'tips'); } $account_insert = array('name' => $account_info['authorizer_info']['nick_name'], 'description' => '', 'groupid' => 0); if (!pdo_insert('uni_account', $account_insert)) { message('授权登录新建公众号失败,请重试', url('account/display'), 'error'); } $uniacid = pdo_insertid(); $template = pdo_fetch('SELECT id,title FROM ' . tablename('site_templates') . " WHERE name = 'default'"); $style_insert = array('uniacid' => $uniacid, 'templateid' => $template['id'], 'name' => $template['title'] . '_' . random(4)); pdo_insert('site_styles', $style_insert); $styleid = pdo_insertid(); $multi_insert = array('uniacid' => $uniacid, 'title' => $account_insert['name'], 'styleid' => $styleid); pdo_insert('site_multi', $multi_insert); $multi_id = pdo_insertid();
public function payResult($params) { global $_W; load()->model('mc'); $order = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE tid = :tid", array(':tid' => $params['tid'])); if (empty($order['status'])) { $fee = $params['fee']; $total_fee = $fee; $data = array('status' => $params['result'] == 'success' ? 1 : -1); if ($params['type'] == 'wechat') { $data['transid'] = $params['tag']['transaction_id']; $params['user'] = mc_openid2uid($params['user']); } pdo_update('mc_credits_recharge', $data, array('tid' => $params['tid'])); if ($params['result'] == 'success' && $params['from'] == 'notify') { $paydata = array('wechat' => '微信', 'alipay' => '支付宝', 'baifubao' => '百付宝', 'unionpay' => '银联'); if (empty($order['type']) || $order['type'] == 'credit') { $setting = uni_setting($_W['uniacid'], array('creditbehaviors', 'recharge')); $credit = $setting['creditbehaviors']['currency']; if (empty($credit)) { message('站点积分行为参数配置错误,请联系服务商', '', 'error'); } else { $recharge = $setting['recharge']; $add_fee = 0; if (!empty($recharge)) { $back = -1; foreach ($recharge as $k => $li) { if ($li['recharge'] <= $fee) { $back = $k; } } if (!empty($recharge[$back])) { $add_fee = $recharge[$back]['back']; $total_fee = $add_fee + $fee; $add_str = ",满足 充{$recharge[$back]['recharge']}返{$recharge[$back]['back']},返余额{$recharge[$back]['back']}元,本次操作共增加余额{$total_fee}元"; } } $record[] = $params['user']; $record[] = '用户通过' . $paydata[$params['type']] . '充值' . $fee . $add_str; mc_credit_update($order['uid'], $credit, $total_fee, $record); $remark = '用户通过' . $paydata[$params['type']] . '充值' . $fee . $add_str; mc_notice_recharge($order['openid'], $order['uid'], $total_fee, '', $remark); } } if ($order['type'] == 'card_nums') { $member_card = pdo_get('mc_card_members', array('uniacid' => $order['uniacid'], 'uid' => $order['uid'])); $total_num = $member_card['nums'] + $order['tag']; pdo_update('mc_card_members', array('nums' => $total_num), array('uniacid' => $order['uniacid'], 'uid' => $order['uid'])); $log = array('uniacid' => $order['uniacid'], 'uid' => $order['uid'], 'type' => 'nums', 'fee' => $params['fee'], 'model' => '1', 'tag' => $order['tag'], 'note' => date('Y-m-d H:i') . "通过{$paydata[$params['type']]}充值{$params['fee']}元,返{$order['tag']}次,总共剩余{$total_num}次", 'addtime' => TIMESTAMP); pdo_insert('mc_card_record', $log); $type = pdo_fetchcolumn('SELECT nums_text FROM ' . tablename('mc_card') . ' WHERE uniacid = :uniacid', array(':uniacid' => $order['uniacid'])); $total_num = $member_card['nums'] + $order['tag']; mc_notice_nums_plus($order['openid'], $type, $order['tag'], $total_num); } if ($order['type'] == 'card_times') { $member_card = pdo_get('mc_card_members', array('uniacid' => $order['uniacid'], 'uid' => $order['uid'])); if ($member_card['endtime'] > TIMESTAMP) { $endtime = $member_card['endtime'] + $order['tag'] * 86400; } else { $endtime = strtotime($order['tag'] . 'days'); } pdo_update('mc_card_members', array('endtime' => $endtime), array('uniacid' => $order['uniacid'], 'uid' => $order['uid'])); $log = array('uniacid' => $order['uniacid'], 'uid' => $order['uid'], 'type' => 'times', 'model' => '1', 'fee' => $params['fee'], 'tag' => $order['tag'], 'note' => date('Y-m-d H:i') . "通过{$paydata[$params['type']]}充值{$params['fee']}元,返{$order['tag']}天,充值后到期时间:" . date('Y-m-d', $endtime), 'addtime' => TIMESTAMP); pdo_insert('mc_card_record', $log); $type = pdo_fetchcolumn('SELECT times_text FROM ' . tablename('mc_card') . ' WHERE uniacid = :uniacid', array(':uniacid' => $order['uniacid'])); $endtime = date('Y-m-d', $endtime); mc_notice_times_plus($order['openid'], $member_card['cardsn'], $type, $fee, $order['tag'], $endtime); } } } if ($order['type'] == 'credit' || $order['type'] == '') { $url = murl('mc/home'); } else { $url = murl('mc/bond/mycard'); } if ($params['from'] == 'return') { if ($params['result'] == 'success') { message('支付成功!', '../../app/' . $url, 'success'); } else { message('支付失败!', '../../app/' . $url, 'error'); } } }
$op = trim($_GPC['op']) ? trim($_GPC['op']) : 'list'; if ($op == 'list') { $pindex = max(1, intval($_GPC['page'])); $psize = 30; $limit = " ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ", {$psize}"; $addtime = intval($_GPC['addtime']); $where = ' WHERE uniacid = :uniacid'; $param = array(':uniacid' => $_W['uniacid']); $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_card_recommend') . " {$where}", $param); $recommends = pdo_fetchall('SELECT * FROM ' . tablename('mc_card_recommend') . " {$where} {$limit}", $param); $pager = pagination($total, $pindex, $psize); } if ($op == 'post') { $id = intval($_GPC['id']); if ($id > 0) { $recommend = pdo_get('mc_card_recommend', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($recommend)) { message('推荐不存在或已被删除', referer(), 'error'); } } if (checksubmit()) { $title = trim($_GPC['title']) ? trim($_GPC['title']) : message('推荐标题不能为空'); $content = trim($_GPC['url']) ? trim($_GPC['url']) : message('推荐链接不能为空'); $data = array('uniacid' => $_W['uniacid'], 'title' => $title, 'thumb' => trim($_GPC['thumb']), 'url' => trim($_GPC['url']), 'displayorder' => intval($_GPC['displayorder']), 'addtime' => TIMESTAMP); if ($id > 0) { pdo_update('mc_card_recommend', $data, array('uniacid' => $_W['uniacid'], 'id' => $id)); } else { pdo_insert('mc_card_recommend', $data); } message('发布推荐成功', url('mc/card/recommend'), 'success'); }
if ($num > 0) { mc_notice_recharge($openid, $uid, $num, '', "管理员后台操作余额,增加{$value}余额"); } else { mc_notice_credit2($openid, $uid, $num, 0, '', '', "管理员后台操作余额,减少{$value}余额"); } } } exit('success'); } if ($do == 'card') { load()->model('card'); $card = card_setting(); if (empty($card)) { exit('公众号未设置会员卡'); } $member = pdo_get('mc_card_members', array('uniacid' => $_W['uniacid'], 'uid' => $user['uid'])); if (!empty($member)) { exit('该会员已领取会员卡'); } $cardsn = $card['format']; preg_match_all('/(\\*+)/', $card['format'], $matchs); if (!empty($matchs)) { foreach ($matchs[1] as $row) { $cardsn = str_replace($row, random(strlen($row), 1), $cardsn); } } preg_match('/(\\#+)/', $card['format'], $matchs); $length = strlen($matchs[1]); $pos = strpos($card['format'], '#'); $cardsn = str_replace($matchs[1], str_pad($card['snpos']++, $length - strlen($number), '0', STR_PAD_LEFT), $cardsn); $record = array('uniacid' => $_W['uniacid'], 'openid' => '', 'uid' => $uid, 'cid' => $card['id'], 'cardsn' => $cardsn, 'status' => '1', 'createtime' => TIMESTAMP, 'endtime' => TIMESTAMP);
<?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('use'); $do = in_array($do, $dos) ? $do : 'use'; if ($do == 'use') { $id = intval($_GPC['id']); load()->model('activity'); $token = pdo_get('activity_coupon', array('uniacid' => $_W['uniacid'], 'couponid' => $id)); if (empty($token)) { message('优惠券不存在或已删除', '', 'error'); } $own_func = 'activity_token_owned'; $use_func = 'activity_token_use'; if ($token['type'] == 1) { $own_func = 'activity_coupon_owned'; $use_func = 'activity_coupon_use'; } $data = $own_func($uid, array('couponid' => $id, 'used' => 1)); $data = $data['data'][$id]; if (empty($data)) { message('该会员没有领取该优惠券或领取的优惠券已核销', '', 'error'); } if (checksubmit('submit')) { if (!empty($clerk)) { $status = $use_func($uid, $id, $clerk['name'], $clerk['id']); if (!is_error($status)) {
if (is_error($ret)) { message($ret, '', 'ajax'); } else { $menu = json_decode(urldecode(json_encode($menu)), true); if (!isset($menu['matchrule'])) { $menu['matchrule'] = array(); } $insert = array('uniacid' => $_W['uniacid'], 'menuid' => $ret, 'title' => $post['title'], 'type' => $post['type'], 'sex' => intval($menu['matchrule']['sex']), 'group_id' => isset($menu['matchrule']['group_id']) ? $menu['matchrule']['group_id'] : -1, 'client_platform_type' => intval($menu['matchrule']['client_platform_type']), 'area' => trim($menus['matchrule']['country']) . trim($menu['matchrule']['province']) . trim($menu['matchrule']['city']), 'data' => base64_encode(iserializer($menu)), 'status' => 1, 'createtime' => TIMESTAMP); if ($post['type'] == 1) { $history = pdo_get('uni_account_menus', array('uniacid' => $_W['uniacid'], 'type' => 2)); if (empty($history)) { $data = $insert; $data['type'] = 2; $data['status'] = 0; pdo_insert('uni_account_menus', $data); } else { $data = $insert; $data['type'] = 2; $data['status'] = 0; pdo_update('uni_account_menus', $data, array('uniacid' => $_W['uniacid'], 'type' => 2)); } $default = pdo_get('uni_account_menus', array('uniacid' => $_W['uniacid'], 'type' => 1)); if (!empty($default)) { pdo_update('uni_account_menus', $insert, array('uniacid' => $_W['uniacid'], 'type' => 1)); message(error(0, ''), '', 'ajax'); } } pdo_insert('uni_account_menus', $insert); message(error(0, ''), '', 'ajax'); } }
} $code = $coupon->DecryptCode(array('encrypt_code' => $encrypt_code)); if (is_error($code)) { $error_code = 1; } else { $data = array($card_id, $code['code'], $_W['account']['secret']); sort($data, SORT_STRING); $signature_tmp = sha1(implode($data)); if ($signature_tmp != $signature) { $error_signature = 1; } $record = pdo_get('coupon_record', array('acid' => $_W['acid'], 'card_id' => $card_id, 'code' => $code)); } if (checksubmit()) { $password = trim($_GPC['password']); $clerk = pdo_get('activity_coupon_password', array('uniacid' => $_W['uniacid'], 'password' => $password)); if (empty($clerk)) { message('店员密码错误'); } $status = $coupon->ConsumeCode(array('code' => $code['code'])); if (is_error($status)) { message($status['message']); } pdo_update('coupon_record', array('status' => 3, 'clerk_id' => $clerk['id'], 'clerk_name' => $clerk['name']), array('acid' => $_W['acid'], 'card_id' => $card_id, 'openid' => $openid, 'code' => $code)); message('核销微信卡券成功', url('mc/home'), 'success'); } } if ($do == 'qr') { require_once '../framework/library/qrcode/phpqrcode.php'; $errorCorrectionLevel = "L"; $matrixPointSize = "5";
message('删除计划任务成功', url('cron/display/list'), 'success'); } else { message('没有选择要删除的任务', referer(), 'error'); } } if ($do == 'run') { $id = intval($_GPC['id']); $status = cron_run($id); if (is_error($status)) { message($status['message'], referer(), 'error'); } message('执行计划任务成功', referer(), 'success'); } if ($do == 'status') { $id = intval($_GPC['id']); $status = intval($_GPC['status']); if (!in_array($status, array(0, 1))) { exit('状态码错误'); } $cron = pdo_get('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $id)); if (empty($cron)) { exit('任务不存在或已删除'); } $result = cloud_cron_change_status($cron['cloudid'], $status); if (is_error($result)) { exit($result['message']); } pdo_update('core_cron', array('status' => $status), array('uniacid' => $_W['uniacid'], 'id' => $id)); exit('success'); } template('cron/display');
$user['endtime'] = strtotime($_GPC['endtime']); } else { $user['endtime'] = 0; } if (!empty($user)) { user_update($user); } if (!empty($_GPC['signature']) || intval($_GPC['balance']) >= 0) { $notify = array(); $notify['sms']['balance'] = intval($_GPC['balance']); $notify['sms']['signature'] = trim($_GPC['signature']); pdo_update('uni_settings', array('notify' => iserializer($notify)), array('uniacid' => $uniacid)); } pdo_delete('uni_account_group', array('uniacid' => $uniacid)); if (!empty($_GPC['package'])) { $group = pdo_get('users_group', array('id' => $groupid)); $group['package'] = iunserializer($group['package']); if (!is_array($group['package']) || !in_array('-1', $group['package'])) { foreach ($_GPC['package'] as $packageid) { if (!empty($packageid)) { pdo_insert('uni_account_group', array('uniacid' => $uniacid, 'groupid' => $packageid)); } } } } if (!empty($_GPC['extra']['modules']) || !empty($_GPC['extra']['templates'])) { $data = array('modules' => iserializer($_GPC['extra']['modules']), 'templates' => iserializer($_GPC['extra']['templates']), 'uniacid' => $uniacid, 'name' => ''); $id = pdo_fetchcolumn("SELECT id FROM " . tablename('uni_group') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid)); if (empty($id)) { pdo_insert('uni_group', $data); } else {
private function booking($message) { global $_W; if ($message['event'] == 'unsubscribe' || $message['event'] == 'subscribe') { $todaystat = pdo_get('stat_fans', array('date' => date('Ymd'), 'uniacid' => $_W['uniacid'])); if ($message['event'] == 'unsubscribe') { if (empty($todaystat)) { $updatestat = array('new' => 0, 'uniacid' => $_W['uniacid'], 'cancel' => 1, 'cumulate' => 0, 'date' => date('Ymd')); pdo_insert('stat_fans', $updatestat); } else { $updatestat = array('cancel' => $todaystat['cancel'] + 1); $updatestat['cumulate'] = intval($todaystat['cumulate']) - 1; pdo_update('stat_fans', $updatestat, array('id' => $todaystat['id'])); } } elseif ($message['event'] == 'subscribe') { if (empty($todaystat)) { $updatestat = array('new' => 1, 'uniacid' => $_W['uniacid'], 'cancel' => 0, 'cumulate' => 1, 'date' => date('Ymd')); pdo_insert('stat_fans', $updatestat); } else { $updatestat = array('new' => $todaystat['new'] + 1, 'cumulate' => $todaystat['cumulate'] + 1); pdo_update('stat_fans', $updatestat, array('id' => $todaystat['id'])); } } } $setting = uni_setting($_W['uniacid'], array('passport')); load()->model('mc'); $fans = mc_fansinfo($message['from']); $default_groupid = cache_load("defaultgroupid:{$_W['uniacid']}"); if (empty($default_groupid)) { $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid'])); cache_write("defaultgroupid:{$_W['uniacid']}", $default_groupid); } if (!empty($fans)) { $rec = array(); if (!empty($fans['follow'])) { if ($message['event'] == 'unsubscribe') { $rec['follow'] = 0; $rec['followtime'] = 0; $rec['unfollowtime'] = $message['time']; } } else { if ($message['event'] != 'unsubscribe' && $message['event'] != 'ShakearoundUserShake') { $rec['follow'] = 1; $rec['followtime'] = $message['time']; $rec['unfollowtime'] = 0; } } $member = array(); if (!empty($fans['uid'])) { $member = mc_fetch($fans['uid']); } if (empty($member)) { if (!isset($setting['passport']) || empty($setting['passport']['focusreg'])) { $data = array('uniacid' => $_W['uniacid'], 'email' => md5($message['from']) . '@012wz.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP); $data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']); pdo_insert('mc_members', $data); $rec['uid'] = pdo_insertid(); } } if (!empty($rec)) { pdo_update('mc_mapping_fans', $rec, array('acid' => $_W['acid'], 'openid' => $message['from'], 'uniacid' => $_W['uniacid'])); } } else { $rec = array(); $rec['acid'] = $_W['acid']; $rec['uniacid'] = $_W['uniacid']; $rec['uid'] = 0; $rec['openid'] = $message['from']; $rec['salt'] = random(8); if ($message['event'] == 'unsubscribe') { $rec['follow'] = 0; $rec['followtime'] = 0; $rec['unfollowtime'] = $message['time']; } else { $rec['follow'] = 1; $rec['followtime'] = $message['time']; $rec['unfollowtime'] = 0; } if (!isset($setting['passport']) || empty($setting['passport']['focusreg'])) { $data = array('uniacid' => $_W['uniacid'], 'email' => md5($message['from']) . '@012wz.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP); $data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']); pdo_insert('mc_members', $data); $rec['uid'] = pdo_insertid(); } pdo_insert('mc_mapping_fans', $rec); } }
$pager = pagination($total, $pindex, $psize); if (count($list) == 1 && $list[0]['uid'] && !empty($keyword)) { $status = 1; $uid = $list[0]['uid']; } else { foreach ($list as &$li) { if (empty($li['email']) || !empty($li['email']) && substr($li['email'], -6) == '012wz.com' && strlen($li['email']) == 39) { $li['email'] = '未完善'; } } $status = 0; } } if ($do == 'manage') { load()->model('mc'); $clerk = pdo_get('activity_coupon_password', array('uniacid' => $_W['uniacid'], 'password' => trim($_GPC['password']))); if (empty($clerk)) { message('店员密码错误'); } $uid = intval($_GPC['uid']); if ($uid) { foreach ($creditnames as $index => $creditname) { if (($_GPC[$index . '_type'] == 1 || $_GPC[$index . '_type'] == 2) && $_GPC[$index . '_value']) { $value = $_GPC[$index . '_type'] == 1 ? $_GPC[$index . '_value'] : -$_GPC[$index . '_value']; $return = mc_credit_update($uid, $index, $value, array($_W['uid'], trim($_GPC['remark']), 'system', $clerk['id'], $clerk['store_id'])); if (is_error($return)) { message($return['message']); } $openid = pdo_fetchcolumn('SELECT openid FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uid = :uid', array(':acid' => $_W['acid'], ':uid' => $uid)); if (!empty($openid)) { if ($index == 'credit1') {
message('公众号不存在或已被删除', '', 'error'); } uni_update_yesterday_stat(); $_W['page']['title'] = $account['name'] . ' - 公众号详细信息'; $starttime = $_GPC['datelimit']['start'] ? strtotime($_GPC['datelimit']['start']) : date('Ymd', strtotime('-7day')); $endtime = $_GPC['datelimit']['end'] ? strtotime($_GPC['datelimit']['end']) : date('Ymd'); $yesterday = date('Ymd', strtotime('-1 days')); $today = date('Ymd'); $type = intval($_GPC['type']) ? intval($_GPC['type']) : 1; if ($_W['isajax']) { $days = array(); $datasets = array(); $stat = pdo_fetchall("SELECT * FROM " . tablename('stat_fans') . " WHERE date >= '{$starttim}' AND date <= '{$endtime}' AND uniacid = '{$_W['uniacid']}' ORDER BY date ASC", array(), 'date'); for ($i = strtotime($starttime); $i <= strtotime($endtime); $i += 86400) { $day = date('Ymd', $i); if ($day == $today) { $stat[$day]['cumulate'] = intval($stat[$day]['cumulate']) + intval($stat[$yesterday]['cumulate']); } $shuju['label'][] = date('m-d', strtotime($day)); $shuju['datasets']['new'][] = intval($stat[$day]['new']); $shuju['datasets']['cancel'][] = intval($stat[$day]['cancel']); $shuju['datasets']['increase'][] = intval($stat[$day]['new']) - intval($stat[$day]['cancel']); $shuju['datasets']['cumulate'][] = intval($stat[$day]['cumulate']); } exit(json_encode($shuju)); } $scroll = intval($_GPC['scroll']); $yesterday_stat = pdo_get('stat_fans', array('date' => $yesterday, 'uniacid' => $_W['uniacid'])); $today_stat = pdo_get('stat_fans', array('date' => date('Ymd'), 'uniacid' => $_W['uniacid'])); $today_stat['cumulate'] = intval($today_stat['cumulate']) + intval($yesterday_stat['cumulate']); template('account/summary');
$map_fans = iunserializer($map_fans); } if (!empty($map_fans) && is_array($map_fans)) { empty($profile['nickname']) ? $data['nickname'] = $map_fans['nickname'] : ''; empty($profile['gender']) ? $data['gender'] = $map_fans['sex'] : ''; empty($profile['residecity']) ? $data['residecity'] = $map_fans['city'] ? $map_fans['city'] . '市' : '' : ''; empty($profile['resideprovince']) ? $data['resideprovince'] = $map_fans['province'] ? $map_fans['province'] . '省' : '' : ''; empty($profile['nationality']) ? $data['nationality'] = $map_fans['country'] : ''; empty($profile['avatar']) ? $data['avatar'] = rtrim($map_fans['headimgurl'], '0') . 132 : ''; if (!empty($data)) { mc_update($_W['member']['uid'], $data); } } } } $profile = pdo_get('mc_members', array('uniacid' => $_W['uniacid'], 'uid' => $_W['member']['uid'])); if (!empty($profile)) { if (empty($profile['email']) || !empty($profile['email']) && substr($profile['email'], -6) == 'we7.cc' && strlen($profile['email']) == 39) { $profile['email'] = ''; $profile['email_effective'] = 1; } } $sql = 'SELECT `mf`.*, `pf`.`field` FROM ' . tablename('mc_member_fields') . ' AS `mf` JOIN ' . tablename('profile_fields') . " AS `pf`\n\t\tON `mf`.`fieldid` = `pf`.`id` WHERE `uniacid` = :uniacid AND `mf`.`available` = :available"; $params = array(':uniacid' => $_W['uniacid'], ':available' => '1'); $mcFields = pdo_fetchall($sql, $params, 'field'); if (checksubmit('submit')) { if (!empty($_GPC)) { $_GPC['createtime'] = TIMESTAMP; foreach ($_GPC as $field => $value) { if (!isset($value) || in_array($field, array('uid', 'act', 'name', 'token', 'submit', 'session'))) { unset($_GPC[$field]);
function _login($forward = '') { global $_GPC, $_W; load()->model('user'); $member = array(); $username = trim($_GPC['username']); pdo_query('DELETE FROM' . tablename('users_failed_login') . ' WHERE lastupdate < :timestamp', array(':timestamp' => TIMESTAMP - 300)); $failed = pdo_get('users_failed_login', array('username' => $username, 'ip' => CLIENT_IP)); if ($failed['count'] >= 5) { message('输入密码错误次数超过5次,请在5分钟后再登录', referer(), 'info'); } if (!empty($_W['setting']['copyright']['verifycode'])) { $verify = trim($_GPC['verify']); if (empty($verify)) { message('请输入验证码'); } $result = checkcaptcha($verify); if (empty($result)) { message('输入验证码错误'); } } if (empty($username)) { message('请输入要登录的用户名'); } $member['username'] = $username; $member['password'] = $_GPC['password']; if (empty($member['password'])) { message('请输入密码'); } $record = user_single($member); $now = time(); $now = date("Y-m-d", $now); //计算天数 $day1 = $now; $day2 = date("Y-m-d", $record['endtime']); $diff = diffBetweenTwoDays($day1, $day2); $oldday = 16 - $diff; if (0 >= $oldday) { $oldday = 0; } if (!empty($record)) { if ($record['status'] == 1) { message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!'); } if ($record['status'] != 0) { if ($day1 >= $day2) { if ($oldday == 0) { message('您的账号已经过期15天了,不幸的是:您属于体验会员,已经自动了删除账号!'); } else { message('您的账号已经到期,不幸的是:您属于体验会员,' . $oldday . '天后将自动删除账号!'); } } } $founders = explode(',', $_W['config']['setting']['founder']); $_W['isfounder'] = in_array($record['uid'], $founders); if (!empty($_W['siteclose']) && empty($_W['isfounder'])) { message('站点已关闭,关闭原因:' . $_W['setting']['copyright']['reason']); } $cookie = array(); $cookie['uid'] = $record['uid']; $cookie['lastvisit'] = $record['lastvisit']; $cookie['lastip'] = $record['lastip']; $cookie['hash'] = md5($record['password'] . $record['salt']); $session = base64_encode(json_encode($cookie)); isetcookie('__session', $session, !empty($_GPC['rember']) ? 7 * 86400 : 0); $status = array(); $status['uid'] = $record['uid']; $status['lastvisit'] = TIMESTAMP; $status['lastip'] = CLIENT_IP; user_update($status); if (empty($forward)) { $forward = $_GPC['forward']; } if (empty($forward)) { $forward = './index.php?c=account&a=display'; } if ($record['uid'] != $_GPC['__uid']) { isetcookie('__uniacid', '', -7 * 86400); isetcookie('__uid', '', -7 * 86400); } pdo_delete('users_failed_login', array('id' => $failed['id'])); message("欢迎回来,{$record['username']},您还可以使用{$diff}天。", $forward); } else { if (empty($failed)) { pdo_insert('users_failed_login', array('ip' => CLIENT_IP, 'username' => $username, 'count' => '1', 'lastupdate' => TIMESTAMP)); } else { pdo_update('users_failed_login', array('count' => $failed['count'] + 1, 'lastupdate' => TIMESTAMP), array('id' => $failed['id'])); } message('登录失败,请检查您输入的用户名和密码!'); } }
function mc_oauth_fans($openid, $acid = 0) { $condition = array(); $condition['oauth_openid'] = $openid; if (!empty($acid)) { $condition['acid'] = $acid; } $fan = pdo_get('mc_oauth_fans', $condition, array('openid', 'uid')); return $fan; }
function uni_update_yesterday_stat() { global $_W; $cachekey = "stat:todaylock:{$_W['uniacid']}"; $cache = cache_load($cachekey); if (!empty($cache) && $cache['expire'] > TIMESTAMP) { return true; } $yesterday = date('Ymd', strtotime('-1 days')); $yesterday_stat = pdo_get('stat_fans', array('date' => $yesterday, 'uniacid' => $_W['uniacid'])); if ($_W['account']['level'] == ACCOUNT_SUBSCRIPTION_VERIFY || $_W['account']['level'] == ACCOUNT_SERVICE_VERIFY) { $account_obj = WeAccount::create(); $weixin_stat = $account_obj->getFansStat(); if (!is_error($weixin_stat) && !empty($weixin_stat)) { $yesterday_weixin_stat = $weixin_stat[$yesterday]; $update_stat = array('uniacid' => $_W['uniacid'], 'new' => $yesterday_weixin_stat['new'], 'cancel' => $yesterday_weixin_stat['cancel'], 'cumulate' => $yesterday_weixin_stat['cumulate'], 'date' => $yesterday); } } else { $update_stat = array(); $update_stat['cumulate'] = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uniacid = :uniacid AND follow = :follow AND followtime < :endtime', array(':acid' => $_W['acid'], ':uniacid' => $_W['uniacid'], ':endtime' => strtotime(date('Y-m-d')), ':follow' => 1)); $update_stat['date'] = $yesterday; $update_stat['uniacid'] = $_W['uniacid']; } if (empty($yesterday_stat)) { pdo_insert('stat_fans', $update_stat); } else { pdo_update('stat_fans', $update_stat, array('id' => $yesterday_stat['id'])); } cache_write($cachekey, array('expire' => strtotime(date('Y-m-d')) + 86399)); return true; }