コード例 #1
0
ファイル: site.php プロジェクト: eduNeusoft/weixin
 public function payResult($params)
 {
     global $_GPC, $_W;
     $weid = $this->_weid;
     $sql = 'SELECT * FROM ' . tablename('hotel2_order') . ' WHERE `id` = :id AND `weid` = :weid';
     $order = pdo_fetch($sql, array(':id' => $params['tid'], ':weid' => $weid));
     pdo_update('hotel2_order', array('paystatus' => 1), array('id' => $params['tid']));
     $sql = 'SELECT `email`, `mobile` 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);
         }
     }
     if ($setInfo['mobile']) {
         // 发送短信提醒
         if (!empty($setInfo['mobile'])) {
             load()->model('cloud');
             cloud_prepare();
             $body = '用户' . $order['name'] . ',电话:' . $order['mobile'] . '于' . date('m月d日H:i') . '成功支付微酒店订单' . $order['ordersn'] . ',总金额' . $order['sum_price'] . '元' . '.' . random(3);
             cloud_sms_send($setInfo['mobile'], $body);
         }
     }
     if ($params['from'] == 'return') {
         $roomid = $order['roomid'];
         $room = pdo_fetch("SELECT score FROM " . tablename('hotel2_room') . " WHERE id = {$roomid} AND weid = {$weid} LIMIT 1");
         $score = intval($room['score']);
         if ($score) {
             $from_user = $this->_from_user;
             pdo_fetch("UPDATE " . tablename('hotel2_member') . " SET score = (score + " . $score . ") WHERE from_user = '******' AND weid = " . $weid . "");
             if ($_W['member']['uid'] > 0) {
                 pdo_query("UPDATE " . tablename('mc_members') . " SET credit1 = (credit1 + " . $score . ") WHERE uid = '" . $_W['member']['uid'] . "' AND uniacid = " . $_W['uniacid'] . "");
             }
         }
         message('支付成功!', '../../app/' . $this->createMobileUrl('orderdetail', array("id" => $order['id'])), 'success');
     }
 }
コード例 #2
0
ファイル: process.ctrl.php プロジェクト: eduNeusoft/weixin
stonefish_planting<?php 
/**
 * [WeEngine System] Copyright (c) 2014 012wz.com
 * WeEngine is NOT a free software, it under the license terms, visited http://bbs.52jscn.com/ for more details.
 */
