function __construct() { global $_W, $_GPC; $this->_weid = $_W['uniacid']; $this->_fromuser = $_W['fans']['from_user']; //debug if ($_SERVER['HTTP_HOST'] == '127.0.0.1' || $_SERVER['HTTP_HOST'] == 'localhost:8888' || $_SERVER['HTTP_HOST'] == '192.168.1.102:8888') { $this->_fromuser = '******'; } $this->_auth2_openid = 'auth2_openid_' . $_W['uniacid']; $this->_auth2_nickname = 'auth2_nickname_' . $_W['uniacid']; $this->_auth2_headimgurl = 'auth2_headimgurl_' . $_W['uniacid']; $this->_appid = ''; $this->_appsecret = ''; $this->_accountlevel = $_W['account']['level']; //是否为高级号 if (!empty($_SESSION['oauth_openid'])) { $this->_fromuser = $_SESSION['oauth_openid']; } if ($this->_accountlevel < 4) { $setting = uni_setting($this->_weid); $oauth = $setting['oauth']; if (!empty($oauth) && !empty($oauth['account'])) { $this->_account = account_fetch($oauth['account']); $this->_appid = $this->_account['key']; $this->_appsecret = $this->_account['secret']; } } else { $this->_appid = $_W['account']['key']; $this->_appsecret = $_W['account']['secret']; } }
public function payResult($params) { load()->model('mc'); $status = pdo_fetchcolumn("SELECT status FROM " . tablename('mc_credits_recharge') . " WHERE tid = :tid", array(':tid' => $params['tid'])); if (empty($status)) { $credit1_lv = $this->module['config']['credit1_lv'] ? $this->module['config']['credit1_lv'] : 1; $fee = $params['fee'] / $credit1_lv; $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') { $setting = uni_setting($_W['uniacid'], array('creditbehaviors')); //a:2:{s:8:"activity";s:7:"credit1";s:8:"currency";s:7:"credit2";} $credit = $setting['creditbehaviors']['activity']; if (empty($credit)) { message('站点积分行为参数配置错误,请联系服务商', '', 'error'); } else { $paydata = array('wechat' => '微信', 'alipay' => '支付宝'); $record[] = $params['user']; $record[] = '用户通过' . $paydata[$params['type']] . '充值' . $fee . '积分'; mc_credit_update($params['user'], $credit, $fee, $record); } } } if ($params['from'] == 'return') { if ($params['result'] == 'success') { message('支付成功!', '../../app/' . url('mc/home'), 'success'); } else { message('支付失败!', '../../app/' . url('mc/home'), 'error'); } } }
public function fieldsFormDisplay($rid = 0) { load()->model('mc'); global $_W, $_GPC; //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0 $creditnames = uni_setting($_W['uniacid'], array('creditnames')); if ($creditnames) { foreach ($creditnames['creditnames'] as $index => $creditname) { if ($creditname['enabled'] == 0) { unset($creditnames['creditnames'][$index]); } } $scredit = implode(', ', array_keys($creditnames['creditnames'])); } else { $scredit = ''; } $groups = mc_groups($_W['uniacid']); $couponlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 1, ':endtime' => TIMESTAMP)); $tokenlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 2, ':endtime' => TIMESTAMP)); $goodslists = pdo_fetchall('SELECT id,title,type,credittype,endtime,total,num,credit FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC', array(':uniacid' => $_W['uniacid'], ':type' => 3, ':endtime' => TIMESTAMP)); //print_r($couponlists); load()->func('tpl'); if ($rid == 0) { $reply = array('title' => '幸运大抽奖活动开始了!', 'description' => '幸运大抽奖活动开始啦!', 'tips' => '每次抽奖需要花费50积分,一等奖为39元的现金抵扣券,二等奖为100积分,三等奖为50积分,四等奖为30积分。每人每天限抽2次。', 'remark' => '中奖积分请到会员主页查看', 'starttime' => time(), 'endtime' => time() + 10 * 84400, 'reg' => '0', 'status' => '1', 'awardnum' => '1', 'playnum' => '5', 'dayplaynum' => '1', 'zfcs' => '1', 'zjcs' => '1', 'rate' => '10', 'need_type' => 'credit1', 'need_num' => '0', 'give_type' => 'credit1', 'give_num' => '0', 'onlynone' => '1', 'share_title' => '欢迎参加幸运大抽奖活动', 'share_content' => '亲,欢迎参加幸运大抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦'); $prizes = array('p1_type' => 'credit1'); } else { $reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); $prizes = iunserializer($reply['prizes']); } include $this->template('form'); }
public function fieldsFormDisplay($rid = 0) { global $_W; $uniacid = $_W['uniacid']; load()->func('tpl'); $creditnames = array(); $unisettings = uni_setting($uniacid, array('creditnames')); foreach ($unisettings['creditnames'] as $key => $credit) { if (!empty($credit['enabled'])) { $creditnames[$key] = $credit['title']; } } if (!empty($rid)) { $reply = pdo_fetch("SELECT * FROM " . tablename('stonefish_planting_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); $share = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_share') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); $prize = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_prize') . " WHERE rid = :rid ORDER BY `id` asc", array(':rid' => $rid)); //查询奖品是否可以删除 foreach ($prize as $mid => $prizes) { $prize[$mid]['fans'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('stonefish_planting_award') . " WHERE prizetype = :prizeid", array(':prizeid' => $prizes['id'])); $prize[$mid]['delete_url'] = $this->createWebUrl('deleteprize', array('rid' => $rid, 'id' => $prizes['id'])); } //查询奖品是否可以删除 } $seed = pdo_fetchall("SELECT * FROM " . tablename('stonefish_planting_seed') . " WHERE uniacid = :uniacid Or uniacid = 0 ORDER BY `id` asc", array(':uniacid' => $uniacid)); if (!$reply) { $now = time(); $reply = array("title" => "种值活动开始了!", "start_picurl" => "../addons/stonefish_planting/template/images/start.jpg", "description" => "欢迎参加种值活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "请用力摇晃你的手机抽奖", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "种值活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_planting/template/images/end.jpg", "homepic" => "../addons/stonefish_planting/template/images/home.jpg", "adpic" => "../addons/stonefish_planting/template/images/banner.png", "award_times" => 1, "credit_times" => 5, "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "homepictime" => 0); } else { $reply['notawardtext'] = implode("\n", (array) iunserializer($reply['notawardtext'])); } //print_r(uni_modules($enabledOnly = true)); //exit; //查询是否有商户网点权限 $modules = uni_modules($enabledOnly = true); $modules_arr = array(); $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;')); if (in_array('stonefish_branch', $modules_arr)) { $stonefish_branch = true; } //查询是否有商户网点权限 //查询子公众号信息 $acid_arr = uni_accounts(); $ids = array(); $ids = array_map('array_shift', $acid_arr); //子公众账号Arr数组 $ids_num = count($ids); //多少个子公众账号 $one = current($ids); //查询子公众号信息 if (!$share) { $share = array(); foreach ($ids as $acid => $idlists) { $share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加种值活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_planting/template/images/share.png", "share_pic" => "../addons/stonefish_planting/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1); } } include $this->template('form'); }
private function getSysInfo() { global $_W; load()->model('activity'); $sysInfo = array(); $setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc')); $sysInfo['behavior'] = $setting['creditbehaviors']; $sysInfo['creditnames'] = $setting['creditnames']; return $sysInfo; }
public function fieldsFormDisplay($rid = 0) { global $_W; load()->func('tpl'); $creditnames = array(); $unisettings = uni_setting($uniacid, array('creditnames')); foreach ($unisettings['creditnames'] as $key => $credit) { if (!empty($credit['enabled'])) { $creditnames[$key] = $credit['title']; } } if (!empty($rid)) { $reply = pdo_fetch("select * from " . tablename('stonefish_bigwheel_reply') . " where rid = :rid order by `id` desc", array(':rid' => $rid)); $share = pdo_fetchall("select * from " . tablename('stonefish_bigwheel_share') . " where rid = :rid order by `id` desc", array(':rid' => $rid)); $prize = pdo_fetchall("select * from " . tablename('stonefish_bigwheel_prize') . " where rid = :rid order by `id` asc", array(':rid' => $rid)); } if (!$reply) { $now = time(); $reply = array("title" => "幸运大转盘活动开始了!", "start_picurl" => "../addons/stonefish_bigwheel/template/images/activity-lottery-start.jpg", "description" => "欢迎参加幸运大转盘活动", "repeat_lottery_reply" => "亲,继续努力哦~~", "ticket_information" => "兑奖请联系我们,电话: 13888888888", "starttime" => $now, "endtime" => strtotime(date("Y-m-d H:i", $now + 7 * 24 * 3600)), "end_theme" => "幸运大转盘活动已经结束了", "end_instruction" => "亲,活动已经结束,请继续关注我们的后续活动哦~", "end_picurl" => "../addons/stonefish_bigwheel/template/images/activity-lottery-end.jpg", "most_num_times" => 0, "number_times" => 0, "probability" => 0, "turntable" => 1, "turntablenum" => 6, "award_times" => 1, "credit_times" => 5, "credit1" => 0, "credit2" => 0, "sn_code" => 1, "sn_rename" => "SN码", "show_num" => 2, "awardnum" => 50, "xuninum" => 500, "xuninumtime" => 86400, "xuninuminitial" => 10, "xuninumending" => 100, "ticketinfo" => "请输入详细资料,兑换奖品", "isrealname" => 1, "ismobile" => 1, "isfans" => 1, "isfansname" => "真实姓名,手机号码,QQ号,邮箱,地址,性别,固定电话,证件号码,公司名称,职业,职位", "bigwheelpic" => "../addons/stonefish_bigwheel/template/images/activity-lottery-6.png", "bigwheelimg" => "../addons/stonefish_bigwheel/template/images/activity-inner.png", "bigwheelimgan" => "../addons/stonefish_bigwheel/template/images/activity.png", "bigwheelimgbg" => "../addons/stonefish_bigwheel/template/images/activity_bg.png", "prizeDeg" => '1, 60, 120, 180, 240, 300', "lostDeg" => '30, 90, 150, 210, 270, 330', "homepictime" => 0); } if (!$prize) { $prize = array("0" => array("credit_type" => 'physical', "prizetype" => '一等奖'), "1" => array("credit_type" => 'physical', "prizetype" => '二等奖'), "2" => array("credit_type" => 'physical', "prizetype" => '三等奖'), "3" => array("credit_type" => 'physical', "prizetype" => '四等奖'), "4" => array("credit_type" => 'physical', "prizetype" => '五等奖'), "5" => array("credit_type" => 'physical', "prizetype" => '六等奖'), "6" => array("credit_type" => 'physical', "prizetype" => '七等奖'), "7" => array("credit_type" => 'physical', "prizetype" => '八等奖'), "8" => array("credit_type" => 'physical', "prizetype" => '九等奖'), "9" => array("credit_type" => 'physical', "prizetype" => '十等奖'), "10" => array("credit_type" => 'physical', "prizetype" => '参与奖'), "11" => array("credit_type" => 'physical', "prizetype" => '幸运奖')); } $jiangxiang = array('0' => array("turntablenum" => '3', "prizeDeg" => '1,120,240', "lostDeg" => '60,180,300', "prizeid" => "\$('#prizeid3').hide();\$('#prizeid4').hide();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '1' => array("turntablenum" => '4', "prizeDeg" => '1,90,180,270', "lostDeg" => '45,135,225,315', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').hide();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '2' => array("turntablenum" => '5', "prizeDeg" => '1,72,144,216,288', "lostDeg" => '36,108,180,252,324', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').hide();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '3' => array("turntablenum" => '6', "prizeDeg" => '1,60,120,180,240,300', "lostDeg" => '30, 90, 150, 210, 270, 330', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').hide();\$('#prizeid7').hide();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '4' => array("turntablenum" => '8', "prizeDeg" => '1,45,90,135,180,225,270,315', "lostDeg" => '22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').hide();\$('#prizeid9').hide();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '5' => array("turntablenum" => '10', "prizeDeg" => '1,36,72,108,144,180,216,252,288,324', "lostDeg" => '', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').show();\$('#prizeid9').show();\$('#prizeid10').hide();\$('#prizeid11').hide();"), '6' => array("turntablenum" => '12', "prizeDeg" => '1,30,60,90,120,150,180,210,240,270,300,330', "lostDeg" => '', "prizeid" => "\$('#prizeid3').show();\$('#prizeid4').show();\$('#prizeid5').show();\$('#prizeid6').show();\$('#prizeid7').show();\$('#prizeid8').show();\$('#prizeid9').show();\$('#prizeid10').show();\$('#prizeid11').show();")); //print_r(uni_modules($enabledOnly = true)); //exit; //查询是否有商户网点权限 $modules = uni_modules($enabledOnly = true); $modules_arr = array(); $modules_arr = array_reduce($modules, create_function('$v,$w', '$v[$w["mid"]]=$w["name"];return $v;')); if (in_array('stonefish_branch', $modules_arr)) { $stonefish_branch = true; } //查询是否有商户网点权限 //查询子公众号信息 $acid_arr = uni_accounts(); $ids = array(); $ids = array_map('array_shift', $acid_arr); //子公众账号Arr数组 $ids_num = count($ids); //多少个子公众账号 $one = current($ids); //查询子公众号信息 if (!$share) { $share = array(); foreach ($ids as $acid => $idlists) { $share[$acid] = array("acid" => $acid, "share_url" => $acid_arr[$acid]['subscribeurl'], "share_title" => "已有#参与人数#人参与本活动了,你的朋友#参与人# 还中了大奖:#奖品#,请您也来试试吧!", "share_desc" => "亲,欢迎参加大转盘抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦", "share_picurl" => "../addons/stonefish_bigwheel/template/images/share.png", "share_pic" => "../addons/stonefish_bigwheel/template/images/img_share.png", "sharenumtype" => 0, "sharenum" => 0, "sharetype" => 1); } } include $this->template('form'); }
function uni_group_check() { global $_W; $uniacid = $_W['uniacid']; $settings = uni_setting($uniacid, array('groupdata')); $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array(); if ($_W['account']['groupid'] != 0 && $groupdata['isexpire'] == 1 && $groupdata['endtime'] < TIMESTAMP) { pdo_update('uni_account', array('groupid' => 0), array('uniacid' => $uniacid)); pdo_update('uni_settings', array('groupdata' => iserializer(array('isexpire' => 1, 'endtime' => $groupdata['endtime'], 'oldgroupid' => $_W['account']['groupid']))), array('uniacid' => $uniacid)); $_W['account']['groupid'] = 0; load()->model('module'); module_build_privileges(); return true; } return false; }
public function settingsDisplay($settings) { global $_GPC, $_W; $credits = uni_setting($_W['uniacid'], 'creditnames'); $cls = new Prize(); list($code, $groups) = $cls->groups(); if (checksubmit()) { $cfg = array('times' => $_GPC['times'], 'start_time' => $_GPC['start_time'], 'end_time' => $_GPC['end_time'], 'prize_group' => $_GPC['prize_group'], 'credit_type' => $_GPC['credit_type'], 'credit' => intval($_GPC['credit']), 'rank' => intval($_GPC['rank'])); $start_time = $cfg['start_time']; $start_time = strtotime($start_time); $end_time = $cfg['end_time']; $end_time = strtotime($end_time); if ($start_time >= $end_time) { message('开始时间不得晚于结束时间', 'refresh', 'error'); } elseif ($this->saveSettings($cfg)) { message('保存成功', 'refresh'); } } if (!isset($settings) || empty($settings)) { $UnIaCid = $_W['uniacid']; $par = array(':module' => $this->modulename, ':uniacid' => $UnIaCid); $sql = "SELECT COUNT(*) FROM " . tablename("uni_account_modules") . " WHERE module=:module AND uniacid=:uniacid"; $row = pdo_fetchcolumn($sql, $par); if (empty($row) || intval($row) <= 0) { $cfg = array('module' => $this->modulename, 'uniacid' => $UnIaCid, 'enabled' => 1); pdo_insert("uni_account_modules", $cfg); } } if (!isset($settings['times'])) { $settings['times'] = '1'; } if (!isset($settings['start_time'])) { $settings['start_time'] = '08:30'; } if (!isset($settings['end_time'])) { $settings['end_time'] = '22:00'; } if (!isset($settings['credit'])) { $settings['credit'] = '1'; } if (!isset($settings['rank'])) { $settings['rank'] = '10'; } include $this->template('setting'); }
public function doWebFinancialCenter() { global $_W, $_GPC; //这个操作被定义用来呈现 管理中心导航菜单 if ($_W['ispost'] && $_W['isajax']) { $setting = uni_setting($_W['uniacid'], array('groupdata')); $setting["groupdata"]["is_auto"] = $_GPC["is_auto"]; pdo_update("uni_settings", array("groupdata" => iserializer($setting["groupdata"])), array("uniacid" => $_W['uniacid'])); die(json_encode(array("code" => 1, "message" => "操作成功."))); } $settings = get_settings(); $service = explode("|", $settings["service_qqs"]); $qqs = array(); foreach ($service as $ser) { list($name, $qq) = explode("-", $ser); $qqs[] = array("name" => $name, "qq" => $qq); } include $this->template('financial_center'); }
public function respond() { global $_W, $engine; if ($this->message['type'] == 'trace') { return $this->respText(''); } $setting = uni_setting($_W['uniacid'], array('default')); if (!empty($setting['default'])) { $flag = array('image' => 'url', 'link' => 'url', 'text' => 'content'); $message = $this->message; $message['type'] = 'text'; $message['content'] = $setting['default']; $message['redirection'] = true; $message['source'] = 'default'; $message['original'] = $this->message[$flag[$this->message['type']]]; $pars = $engine->analyzeText($message); if (is_array($pars)) { return array('params' => $pars); } } }
protected function pay($params = array()) { global $_W; $params['module'] = $this->module['name']; $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid'; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':module'] = $params['module']; $pars[':tid'] = $params['tid']; $log = pdo_fetch($sql, $pars); if (!empty($log) && $log['status'] == '1') { message('这个订单已经支付成功, 不需要重复支付.'); } $setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors')); if (!is_array($setting['payment'])) { message('没有有效的支付方式, 请联系网站管理员.'); } $pay = $setting['payment']; $pay['credit']['switch'] = false; $pay['delivery']['switch'] = false; include $this->template('common/paycenter'); }
public function settingsDisplay($settings) { global $_W, $_GPC; $creditnames = uni_setting($_W['uniacid'], array('creditnames')); if ($creditnames) { foreach ($creditnames['creditnames'] as $index => $creditname) { if ($creditname['enabled'] == 0) { unset($creditnames['creditnames'][$index]); } } $scredit = implode(', ', array_keys($creditnames['creditnames'])); } else { $scredit = ''; } if (checksubmit()) { $cfg = array('status' => $_GPC['status'], 'credit_type' => $_GPC['credit_type'], 'credit_subscribe' => intval($_GPC['credit_subscribe']), 'credit_lever_1' => intval($_GPC['credit_lever_1']), 'credit_lever_2' => intval($_GPC['credit_lever_2']), 'out_limit' => intval($_GPC['out_limit']), 'start_num' => intval($_GPC['start_num'])); if ($this->saveSettings($cfg)) { message('保存成功', 'refresh'); } } if (empty($settings['credit_type'])) { $settings['credit_type'] = 'credit1'; } if (empty($settings['credit_subscribe'])) { $settings['credit_subscribe'] = '5'; } if (empty($settings['credit_lever_1'])) { $settings['credit_lever_1'] = '2'; } if (empty($settings['credit_lever_2'])) { $settings['credit_lever_2'] = '1'; } if (empty($settings['out_limit'])) { $settings['out_limit'] = '100'; } //这里来展示设置项表单 include $this->template('setting'); }
public function receive() { global $_W; //这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看微赞文档来编写你的代码 $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'], 'redirection' => $this->message['redirection'], 'source' => $this->message['source'])); 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'])) { $updateid = 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($updateid)) { pdo_insert('stat_rule', array('uniacid' => $_W['uniacid'], 'rid' => $this->params['rule'], 'createtime' => strtotime(date('Y-m-d')), 'hit' => 1, 'lastupdate' => $this->message['time'])); } if (!empty($this->keyword['id'])) { $updateid = 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')))); if (empty($updateid)) { 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'])); } } } }
public function settingsDisplay($settings) { global $_W, $_GPC; $creditnames = uni_setting($_W['uniacid'], array('creditnames')); if ($creditnames) { foreach ($creditnames['creditnames'] as $index => $creditname) { if ($creditname['enabled'] == 0) { unset($creditnames['creditnames'][$index]); } } $scredit = implode(', ', array_keys($creditnames['creditnames'])); } else { $scredit = ''; } if (checksubmit()) { $cfg = array('sub_type' => $_GPC['sub_type'], 'sub_num' => $_GPC['sub_num'], 'unsub_type' => $_GPC['unsub_type'], 'unsub_num' => $_GPC['unsub_num']); if ($this->saveSettings($cfg)) { message('保存成功', 'refresh'); } } //这里来展示设置项表单 include $this->template('setting'); }
function app_navs($type = 'home', $multiid = 0, $section = 0) { global $_W; $pos = array(); $pos['home'] = 1; $pos['profile'] = 2; $pos['shortcut'] = 3; if (empty($multiid) && $type != 'profile') { load()->model('account'); $setting = uni_setting($_W['uniacid'], array('default_site')); $multiid = $setting['default_site']; } $sql = "SELECT id,name, description, url, icon, css, position, module FROM " . tablename('site_nav') . " WHERE position = '{$pos[$type]}' AND status = 1 AND uniacid = '{$_W['uniacid']}' AND multiid = '{$multiid}' ORDER BY displayorder DESC, id DESC"; $navs = pdo_fetchall($sql); if (!empty($navs)) { foreach ($navs as &$row) { if (!strexists($row['url'], 'tel:') && !strexists($row['url'], '://') && !strexists($row['url'], 'www') && !strexists($row['url'], 'i=')) { $row['url'] .= strexists($row['url'], '?') ? "&i={$_W['uniacid']}" : "?i={$_W['uniacid']}"; } if (is_serialized($row['css'])) { $row['css'] = unserialize($row['css']); } if (empty($row['css']['icon']['icon'])) { $row['css']['icon']['icon'] = 'fa fa-external-link'; } if ($row['position'] == '3') { if (!empty($row['css'])) { unset($row['css']['icon']['font-size']); } } $row['css']['icon']['style'] = "color:{$row['css']['icon']['color']};font-size:{$row['css']['icon']['font-size']}px;"; $row['css']['name'] = "color:{$row['css']['name']['color']};"; } unset($row); } return $navs; }
public function doMobilePay() { global $_W, $_GPC; //验证用户登录状态,此处测试不做验证 checkauth(); $params['tid'] = date('YmdH'); $params['user'] = $_W['member']['uid']; $params['fee'] = floatval($_GPC['price']); $params['title'] = '测试支付公众号名称'; $params['ordersn'] = random(5, 1); $params['virtual'] = false; if (checksubmit('submit')) { if ($_GPC['type'] == 'credit') { $setting = uni_setting($_W['uniacid'], array('creditbehaviors')); $credtis = mc_credit_fetch($_W['member']['uid']); //此处需要验证积分数量 if ($credtis[$setting['creditbehaviors']['currency']] < $params['fee']) { message('抱歉,您帐户的余额不够支付该订单,请充值!', '', 'error'); } } } else { $this->pay($params); } }
<?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'); $dos = array('display'); $do = in_array($do, $dos) ? $do : 'display'; if ($do == 'display') { $data = uni_setting($_W['uniacid'], array('site_info', 'styleid')); $styleid = $data['styleid']; $site_info = empty($data['site_info']) ? array('site_info' => array()) : $data['site_info']; $styles = pdo_fetchall('SELECT * FROM ' . tablename('site_styles') . ' WHERE uniacid = :uniacid', array(':uniacid' => $_W['uniacid'])); if (checksubmit('submit')) { $pdata['site_info'] = iserializer(array('sitename' => $_GPC['sitename'], 'keywords' => $_GPC['keywords'], 'description' => $_GPC['description'], 'footer' => htmlspecialchars_decode($_GPC['footer']))); $pdata['styleid'] = intval($_GPC['styleid']); pdo_update('uni_settings', $pdata, array('uniacid' => $_W['uniacid'])); cache_delete("unisetting:{$_W['uniacid']}"); message('信息设置成功!', url('site/info/display'), 'success'); } } template('site/info');
<?php /** * @FreeGo Team 智慧游 * @url http://www.cninone.com/ */ defined('IN_IA') or exit('Access Denied'); if ($action != 'cash') { checkauth(); } load()->model('activity'); $filter = array(); $coupons = activity_coupon_owned($_W['member']['uid'], $filter); $tokens = activity_token_owned($_W['member']['uid'], $filter); $setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc', 'payment', 'passport')); $behavior = $setting['creditbehaviors']; $creditnames = $setting['creditnames']; $credits = mc_credit_fetch($_W['member']['uid'], '*'); $sql = 'SELECT `status` FROM ' . tablename('mc_card') . " WHERE `uniacid` = :uniacid"; $cardstatus = pdo_fetch($sql, array(':uniacid' => $_W['uniacid']));
if ($useweixin) { $set = m('common')->getSysset(); if (!is_weixin()) { show_json(0, '非微信环境!'); } if (empty($set['pay']['weixin'])) { show_json(0, '未开启微信支付!'); } $wechat = array('success' => false); $params = array(); $params['tid'] = $log['logno']; $params['user'] = $openid; $params['fee'] = $goods['money']; $params['title'] = $set['shop']['name'] . (empty($goods['type']) ? "积分兑换" : '积分抽奖') . ' 单号:' . $log['logno']; load()->model('payment'); $setting = uni_setting($_W['uniacid'], array('payment')); if (is_array($setting['payment'])) { $options = $setting['payment']['wechat']; $options['appid'] = $_W['account']['key']; $options['secret'] = $_W['account']['secret']; $wechat = m('common')->wechat_build($params, $options, 2); $wechat['success'] = false; if (!is_error($wechat)) { $wechat['success'] = true; } else { show_json(0, $wechat['message']); } } if (!$wechat['success']) { show_json(0, '微信支付参数错误!'); }
} if ($_W['isfounder']) { $notify['sms']['balance'] = intval($_GPC['balance']); $notify['sms']['signature'] = trim($_GPC['signature']); $notify = iserializer($notify); $updatedata['notify'] = $notify; } pdo_update('uni_settings', $updatedata, array('uniacid' => $id)); pdo_update('uni_account', $uniaccount, array('uniacid' => $id)); module_build_privileges(); message('更新公众号成功!', referer(), 'success'); } $account = array(); if (!empty($id)) { $account = pdo_fetch("SELECT * FROM " . tablename('uni_account') . " WHERE uniacid = :id", array(':id' => $id)); $settings = uni_setting($id, array('notify', 'groupdata')); $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP); $notify = $settings['notify'] ? $settings['notify'] : array(); } else { $groupdata = array('isexpire' => 0, 'oldgroupid' => '', 'endtime' => TIMESTAMP); } $group = array(); if (empty($_W['isfounder'])) { $group = pdo_fetch("SELECT * FROM " . tablename('users_group') . " WHERE id = '{$_W['user']['groupid']}'"); $group['package'] = uni_groups((array) iunserializer($group['package'])); } else { $group['package'] = uni_groups(); } template('account/post'); } if ($do == 'list') {
<?php /** * [Weizan System] Copyright (c) 2014 wdlcms.com * Weizan is NOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $dos = array('display', 'post', 'del', 'default', 'copy', 'quickmenu'); $do = in_array($do, $dos) ? $do : 'display'; $setting = uni_setting($_W['uniacid'], 'default_site'); $default_site = intval($setting['default_site']); if ($do == 'quickmenu') { $id = intval($_GPC['mtid']); $multi = pdo_fetch('SELECT id,quickmenu FROM ' . tablename('site_multi') . ' WHERE uniacid = :uniacid AND id = :id', array(':uniacid' => $_W['uniacid'], ':id' => $id)); if (empty($multi)) { message('微站不存在或已删除', referer(), 'error'); } $modules = uni_modules(); $quickmenu = iunserializer($multi['quickmenu']); if (!is_array($quickmenu)) { $quickmenu = array(); } if (checksubmit('submit')) { $module = array(); if (!empty($_GPC['module'])) { foreach ($_GPC['module'] as $row) { if (isset($modules[$row])) { $module[] = $row; } } }
$acid = intval($qr['acid']); if (intval($accounts[$acid]['level']) < 4) { continue; } if (intval($qr['model']) == 1) { $accounts[$acid]['qr1num'] = $qr['num']; $tyqr['qr1num'] += $qr['num']; } else { $accounts[$acid]['qr2num'] = $qr['num']; $tyqr['qr2num'] += $qr['num']; } } } if ($do == 'site') { $title = '微站功能概况'; $setting = uni_setting($_W['uniacid'], array('default_site')); $default_site = intval($setting['default_site']); $setting = pdo_fetch('SELECT styleid,id,quickmenu FROM ' . tablename('site_multi') . ' WHERE uniacid =:uniacid AND id = :id ', array(':uniacid' => $_W['uniacid'], ':id' => $setting['default_site'])); $templates_id = pdo_fetchcolumn('SELECT templateid FROM ' . tablename('site_styles') . ' WHERE id = :id', array(':id' => $setting['styleid'])); $template = pdo_fetch('SELECT * FROM ' . tablename('site_templates') . ' WHERE id = :id ', array(':id' => $templates_id)); $sql = "SELECT rid FROM " . tablename('cover_reply') . ' WHERE `module` = :module AND uniacid = :uniacid AND multiid = :multiid'; $pars = array(); $pars[':module'] = 'site'; $pars[':uniacid'] = $_W['uniacid']; $pars[':multiid'] = $setting['id']; $cover = pdo_fetch($sql, $pars); if (!empty($cover['rid'])) { $keywords = pdo_fetchall("SELECT content FROM " . tablename('rule_keyword') . " WHERE rid = :rid", array(':rid' => $cover['rid'])); } load()->model('app'); $home_navs = app_navs('home', $setting['id']);
protected function getcreditname($key) { $creditnames = uni_setting($_W['uniacid'], array('creditnames')); if ($creditnames) { foreach ($creditnames['creditnames'] as $index => $creditname) { if ($creditname['enabled'] == 0) { unset($creditnames['creditnames'][$index]); } } $select_credit = implode(', ', array_keys($creditnames['creditnames'])); } else { $select_credit = ''; } return $creditnames['creditnames'][$key]['title']; }
if ($update['type'] == 1) { unset($update['type']); pdo_update('account_wechats', $update, array('acid' => $acid, 'uniacid' => $uniacid)); } else { if ($update['type'] == 2) { unset($update['type']); unset($update['encodingaeskey']); pdo_update('account_yixin', $update, array('acid' => $acid, 'uniacid' => $uniacid)); } else { if ($update['type'] == 3) { unset($update['type']); pdo_update('account_alipay', $update, array('acid' => $acid, 'uniacid' => $uniacid)); } } } $oauth = uni_setting($uniacid, array('oauth')); if ($acid && !empty($update['key']) && !empty($update['secret']) && empty($oauth['oauth']['account'])) { pdo_update('uni_settings', array('oauth' => iserializer(array('status' => 1, 'account' => $acid))), array('uniacid' => $uniacid)); } if (!empty($_FILES['qrcode']['tmp_name'])) { $_W['uploadsetting'] = array(); $_W['uploadsetting']['image']['folder'] = ''; $_W['uploadsetting']['image']['extentions'] = array('jpg'); $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit']; $upload = file_upload($_FILES['qrcode'], 'image', "qrcode_{$acid}"); } if (!empty($_FILES['headimg']['tmp_name'])) { $_W['uploadsetting'] = array(); $_W['uploadsetting']['image']['folder'] = ''; $_W['uploadsetting']['image']['extentions'] = array('jpg'); $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit'];
function mc_notice_init() { global $_W; if (empty($_W['account'])) { $_W['account'] = uni_fetch($_W['uniacid']); } if (empty($_W['account'])) { return error(-1, '创建公众号操作类失败'); } if ($_W['account']['level'] < 3) { return error(-1, '公众号没有经过认证,不能使用模板消息和客服消息'); } $acc = WeAccount::create(); if (is_null($acc)) { return error(-1, '创建公众号操作对象失败'); } $setting = uni_setting(); $noticetpl = $setting['tplnotice']; $acc->noticetpl = $noticetpl; if (!is_array($acc->noticetpl)) { return error(-1, '微信通知参数错误'); } return $acc; }
$ms[] = $m['name']; } foreach ($s as $k => $v) { if ($v != '' && !in_array($v, $ms)) { message($mtypes[$k] . "选择的处理模块无效. "); } } $row = array(); $row['default_message'] = iserializer($s); if (pdo_update('uni_settings', $row, array('uniacid' => $_W['uniacid'])) !== FALSE) { message('保存特殊类型消息处理成功.', 'refresh'); } else { message('保存失败, 请稍后重试. '); } } $setting = uni_setting($_W['uniacid'], array('default_message')); $ds = array(); foreach ($mtypes as $k => $v) { $row = array(); $row['type'] = $k; $row['title'] = $v; $row['handles'] = array(); foreach ($_W['account']['modules'] as $m) { if (is_array($_W['account']['modules'][$m['name']]['handles']) && in_array($k, $_W['account']['modules'][$m['name']]['handles'])) { $row['handles'][] = array('name' => $m['name'], 'title' => $_W['account']['modules'][$m['name']]['title']); } } $row['empty'] = empty($row['handles']); $row['current'] = is_array($setting['default_message']) ? $setting['default_message'][$k] : ''; $ds[] = $row; }
public function doMobileOrder() { global $_GPC, $_W; $this->check_login(); $paysetting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors')); $_W['account'] = array_merge($_W['account'], $paysetting); $isauto = $this->_user_info['isauto']; $hid = intval($_GPC['hid']); $id = intval($_GPC['id']); $weid = $this->_weid; $price = $_GPC['price']; if (empty($hid) || empty($id)) { message("参数错误1!"); } $search_array = $this->getSearchArray(); if (!$search_array || empty($search_array['btime']) || empty($search_array['day'])) { $url = $this->createMobileUrl('index'); header("Location: {$url}"); } $is_submit = checksubmit(); $sql = 'SELECT `title`, `mail`, `phone`, `thumb`, `description` FROM ' . tablename('hotel2') . ' WHERE `id` = :id'; $reply = pdo_fetch($sql, array(':id' => $hid)); if (empty($reply)) { if ($is_submit) { die(json_encode(array("result" => 0, "error" => "酒店未找到!"))); } else { message('酒店未找到, 请联系管理员!'); } } // 设置分享信息 $shareTitle = $reply['title']; $shareDesc = $reply['description']; $shareThumb = tomedia($reply['thumb']); if ($this->_set_info['is_unify'] == 1) { $tel = $this->_set_info['tel']; } else { $tel = $reply['phone']; } $pricefield = $this->_user_info['isauto'] == 1 ? 'cprice' : 'mprice'; $sql = "SELECT *, {$pricefield} AS roomprice FROM " . tablename('hotel2_room') . " WHERE `id` = :id AND `hotelid` = :hotelid "; $room = pdo_fetch($sql, array(':id' => $id, ':hotelid' => $hid)); if (empty($room)) { if ($is_submit) { die(json_encode(array("result" => 0, "error" => "房型未找到!"))); } else { message("房型未找到, 请联系管理员!"); } } // 入住 $btime = $search_array['btime']; $bdate = $search_array['bdate']; // 住几天 $days = intval($search_array['day']); // 离店 $etime = $search_array['etime']; $edate = $search_array['edate']; $date_array = array(); $date_array[0]['date'] = $bdate; $date_array[0]['day'] = date('j', $btime); $date_array[0]['time'] = $btime; $date_array[0]['month'] = date('m', $btime); if ($days > 1) { for ($i = 1; $i < $days; $i++) { $date_array[$i]['time'] = $date_array[$i - 1]['time'] + 86400; $date_array[$i]['date'] = date('Y-m-d', $date_array[$i]['time']); $date_array[$i]['day'] = date('j', $date_array[$i]['time']); $date_array[$i]['month'] = date('m', $date_array[$i]['time']); } } $sql = 'SELECT `id`, `roomdate`, `num`, `status` FROM ' . tablename('hotel2_room_price') . ' WHERE `roomid` = :roomid AND `roomdate` >= :btime AND `roomdate` < :etime AND `status` = :status'; $params = array(':roomid' => $id, ':btime' => $btime, ':etime' => $etime, ':status' => '1'); $room_date_list = pdo_fetchall($sql, $params); $flag = intval($room_date_list); $list = array(); $max_room = 8; $is_order = 1; if ($flag == 1) { for ($i = 0; $i < $days; $i++) { $k = $date_array[$i]['time']; foreach ($room_date_list as $p_key => $p_value) { // 判断价格表中是否有当天的数据 if ($p_value['roomdate'] == $k) { $room_num = $p_value['num']; if (empty($room_num)) { $is_order = 0; $max_room = 0; $list['num'] = 0; $list['date'] = $date_array[$i]['date']; } else { if ($room_num > 0 && $room_num < $max_room) { $max_room = $room_num; $list['num'] = $room_num; $list['date'] = $date_array[$i]['date']; } } break; } } } } if ($max_room == 0) { $msg = $list['date'] . '当天没有空房间了,请选择其他房型。'; $url = $this->createMobileUrl('error', array('msg' => $msg)); header("Location: {$url}"); exit; } $user_info = hotel_get_userinfo(); $memberid = intval($user_info['id']); // 显示会员价还是普通价 $pricefield = $isauto == 1 ? 'cprice' : 'mprice'; $r_sql = 'SELECT `roomdate`, `num`, `status`, ' . $pricefield . ' AS `m_price` FROM ' . tablename('hotel2_room_price') . ' WHERE `roomid` = :roomid AND `weid` = :weid AND `hotelid` = :hotelid AND `roomdate` >= :btime AND ' . ' `roomdate` < :etime'; $params = array(':roomid' => $id, ':weid' => $weid, ':hotelid' => $hid, ':btime' => $btime, ':etime' => $etime); $price_list = pdo_fetchall($r_sql, $params); $this_price = $old_price = $room['roomprice']; $totalprice = $old_price * $days; if ($price_list) { //价格表中存在 $check_date = array(); foreach ($price_list as $k => $v) { $new_price = $v['m_price']; $roomdate = $v['roomdate']; if ($v['status'] == 0 || $v['num'] == 0) { $has = 0; } else { if ($new_price && $roomdate) { if (!in_array($roomdate, $check_date)) { $check_date[] = $roomdate; if ($old_price != $new_price) { $totalprice = $totalprice - $old_price + $new_price; } } } } } $this_price = round($totalprice / $days); } if ($is_submit) { $from_user = $this->_from_user; $name = $_GPC['uname']; $contact_name = $_GPC['contact_name']; $mobile = $_GPC['mobile']; if (empty($name)) { die(json_encode(array("result" => 0, "error" => "入住人不能为空!"))); } if (empty($contact_name)) { die(json_encode(array("result" => 0, "error" => "联系人不能为空!"))); } if (empty($mobile)) { die(json_encode(array("result" => 0, "error" => "手机号不能为空!"))); } if ($_GPC['nums'] > $max_room) { die(json_encode(array("result" => 0, "error" => "您的预定数量超过最大限制!"))); } $insert = array('weid' => $weid, 'ordersn' => date('md') . sprintf("%04d", $_W['fans']['id']) . random(4, 1), 'hotelid' => $hid, 'openid' => $from_user, 'roomid' => $id, 'memberid' => $memberid, 'name' => $name, 'contact_name' => $contact_name, 'mobile' => $mobile, 'btime' => $search_array['btime'], 'etime' => $search_array['etime'], 'day' => $search_array['day'], 'style' => $room['title'], 'nums' => intval($_GPC['nums']), 'oprice' => $room['oprice'], 'cprice' => $room['cprice'], 'mprice' => $room['mprice'], 'time' => TIMESTAMP, 'paytype' => $_GPC['paytype']); $insert[$pricefield] = $this_price; $insert['sum_price'] = $totalprice * $insert['nums']; pdo_insert('hotel2_order', $insert); $order_id = pdo_insertid(); //如果有接受订单的邮件, if (!empty($reply['mail'])) { $subject = "微信公共帐号 [" . $_W['account']['name'] . "] 微酒店订单提醒."; $body = "您后台有一个预定订单: <br/><br/>"; $body .= "预定酒店: " . $reply['title'] . "<br/>"; $body .= "预定房型: " . $room['title'] . "<br/>"; $body .= "预定数量: " . $insert['nums'] . "<br/>"; $body .= "预定价格: " . $insert['sum_price'] . "<br/>"; $body .= "预定人: " . $insert['name'] . "<br/>"; $body .= "预定电话: " . $insert['mobile'] . "<br/>"; $body .= "到店时间: " . $bdate . "<br/>"; $body .= "离店时间: " . $edate . "<br/><br/>"; $body .= "请您到管理后台仔细查看. <a href='" . $_W['siteroot'] . create_url('member/login') . "' target='_blank'>立即登录后台</a>"; load()->func('communication'); $result = ihttp_email($reply['mail'], $subject, $body); if ($insert['paytype'] == '3') { global $_GPC, $_W; $weid = $this->_weid; $sql = 'SELECT * FROM ' . tablename('hotel2_order') . ' WHERE id = :id AND weid = :weid'; $order = pdo_fetch($sql, array(':id' => $order_id, ':weid' => $weid)); $sql = 'SELECT email FROM ' . tablename('hotel2_set') . ' WHERE weid = :weid'; $setInfo = pdo_fetch($sql, array(':weid' => $_W['uniacid'])); if ($setInfo['email']) { $body = "<h3>酒店订单</h3> <br />"; $body .= '订单编号:' . $order['ordersn'] . '<br />'; $body .= '姓名:' . $order['name'] . '<br />'; $body .= '手机:' . $order['mobile'] . '<br />'; $body .= '房型:' . $order['style'] . '<br />'; $body .= '订购数量' . $order['nums'] . '<br />'; $body .= '原价:' . $order['oprice'] . '<br />'; $body .= '会员价:' . $order['mprice'] . '<br />'; $body .= '入住日期:' . date('Y-m-d', $order['btime']) . '<br />'; $body .= '退房日期:' . date('Y-m-d', $order['etime']) . '<br />'; $body .= '总价:' . $order['sum_price']; // 发送邮件提醒 if (!empty($setInfo['email'])) { load()->func('communication'); ihttp_email($setInfo['email'], '微酒店订单提醒', $body); } } } } $url = $this->createMobileUrl('orderdetail', array('id' => $order_id)); die(json_encode(array("result" => 1, "url" => $url))); } else { $price = $totalprice; $member = array(); $member['from_user'] = $this->_from_user; $record = hotel_member_single($member); if ($record) { $realname = $record['realname']; $mobile = $record['mobile']; } else { $fans = pdo_fetch("SELECT id, realname, mobile FROM " . tablename('fans') . " WHERE from_user = :from_user limit 1", array(':from_user' => $this->_from_user)); if (!empty($fans)) { $realname = $fans['realname']; $mobile = $fans['mobile']; } } include $this->template('order'); } }
<?php /** * [Weizan System] Copyright (c) 2014 wdlcms.com * Weizan is NOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $dos = array('home', 'profile', 'uc'); $do = in_array($do, $dos) ? $do : 'home'; $foo = $_GPC['foo'] == 'bind' || $_GPC['foo'] == '' ? 'bind' : 'unbind'; $setting = uni_setting($_W['uniacid'], array('uc')); if ($foo == 'bind') { if ($setting['uc']['status'] == '1') { $uc = $setting['uc']; $sql = 'SELECT * FROM ' . tablename('mc_mapping_ucenter') . ' WHERE `uniacid`=:uniacid AND `uid`=:uid'; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':uid'] = $_W['member']['uid']; $mapping = pdo_fetch($sql, $pars); if (empty($mapping)) { $op = trim($_GPC['op']); if ($op == 'yes') { if (checksubmit('submit')) { $username = trim($_GPC['username']) ? trim($_GPC['username']) : message('请填写用户名!', '', 'error'); $password = trim($_GPC['password']) ? trim($_GPC['password']) : message('请填写密码!', '', 'error'); mc_init_uc(); $data = uc_user_login($username, $password); if ($data[0] < 0) { if ($data[0] == -1) { message('用户不存在,或者被删除!', '', 'error'); } elseif ($data[0] == -2) {
<?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()->func('communication'); $setting = uni_setting($_W['uniacid'], array('oauth', 'passport')); $oauth = $setting['oauth']; $scope = $_GPC['scope']; if (!empty($oauth['account'])) { $account = account_fetch($oauth['account']); $code = $_GPC['code']; if (!empty($code)) { $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$account['key']}&secret={$account['secret']}&code={$code}&grant_type=authorization_code"; $ret = ihttp_get($url); if (!is_error($ret)) { $auth = @json_decode($ret['content'], true); if (is_array($auth) && !empty($auth['openid'])) { $_SESSION['openid'] = $auth['openid']; $sql = 'SELECT `fanid`,`salt`,`uid` FROM ' . tablename('mc_mapping_fans') . ' WHERE `uniacid`=:uniacid AND `acid`=:acid AND `openid`=:openid'; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':acid'] = $_W['acid'] ? $_W['acid'] : $account['acid']; $pars[':openid'] = $auth['openid']; $fan = pdo_fetch($sql, $pars); if (empty($fan)) { $uid = 0; if (!isset($setting['passport']) || empty($setting['passport']['focusreg'])) { $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
function activity_module_card_grant($uid, $couponid, $module = '', $remark = '') { global $_W; $uid = intval($uid); $user = mc_fetch($uid, array('groupid')); $groupid = $user['groupid']; $couponid = intval($couponid); $coupon = pdo_fetch("SELECT * FROM " . tablename('activity_coupon') . " WHERE `couponid` = :couponid LIMIT 1", array(':couponid' => $couponid)); $pcount = pdo_fetchcolumn("SELECT count(*) FROM " . tablename('activity_coupon_record') . " WHERE `uid` = :uid AND `couponid` = :couponid", array(':couponid' => $couponid, ':uid' => $uid)); $coupongroup = pdo_fetchall("SELECT groupid FROM " . tablename('activity_coupon_allocation') . " WHERE `couponid` = :couponid", array(':couponid' => $couponid), 'groupid'); $group = array_keys($coupongroup); $couponmodules = pdo_fetchall("SELECT module FROM " . tablename('activity_coupon_modules') . " WHERE `couponid` = :couponid", array(':couponid' => $couponid), 'module'); $modules = array_keys($couponmodules); if (empty($coupon)) { return error(-1, '未找到指定优惠券'); } elseif (!in_array($module, $modules)) { return error(-1, '该优惠券只能在特定的模块中领取'); } elseif (empty($coupongroup)) { return error(-1, '该优惠券未指定可使用的会员组'); } elseif (!in_array($groupid, $group)) { return error(-1, '您所在的用户组没有领取该优惠券的权限'); } elseif ($coupon['starttime'] > TIMESTAMP) { return error(-1, '优惠券活动尚未开始'); } elseif ($coupon['endtime'] < TIMESTAMP) { return error(-1, '优惠券活动已经结束'); } elseif ($coupon['dosage'] >= $coupon['amount']) { return error(-1, '优惠券已经发放完毕'); } elseif ($pcount >= $coupon['limit']) { return error(-1, '用户领取优惠券数量已经超过限制'); } $creditnames = array(); $unisettings = uni_setting($_W['uniacid'], array('creditnames')); if (!empty($unisettings) && !empty($unisettings['creditnames'])) { foreach ($unisettings['creditnames'] as $key => $credit) { $creditnames[$key] = $credit['title']; } } $credit = mc_credit_fetch($uid, array($coupon['credittype'])); if ($credit[$coupon['credittype']] < $coupon['credit']) { return error(-1, '您的' . $creditnames[$coupon['credittype']] . '数量不够,无法兑换.'); } mc_credit_update($uid, $coupon['credittype'], -1 * $coupon['credit'], array($uid, '优惠券兑换:' . $coupon['title'] . ' 消耗 ' . $creditnames[$coupon['credittype']] . ':' . $coupon['credit'])); $remark = "通过{$module}模块领取优惠券"; $insert = array('couponid' => $couponid, 'uniacid' => $_W['uniacid'], 'uid' => $uid, 'grantmodule' => $module, 'granttime' => TIMESTAMP, 'status' => 1, 'remark' => $remark); pdo_insert('activity_coupon_record', $insert); pdo_update('activity_coupon', array('dosage' => $coupon['dosage'] + 1), array('couponid' => $couponid)); return $coupon; }