load()->func('communication');
load()->model('cloud');
$r = cloud_prepare();
if (is_error($r)) {
    message($r['message'], url('cloud/profile'), 'error');
}
$step = $_GPC['step'];
$steps = array('files', 'schemas', 'scripts');
$step = in_array($step, $steps) ? $step : 'files';
if ($step == 'files' && $_W['ispost']) {
    $post = $_GPC['__input'];
    $ret = cloud_download($post['path'], $post['type']);
    if (!is_error($ret)) {
        exit('success');
    }
    exit;
}
if ($step == 'scripts' && $_W['ispost']) {
    $post = $_GPC['__input'];
    $fname = $post['fname'];
    $entry = IA_ROOT . '/data/update/' . $fname;
    if (is_file($entry) && preg_match('/^update\\(\\d{12}\\-\\d{12}\\)\\.php$/', $fname)) {
        $evalret = (include $entry);
        if (!empty($evalret)) {
            cache_build_users_struct();
            cache_build_setting();
コード例 #3
0
ファイル: site.php プロジェクト: aspnmy/weizan
 public function doMobileResearch()
 {
     global $_W, $_GPC;
     $reid = intval($_GPC['id']);
     $sql = 'SELECT * FROM ' . tablename('research') . ' WHERE `weid`=:weid AND `reid`=:reid';
     $params = array();
     $params[':weid'] = $_W['uniacid'];
     $params[':reid'] = $reid;
     $activity = pdo_fetch($sql, $params);
     if (empty($_W['fans']['openid'])) {
         message('请先关注公众号再来参加活动吧!');
     }
     if ($activity['status'] != '1') {
         message('当前预约活动已经停止.');
     }
     if (!$activity) {
         message('非法访问.');
     }
     if ($activity['starttime'] > TIMESTAMP) {
         message('当前预约活动还未开始!');
     }
     if ($activity['endtime'] < TIMESTAMP) {
         message('当前预约活动已经结束!');
     }
     $title = $activity['title'];
     $sql = 'SELECT * FROM ' . tablename('research_fields') . ' WHERE `reid` = :reid ORDER BY `displayorder` DESC, `refid`';
     $params = array();
     $params[':reid'] = $reid;
     $ds = pdo_fetchall($sql, $params);
     if (!$ds) {
         message('非法访问.');
     }
     $initRange = $initCalendar = false;
     $binds = array();
     foreach ($ds as &$r) {
         if ($r['type'] == 'range') {
             $initRange = true;
         }
         if ($r['type'] == 'calendar') {
             $initCalendar = true;
         }
         if ($r['value']) {
             $r['options'] = explode(',', $r['value']);
         }
         if ($r['bind']) {
             $binds[$r['type']] = $r['bind'];
         }
         if ($r['type'] == 'reside') {
             $reside = $r;
         }
     }
     if (checksubmit('submit')) {
         $sql = 'SELECT COUNT(*) FROM ' . tablename('research_rows') . ' WHERE `reid` = :reid AND `openid` = :openid';
         $params = array(':reid' => $reid, ':openid' => $_W['fans']['from_user']);
         $pretotal = pdo_fetchcolumn($sql, $params);
         if ($pretotal >= $activity['pretotal']) {
             message('抱歉,每人只能预约' . $activity['pretotal'] . "次!", referer(), 'error');
         }
         $sql = 'SELECT `rerid` FROM ' . tablename('research_rows') . ' WHERE `reid` = :reid GROUP BY `openid`';
         unset($params[':openid']);
         $allTotal = pdo_fetchall($sql, $params);
         if (count($allTotal) >= $activity['alltotal']) {
             pdo_update('research', array('endtime' => TIMESTAMP), array('reid' => $reid));
             message('当前预约活动已经结束!');
         }
         $row = array();
         $row['reid'] = $reid;
         $row['openid'] = $_W['fans']['from_user'];
         $row['createtime'] = TIMESTAMP;
         $datas = $fields = $update = array();
         foreach ($ds as $value) {
             $fields[$value['refid']] = $value;
         }
         foreach ($_GPC as $key => $value) {
             if (strexists($key, 'field_')) {
                 $bindFiled = substr(strrchr($key, '_'), 1);
                 if (!empty($bindFiled)) {
                     $update[$bindFiled] = $value;
                 }
                 $refid = intval(str_replace('field_', '', $key));
                 $field = $fields[$refid];
                 if ($refid && $field) {
                     $entry = array();
                     $entry['reid'] = $reid;
                     $entry['rerid'] = 0;
                     $entry['refid'] = $refid;
                     if (in_array($field['type'], array('number', 'text', 'calendar', 'email', 'textarea', 'radio', 'range', 'select', 'image'))) {
                         $entry['data'] = strval($value);
                     }
                     if (in_array($field['type'], array('checkbox'))) {
                         if (!is_array($value)) {
                             continue;
                         }
                         $entry['data'] = implode(';', $value);
                     }
                     $datas[] = $entry;
                 }
             }
         }
         if ($_FILES) {
             load()->func('file');
             foreach ($_FILES as $key => $file) {
                 if (strexists($key, 'field_')) {
                     $refid = intval(str_replace('field_', '', $key));
                     $field = $fields[$refid];
                     if ($refid && $field && $file['name'] && $field['type'] == 'image') {
                         $entry = array();
                         $entry['reid'] = $reid;
                         $entry['rerid'] = 0;
                         $entry['refid'] = $refid;
                         $ret = file_upload($file);
                         if (!$ret['success']) {
                             message('上传图片失败, 请稍后重试.');
                         }
                         $entry['data'] = trim($ret['path']);
                         $datas[] = $entry;
                     }
                 }
             }
         }
         // 兼容会员居住地字段
         if (!empty($_GPC['reside'])) {
             if (in_array('reside', $binds)) {
                 $update['resideprovince'] = $_GPC['reside']['province'];
                 $update['residecity'] = $_GPC['reside']['city'];
                 $update['residedist'] = $_GPC['reside']['district'];
             }
             foreach ($_GPC['reside'] as $key => $value) {
                 $resideData = array('reid' => $reside['reid']);
                 $resideData['rerid'] = 0;
                 $resideData['refid'] = $reside['refid'];
                 $resideData['data'] = $value;
                 $datas[] = $resideData;
             }
         }
         // 更新关联会员资料
         if (!empty($update)) {
             load()->model('mc');
             mc_update($_W['member']['uid'], $update);
         }
         if (empty($datas)) {
             message('非法访问.', '', 'error');
         }
         if (pdo_insert('research_rows', $row) != 1) {
             message('保存失败.');
         }
         $rerid = pdo_insertid();
         if (empty($rerid)) {
             message('保存失败.');
         }
         foreach ($datas as &$r) {
             $r['rerid'] = $rerid;
             pdo_insert('research_data', $r);
         }
         if (empty($activity['starttime'])) {
             $record = array();
             $record['starttime'] = TIMESTAMP;
             pdo_update('research', $record, array('reid' => $reid));
         }
         if (!empty($datas)) {
             $image = $body = '';
             foreach ($datas as $row) {
                 if (substr($row['data'], 0, 6) != 'images') {
                     $body .= '<h4>' . $fields[$row['refid']]['title'] . ':' . $row['data'] . '</h4>';
                 } else {
                     $image .= '<p>' . $fields[$row['refid']]['title'] . ': <img src="' . tomedia($row['data']) . '" /></p>';
                 }
             }
             // 发送邮件提醒
             if (!empty($activity['noticeemail'])) {
                 load()->func('communication');
                 ihttp_email($activity['noticeemail'], $activity['title'] . '的预约提醒', $image . $body);
             }
             // 发送短信提醒
             if (!empty($activity['mobile'])) {
                 load()->model('cloud');
                 cloud_prepare();
                 $body = '项目' . $activity['title'] . '于' . date('Y-m-d H:i') . '有了新的预约信息,请到后台查看具体内容.' . random(3);
                 cloud_sms_send($activity['mobile'], $body);
             }
         }
         message($activity['information'], 'refresh');
     }
     // 兼容会员居住地字段
     foreach ($binds as $key => $value) {
         if ($value == 'reside') {
             unset($binds[$key]);
             $binds[] = 'resideprovince';
             $binds[] = 'residecity';
             $binds[] = 'residedist';
             break;
         }
     }
     if (!empty($_W['fans']['from_user']) && !empty($binds)) {
         $profile = fans_search($_W['fans']['from_user'], $binds);
         if ($profile['gender']) {
             if ($profile['gender'] == '0') {
                 $profile['gender'] = '保密';
             }
             if ($profile['gender'] == '1') {
                 $profile['gender'] = '男';
             }
             if ($profile['gender'] == '2') {
                 $profile['gender'] = '女';
             }
         }
         foreach ($ds as &$r) {
             if ($profile[$r['bind']]) {
                 $r['default'] = $profile[$r['bind']];
             }
         }
     }
     load()->func('tpl');
     include $this->template('submit');
 }
コード例 #4
0
<?php

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
load()->model('cloud');
load()->func('communication');
$do = !empty($_GPC['do']) && in_array($do, array('module', 'system')) ? $_GPC['do'] : exit('Access Denied');
$result = cloud_prepare();
if (is_error($result)) {
    message($result['message'], '', 'ajax');
}
if ($do == 'module') {
    $info = cloud_m_info(trim($_GPC['m']));
    if (is_error($info) && $info['errno'] == -10) {
        message($info, '', 'ajax');
    }
}
コード例 #5
0
<?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.
 */
load()->model('cloud');
$dos = array('auth', 'build', 'schema', 'download', 'module.query', 'module.info', 'module.build', 'theme.query', 'theme.info', 'theme.build', 'application.build');
$do = in_array($do, $dos) ? $do : '';
if (empty($do)) {
    exit;
}
if ($do != 'auth') {
    if (is_error(cloud_prepare())) {
        exit('cloud service is unavailable.');
    }
}
$post = file_get_contents('php://input');
if ($do == 'auth') {
    $secret = random(32);
    $auth = @json_decode(base64_decode($post), true);
    if (empty($auth)) {
        exit;
    }
    $auth['secret'] = $secret;
    cache_write('cloud:auth:transfer', $auth);
    exit($secret);
}
if ($do == 'build') {
    $dat = __secure_decode($post);
    if (!empty($dat)) {
コード例 #6
0
ファイル: site.php プロジェクト: eduNeusoft/weixin
 public function payResult($params)
 {
     global $_W;
     $fee = intval($params['fee']);
     $data = array('status' => $params['result'] == 'success' ? 1 : 0);
     $paytype = array('credit' => '1', 'wechat' => '2', 'alipay' => '2', 'delivery' => '3');
     // 卡券代金券备注
     if (!empty($params['is_usecard'])) {
         $cardType = array('1' => '微信卡券', '2' => '系统代金券');
         $data['paydetail'] = '使用' . $cardType[$params['card_type']] . '支付了' . ($params['fee'] - $params['card_fee']);
         $data['paydetail'] .= '元,实际支付了' . $params['card_fee'] . '元。';
     }
     $data['paytype'] = $paytype[$params['type']];
     if ($params['type'] == 'wechat') {
         $data['transid'] = $params['tag']['transaction_id'];
     }
     if ($params['type'] == 'delivery') {
         $data['status'] = 1;
     }
     $goods = pdo_fetchall("SELECT `goodsid`, `total` FROM " . tablename('shopping_order_goods') . " WHERE `orderid` = :orderid", array(':orderid' => $params['tid']));
     if (!empty($goods)) {
         $row = array();
         foreach ($goods as $row) {
             $goodsInfo = pdo_fetch("SELECT `total`, `totalcnf`, `sales` FROM " . tablename('shopping_goods') . " WHERE `id` = :id", array(':id' => $row['goodsid']));
             $goodsupdate = array();
             if ($goodsInfo['totalcnf'] == '1' && !empty($goodsInfo['total'])) {
                 $goodsupdate['total'] = $goodsInfo['total'] - $row['total'];
                 $goodsupdate['total'] = $goodsupdate['total'] < 0 ? 0 : $goodsupdate['total'];
             }
             $goodsupdate['sales'] = $goodsInfo['sales'] + $row['total'];
             pdo_update('shopping_goods', $goodsupdate, array('id' => $row['goodsid']));
         }
     }
     pdo_update('shopping_order', $data, array('id' => $params['tid']));
     if ($params['from'] == 'return') {
         //积分变更
         $this->setOrderCredit($params['tid']);
         if (!empty($this->module['config']['noticeemail']) || !empty($this->module['config']['mobile'])) {
             $order = pdo_fetch("SELECT `ordersn`, `price`, `paytype`, `from_user`, `address`, `createtime` FROM " . tablename('shopping_order') . " WHERE id = '{$params['tid']}'");
             $ordergoods = pdo_fetchall("SELECT goodsid, total FROM " . tablename('shopping_order_goods') . " WHERE orderid = '{$params['tid']}'", array(), 'goodsid');
             $goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unit, total FROM " . tablename('shopping_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')");
             //				$address = pdo_fetch("SELECT * FROM " . tablename('mc_member_address') . " WHERE id = :id", array(':id' => $order['addressid']));
             $address = explode('|', $order['address']);
             // 邮件提醒
             if (!empty($this->module['config']['noticeemail'])) {
                 $body = "<h3>购买商品清单</h3> <br />";
                 if (!empty($goods)) {
                     foreach ($goods as $row) {
                         $body .= "名称:{$row['title']} ,数量:{$ordergoods[$row['id']]['total']} <br />";
                     }
                 }
                 $paytype = $order['paytype'] == '3' ? '货到付款' : '已付款' . '<br />';
                 $body .= '总金额:' . $order['price'] . '元' . $paytype . '<br />';
                 $body .= '<h3>购买用户详情</h3> <br />';
                 $body .= '真实姓名:' . $address[0] . '<br />';
                 $body .= '地区:' . $address[3] . ' - ' . $address[4] . ' - ' . $address[5] . '<br />';
                 $body .= '详细地址:' . $address[6] . '<br />';
                 $body .= '手机:' . $address[1] . '<br />';
                 load()->func('communication');
                 ihttp_email($this->module['config']['noticeemail'], '微商城订单提醒', $body);
             }
             // 短信提醒
             if (!empty($this->module['config']['mobile'])) {
                 load()->model('cloud');
                 cloud_prepare();
                 $body = '用户' . $address[0] . ',电话:' . $address[1] . '于' . date('m月d日H:i') . '成功支付订单' . $order['ordersn'] . ',总金额' . $order['price'] . '元' . '.' . random(3);
                 cloud_sms_send($this->module['config']['mobile'], $body);
             }
         }
         $setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
         $credit = $setting['creditbehaviors']['currency'];
         if ($params['type'] == $credit) {
             message('支付成功!', $this->createMobileUrl('myorder'), 'success');
         } else {
             message('支付成功!', '../../app/' . $this->createMobileUrl('myorder'), 'success');
         }
     }
 }
コード例 #7
0
ファイル: mass.ctrl.php プロジェクト: zhang19960118/html11
    load()->model('cloud');
    $post = $_GPC['__input'];
    $mass = pdo_get('mc_mass_record', array('uniacid' => $_W['uniacid'], 'id' => intval($post['id'])));
    if (!empty($mass) && $mass['cron_id'] > 0) {
        $status = cron_delete(array($mass['cron_id']));
        if (is_error($status)) {
            message($status, '', 'ajax');
        }
    }
    pdo_delete('mc_mass_record', array('uniacid' => $_W['uniacid'], 'id' => intval($post['id'])));
    message(error(0, ''), '', 'ajax');
}
if ($do == 'post') {
    load()->func('cron');
    load()->model('cloud');
    $cloud = cloud_prepare();
    if (is_error($cloud)) {
        message($cloud, '', 'ajax');
    }
    set_time_limit(0);
    $records = pdo_fetchall('SELECT id, cron_id FROM ' . tablename('mc_mass_record') . ' WHERE uniacid = :uniacid AND sendtime >= :time AND status = 1 ORDER BY sendtime ASC LIMIT 8', array(':uniacid' => $_W['uniacid'], ':time' => strtotime(date('Y-m-d'))), 'id');
    if (!empty($records)) {
        foreach ($records as $re) {
            if (!$re['cron_id']) {
                continue;
            }
            $corn_ids[] = $re['cron_id'];
        }
        if (!empty($corn_ids)) {
            $status = cron_delete($corn_ids);
            if (is_error($status)) {