public function payResult($params) { $fee = intval($params['fee']); $data = array('status' => $params['result'] == 'success' ? 1 : 0); $paytype = array('credit' => '1', 'wechat' => '2', 'alipay' => '2', 'delivery' => '3'); $data['paytype'] = $paytype[$params['type']]; if ($params['type'] == 'wechat') { $data['transid'] = $params['tag']['transaction_id']; } if ($params['type'] == 'delivery') { $data['status'] = 1; } $order = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_order') . " WHERE id = '{$params['tid']}'"); if ($order['status'] != 1) { pdo_update('hx_zhongchou_order', $data, array('id' => $params['tid'])); //$order = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_order') . " WHERE id = '{$params['tid']}'"); $pid = $order['pid']; $item_id = $order['item_id']; $project = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project') . " WHERE id = '{$pid}'"); $item = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project_item') . " WHERE id = '{$item_id}'"); pdo_update('hx_zhongchou_project', array('finish_price' => $project['finish_price'] + $order['item_price'], 'donenum' => $project['donenum'] + 1), array('id' => $pid)); pdo_update('hx_zhongchou_project_item', array('donenum' => $item['donenum'] + 1), array('id' => $item_id)); } if ($params['from'] == 'return') { //积分变更 //$this->setOrderCredit($params['tid']); //邮件提醒 if (!empty($this->module['config']['noticeemail'])) { $address = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_address') . " WHERE id = :id", array(':id' => $order['addressid'])); $body = "<h3>购买众筹项目详情</h3> <br />"; $body .= "名称:{$project['title']} <br />"; $body .= "<br />支持金额:{$item['price']}元 (已付款)<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address['realname']} <br />"; $body .= "地区:{$address['province']} - {$address['city']} - {$address['area']}<br />"; $body .= "详细地址:{$address['address']} <br />"; $body .= "手机:{$address['mobile']} <br />"; load()->func('communication'); ihttp_email($this->module['config']['noticeemail'], '众筹订单提醒', $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'); } } }
$sql .= " AND `email`!=''"; $countSql = 'SELECT COUNT(*)' . $sql; $ret['total'] = pdo_fetchcolumn($countSql, $pars); $ret['total'] = intval($ret['total']); $psize = 1; $pindex = intval($post['next']); $pindex = max(1, $pindex); $start = $psize * ($pindex - 1); $sql = 'SELECT `email`' . $sql . " LIMIT {$start}, {$psize}"; $ds = pdo_fetchall($sql, $pars); if (is_array($ds)) { foreach ($ds as $row) { $str_find = array('../attachment/images', 'resource/components/tinymce/plugins/emoticons/img'); $str_replace = array($_W['siteroot'] . 'attachment/images', $_W['siteroot'] . 'web/resource/components/tinymce/plugins/emoticons/img'); $post['content'] = str_replace($str_find, $str_replace, $post['content']); $r = ihttp_email($row['email'], $post['title'], $post['content']); if (is_error($r)) { $ret['failed']++; } else { $ret['success']++; } } } if ($start + $psize < $ret['total']) { $ret['next'] = $pindex + 1; } } if ($post['type'] == 'sms') { $sql .= " AND `mobile`!=''"; $countSql = 'SELECT COUNT(*)' . $sql; $ret['total'] = pdo_fetchcolumn($countSql, $pars);
public function payResult($params) { global $_W; //if ($params['result'] == 'success' && $params['from'] == 'notify') { $fee = intval($params['fee']); $data = array('status' => $params['result'] == 'success' ? 1 : 0); $paytype = array('credit' => '1', 'wechat' => '2', 'alipay' => '2', 'delivery' => '3'); $data['paytype'] = $paytype[$params['type']]; if ($params['type'] == 'wechat') { $data['transid'] = $params['tag']['transaction_id']; } if ($params['type'] == 'delivery') { $data['status'] = 1; } if (substr($params['tid'], 0, 3) == 'ws-') { $params['tid'] = str_replace('ws-', '', $params['tid']); $order = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_order_ws') . " WHERE id = '{$params['tid']}'"); if ($order['status'] != 1) { pdo_update('hx_zhongchou_order_ws', $data, array('id' => $params['tid'])); $pid = $order['pid']; $project = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project') . " WHERE id = '{$pid}'"); pdo_update('hx_zhongchou_project', array('finish_price' => $project['finish_price'] + $order['item_price']), array('id' => $pid)); } } else { $order = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_order') . " WHERE id = '{$params['tid']}'"); if ($order['status'] != 1) { pdo_update('hx_zhongchou_order', $data, array('id' => $params['tid'])); $pid = $order['pid']; $item_id = $order['item_id']; $project = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project') . " WHERE id = '{$pid}'"); $item = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_project_item') . " WHERE id = '{$item_id}'"); pdo_update('hx_zhongchou_project', array('finish_price' => $project['finish_price'] + $order['item_price'], 'donenum' => $project['donenum'] + 1), array('id' => $pid)); pdo_update('hx_zhongchou_project_item', array('donenum' => $item['donenum'] + 1), array('id' => $item_id)); } //模板消息 $address = pdo_fetch("SELECT * FROM " . tablename('mc_member_address') . " WHERE id = :id", array(':id' => $order['addressid'])); $settings = $this->module['config']; if (!empty($settings['kfid']) && !empty($settings['k_templateid'])) { $kfirst = empty($settings['kfirst']) ? '您有一个新的众筹订单' : $settings['kfirst']; $kfoot = empty($settings['kfoot']) ? '请及时处理,点击可查看详情' : $settings['kfoot']; $kurl = ''; $kdata = array('first' => array('value' => $kfirst, 'color' => '#ff510'), 'keyword1' => array('value' => $order['ordersn'], 'color' => '#ff510'), 'keyword2' => array('value' => '众筹:' . $project['title'], 'color' => '#ff510'), 'keyword3' => array('value' => $order['price'] . '元', 'color' => '#ff510'), 'keyword4' => array('value' => $address['username'], 'color' => '#ff510'), 'keyword5' => array('value' => $params['type'], 'color' => '#ff510'), 'remark' => array('value' => $kfoot, 'color' => '#ff510')); $acc = WeAccount::create(); $acc->sendTplNotice($settings['kfid'], $settings['k_templateid'], $kdata, $kurl, $topcolor = '#FF683F'); } if (!empty($settings['m_templateid'])) { $mfirst = empty($settings['mfirst']) ? '众筹支付成功通知' : $settings['mfirst']; $mfoot = empty($settings['mfoot']) ? '点击查看订单详情' : $settings['mfoot']; $murl = $_W['siteroot'] . 'app' . str_replace('./', '/', $this->createMobileUrl('myorder', array('op' => 'detail', 'orderid' => $order['id']))); $mdata = array('first' => array('value' => $mfirst, 'color' => '#ff510'), 'keyword1' => array('value' => $address['username'], 'color' => '#ff510'), 'keyword2' => array('value' => $order['ordersn'], 'color' => '#ff510'), 'keyword3' => array('value' => $order['price'] . '元', 'color' => '#ff510'), 'keyword4' => array('value' => '众筹:' . $project['title'], 'color' => '#ff510'), 'remark' => array('value' => $mfoot, 'color' => '#ff510')); $acc = WeAccount::create(); $acc->sendTplNotice($order['from_user'], $settings['m_templateid'], $mdata, $murl, $topcolor = '#FF683F'); } //积分变更 //$this->setOrderCredit($params['tid']); //邮件提醒 if (!empty($this->module['config']['noticeemail'])) { $body = "<h3>购买众筹项目详情</h3> <br />"; $body .= "名称:{$project['title']} <br />"; $body .= "<br />支持金额:{$order['price']}元 (已付款)<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address['username']} <br />"; $body .= "地区:{$address['province']} - {$address['city']} - {$address['district']}<br />"; $body .= "详细地址:{$address['address']} <br />"; $body .= "手机:{$address['mobile']} <br />"; load()->func('communication'); ihttp_email($this->module['config']['noticeemail'], '众筹订单提醒', $body); } $setting = uni_setting($_W['uniacid'], array('creditbehaviors')); $credit = $setting['creditbehaviors']['currency']; } //} if ($params['from'] == 'return') { if ($params['type'] == $credit) { message('支付成功!', $this->createMobileUrl('myorder'), 'success'); } else { message('支付成功!', '../../app/' . $this->createMobileUrl('myorder'), 'success'); } } }
if (checksubmit('submit')) { $mail = array('username' => $_GPC['username'], 'password' => $_GPC['password'], 'smtp' => $_GPC['smtp'], 'sender' => $_GPC['sender'], 'signature' => $_GPC['signature']); setting_save($mail, 'mail'); $row = pdo_fetchcolumn("SELECT `notify` FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid'])); $notify = iunserializer($row); if (!is_array($notify)) { $notify['sms'] = array(); $notify['sms']['balance'] = 0; $notify['sms']['signature'] = '系统默认'; } $notify['mail'] = $mail; $update = array(); $update['notify'] = iserializer($notify); pdo_update('uni_settings', $update, array('uniacid' => $_W['uniacid'])); if (!empty($_GPC['testsend']) && !empty($_GPC['receiver'])) { $result = ihttp_email($_GPC['receiver'], $_W['setting']['copyright']['sitename'] . '验证邮件' . date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!'); if (is_error($result)) { message($result['message']); } } message('更新设置成功!', url('system/common')); } if (checksubmit('authmodesubmit')) { $authmode = intval($_GPC['authmode']); setting_save($authmode, 'authmode'); message('更新设置成功!', url('system/common')); } if (checksubmit('sms_submit')) { $sms = $_GPC['sms']; setting_save($sms, 'sms'); if (!empty($_GPC['sms_testsend']) && !empty($_GPC['sms_receiver'])) {
if ($num > $row['stock']) { message('团购产品库存不足,无法参与团购。'); } if ($num > $row['limit_num'] && $row['limit_num'] != 0) { message('每个用户只能购买' . $row['limit_num'] . '个产品。'); } //保存订单 $insert = array('weid' => $weid, 'tid' => $tid, 'from_user' => $from, 'ordersn' => date('md') . sprintf("%04d", $_W['fans']['id']) . random(4, 1), 'totalnum' => $num, 'totalprice' => intval($num) * floatval($row['price']), 'status' => 0, 'sendtype' => 0, 'paytype' => $_GPC['paytype'], 'createtime' => TIMESTAMP); if ($_GPC['paytype'] == 3) { $insert['secretsn'] = 'A' . random(11, 1); $insert['status'] = 1; } $temp = pdo_insert('groupon_order', $insert); if ($temp == false) { $this->message('订单失败,请稍候重试'); } else { //0.52版本可以开启发邮件功能 if (!empty($row['email'])) { ihttp_email($row['email'], '您有新订单', '您的产品' . $row['title'] . '团购了' . $num . '份,还剩下' . $row['stock'] . '份'); } $orderid = pdo_insertid(); if ($_GPC['paytype'] == 3) { //选择了货到付款 //跳转到详情页 //$this->message('订单成功,您选择了货到付款,请初始消费券后,付款消费。',$this->createMobileUrl('wleshow', array('tid'=>$tid,'id' => $orderid)),0); $this->message('订单成功,您选择了货到付款,请初始消费券后,付款消费。', $this->createMobileUrl('wleticket'), 0); } else { $this->message('订单成功', $this->createMobileUrl('wlpayment', array('orderid' => $orderid)), 0); } } }
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; } $sql = 'SELECT `goodsid` FROM ' . tablename('shopping_order_goods') . ' WHERE `orderid` = :orderid'; $goodsId = pdo_fetchcolumn($sql, array(':orderid' => $params['tid'])); $sql = 'SELECT `total`, `totalcnf` FROM ' . tablename('shopping_goods') . ' WHERE `id` = :id'; $goodsInfo = pdo_fetch($sql, array(':id' => $goodsId)); // 更改库存 if ($goodsInfo['totalcnf'] == '1' && !empty($goodsInfo['total'])) { pdo_update('shopping_goods', array('total' => $goodsInfo['total'] - 1), array('id' => $goodsId)); } pdo_update('shopping_order', $data, array('id' => $params['tid'])); if ($params['from'] == 'return') { //积分变更 $this->setOrderCredit($params['tid']); $order = pdo_fetch("SELECT `price`, `paytype`, `from_user`, `addressid` 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('shopping_address') . " WHERE id = :id", array(':id' => $order['addressid'])); if (!empty($this->module['config']['noticeemail']) || !empty($this->module['config']['mobile'])) { $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['realname'] . '<br />'; $body .= '地区:' . $address['province'] . ' - ' . $address['city'] . ' - ' . $address['area'] . '<br />'; $body .= '详细地址:' . $address['address'] . '<br />'; $body .= '手机:' . $address['mobile'] . '<br />'; // 邮件提醒 if (!empty($this->module['config']['noticeemail'])) { load()->func('communication'); ihttp_email($this->module['config']['noticeemail'], '微商城订单提醒', $body); } // 短信提醒 if (!empty($this->module['config']['mobile'])) { load()->model('cloud'); $body = str_replace(array('<h3>', '</h3>', '<br />'), array('', '', "\n"), $body); cloud_sms_send($this->module['config']['mobile'], $body); } } //支付成功,打印订单 if (empty($order)) { exit('订单不存在或已经删除'); } //获取所有打印机 $prints = pdo_fetchall('SELECT * FROM ' . tablename('shopping_print') . ' WHERE uniacid = :aid AND status = 1', array(':aid' => $_W['uniacid'])); if (empty($prints)) { // exit('没有有效的打印机'); } $orderinfo = ''; $orderinfo .= '名称 单价 数量 金额<BR>'; $orderinfo .= '--------------------------------<BR>'; foreach ($goods as $row) { $orderInfo .= "{$row['title']}{$row['marketprice']}{$ordergoods[$row['id']]['total']}{$order['price']} <br />"; } $orderInfo .= '--------------------------------<BR>'; $orderinfo .= "合计:{$order['price']}元<BR>"; $orderinfo .= "下单人:{$address['realname']}<BR>"; $orderinfo .= "地址:{$address['province']} - {$address['city']} - {$address['area']} {$address['address']} <BR>"; $orderinfo .= "联系电话:{$address['mobile']}<BR>"; $orderinfo .= "支付方式:{$order['paytype']}<BR>"; include 'wprint.class.php'; //遍历所有打印机 foreach ($prints as $li) { if (!empty($li['qrcode_link'])) { $orderinfo .= "<QR>{$li['qrcode_link']}</QR>"; } if (!empty($li['print_no']) && !empty($li['key'])) { $wprint = new wprint(); $status = $wprint->StrPrint($li['print_no'], $li['key'], $orderinfo, 1); if (!is_error($status)) { $i++; $data = array('uniacid' => $_W['uniacid'], 'sid' => $sid, 'pid' => $li['id'], 'oid' => $id, 'status' => 1, 'foid' => $status, 'addtime' => TIMESTAMP); pdo_insert('shopping_order_print', $data); } } } // if($i > 0) { // pdo_query('UPDATE ' . tablename('str_order') . " SET print_nums = print_nums + {$i} WHERE uniacid = {$_W['uniacid']} AND id = {$id}"); // } else { // exit('发送打印指令失败。没有有效的机器号'); // } // exit('success'); //打印结束 $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'); } } }
$list = pdo_fetchall("SELECT * FROM" . tablename('weilive_prizecode') . "WHERE weid = " . $weid . " and inkind = 2"); } elseif ($op == 'inkind3') { $list = pdo_fetchall("SELECT * FROM" . tablename('weilive_prizecode') . "WHERE weid = " . $weid . " and inkind = 3"); } elseif ($op == 'detail') { $item = pdo_fetch("SELECT * FROM" . tablename('weilive_prizecode') . "WHERE id='{$_GPC['id']}'"); $row = pdo_fetch("SELECT f.*, m.address, m.mobile, m.email FROM" . tablename("mc_mapping_fans") . " as f left join " . tablename('mc_members') . " as m on f.uid = m.uid WHERE f.openid='{$item['openid']}'"); } elseif ($op == 'delete') { pdo_delete('weilive_prizecode', array('id' => $_GPC['id'])); message("删除成功", referer(), 'success'); } elseif ($op == 'mail') { $id = intval($_GPC['id']); $status = $_GPC['status']; if ($status == 1) { if ($_GPC['inkind2'] == 2) { $temp = 1; } else { $temp = ihttp_email($_GPC['mail_to'], $_GPC['title1'] . '的发货提醒', $_GPC['content']); } if ($temp) { //print_r("UPDATE ".tablename($this->prizecode)."SET status= '1' WHERE id = '{$id}' AND weid = '{$_W['weid']}'");exit; $sql = "UPDATE " . tablename('weilive_prizecode') . "SET status= " . $status . " WHERE id = '{$id}' AND weid = " . $weid; pdo_query($sql); message('发送成功', referer(), 'success'); } else { message('发送失败,请检查邮箱!', referer(), 'success'); } } else { message('提交成功', referer(), 'success'); } } include $this->template('web/credit_request');
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['weid']; $params[':reid'] = $reid; $activity = pdo_fetch($sql, $params); $title = $activity['title']; if ($activity['status'] != '1') { message('当前预约活动已经停止.'); } if (!$activity) { message('非法访问.'); } if ($activity['starttime'] > TIMESTAMP) { message('当前预约活动还未开始!'); } if ($activity['endtime'] < TIMESTAMP) { message('当前预约活动已经结束!'); } $sql = 'SELECT * FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid ORDER BY `refid`'; $params = array(); $params[':reid'] = $reid; $ds = pdo_fetchall($sql, $params); if (!$ds) { message('非法访问.'); } if (checksubmit()) { $pretotal = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('research_rows') . " WHERE reid = :reid AND openid = :openid", array(':reid' => $reid, ':openid' => $_W['fans']['from_user'])); if ($pretotal >= $activity['pretotal']) { message('抱歉!每人只能提交' . $activity['pretotal'] . "次!", referer(), 'error'); } $row = array(); $row['reid'] = $reid; $row['openid'] = $_W['fans']['from_user']; $row['createtime'] = TIMESTAMP; $datas = array(); $fields = array(); foreach ($ds as $r) { $fields[$r['refid']] = $r; } foreach ($_GPC as $key => $value) { if (strexists($key, 'field_')) { $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'))) { $entry['data'] = strval($value); } if (in_array($field['type'], array('checkbox'))) { if (!is_array($value)) { continue; } $entry['data'] = implode(';', $value); } $datas[] = $entry; } } } if ($_FILES) { 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($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) && !empty($activity['noticeemail'])) { foreach ($datas as $row) { $body .= "{$fields[$row['refid']]['title']} : {$row['data']} <br />"; } ihttp_email($activity['noticeemail'], $activity['title'] . '的预约提醒', $body); //短信提醒 $data = array('username' => iliang, 'password' => 7758521, 'mobile' => $activity['mobile'], 'content' => $activity['title'] . '的预约提醒' . $body); $url = 'http://api.chanyoo.cn/utf8/interface/get_sms.aspx'; ihttp_post($url, $data); } message($activity['information'], 'refresh'); } $initRange = false; $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['bind']; } } if ($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']]; } } } include $this->template('submit'); }
public function doMobileAjaxypsubmit() { global $_GPC, $_W; $id = $_GPC['id']; $weid = $_W['weid']; $hid = $_GPC['hid']; $result = ""; $data = array('hid' => $_GPC['hid'], 'title' => $_GPC['yptitle'], 'order_status' => 2, 'people' => $_GPC['ypname'], 'tel' => $_GPC['tel'], 'sex' => $_GPC['sex'], 'older' => $_GPC['older'], 'experience' => $_GPC['experience'], 'weid' => $weid, 'createtime' => TIMESTAMP); if (pdo_insert($this->zworder, $data)) { $copinfo = pdo_fetch("SELECT * FROM " . tablename($this->indextable) . " WHERE id = '{$data['hid']}'"); //发送邮件 if (!empty($copinfo['email'])) { $body .= "应聘企业 : {$copinfo['title']} <br />"; $body .= "应聘岗位 : {$data['title']} <br />"; $body .= "姓名: {$data['people']} <br />"; $body .= "电话: {$data['tel']} <br />"; $body .= "性别: {$data['tel']} <br />"; $body .= "个人履历: {$data['experience']} <br />"; ihttp_email($copinfo['email'], '您有一封应聘' . $copinfo['title'] . $data['title'] . '岗位的简历请查收', $body); } $result = "您的应聘信息提交成功!"; } else { $result = "您的应聘信息提交失败!"; } echo $result; }
function common_group_check() { global $_W; $uniacid = $_W['uniacid']; $settings = uni_setting($uniacid, array('groupdata')); $groupdata = $settings['groupdata'] ? $settings['groupdata'] : array(); if ($groupdata['isexpire'] == 1) { $settings = get_settings(); $account = uni_fetch(); $group = kim_get_uni_group($account['groupid']); $user = pdo_fetch("SELECT U.* FROM " . tablename("uni_account_users") . " AS A LEFT JOIN " . tablename("users") . " AS U ON A.uid=U.uid WHERE A.uniacid=:uniacid AND A.role='manager'", array(":uniacid" => $uniacid)); if ($groupdata['endtime'] < TIMESTAMP) { if ($user["credit2"] >= $group["price"] && $settings["is_auto"] == 1) { $result = buy_package($user, $group["id"]); if (is_error($result)) { return $result; } return error(0, "自动续费成功."); } else { $over_group = !empty($settings["over_group"]) ? intval($settings["over_group"]) : 0; pdo_update('uni_account', array('groupid' => $over_group), array('uniacid' => $uniacid)); pdo_update('uni_settings', array('groupdata' => iserializer(array('isexpire' => 0, 'endtime' => 0, 'oldgroupid' => $group['id'], 'is_auto' => 1))), array('uniacid' => $uniacid)); $_W['account']['groupid'] = $over_group; load()->model('module'); module_build_privileges(); return error(0, "自动续费失败,变成配置过期套餐."); } } $overTime = intval($groupdata['endtime']) - TIMESTAMP; if (!empty($settings["tx_date"]) && intval($settings["tx_date"]) > 0 && is_email_tx($overTime, intval($settings["tx_date"]))) { $email = pdo_fetchcolumn("SELECT P.email FROM " . tablename("uni_account_users") . " AS A LEFT JOIN " . tablename("users_profile") . " AS P ON A.uid=P.uid WHERE A.uniacid=:uniacid AND A.role='manager'", array(":uniacid" => $uniacid)); if (!empty($email)) { $email_body = str_replace('<', "<", $settings["tx_email"]); $email_body = str_replace('>', ">", $email_body); $email_body = str_replace('#package#', $group['name'], $email_body); $email_body = str_replace('#day#', $groupdata['endtime'], $email_body); load()->func('communication'); $send = ihttp_email($email, "套餐到期提醒-系统邮件,请勿回复.", $email_body, true); if (is_error($send)) { return $send; } cache_write('kim_financial_email_tx' . $_W["uniacid"], array("time" => date("Y-m-d", TIMESTAMP))); return error(0, "套餐到期提醒,成功"); } return error(0, "提醒邮箱未设定"); } return error(0, "检查成功"); } return error(-1, "操作失败"); }
$notify['sms']['signature'] = '系统默认'; $notify['mail'] = array(); } $dos = array('mail', 'sms', 'wechat'); $do = in_array($do, $dos) ? $do : 'mail'; $_W['page']['title'] = 'APP通知 - 通知参数 - 通知中心'; if ($do == 'mail') { $_W['page']['title'] = '邮件通知 - 通知参数 - 通知中心'; if (checksubmit('submit')) { $notify['mail'] = array('username' => $_GPC['username'], 'password' => $_GPC['password'], 'smtp' => $_GPC['smtp'], 'sender' => $_GPC['sender'], 'signature' => $_GPC['signature']); $row = array(); $row['notify'] = iserializer($notify); pdo_update('uni_settings', $row, array('uniacid' => $_W['uniacid'])); if (!empty($_GPC['testsend']) && !empty($_GPC['receiver'])) { load()->func('communication'); $result = ihttp_email($_GPC['receiver'], $_W['account']['name'] . '验证邮件' . date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!'); if (is_error($result)) { message($result['message']); } } cache_delete("unisetting:{$_W['uniacid']}"); message('更新设置成功!', url('profile/notify', array('do' => 'mail'))); } } if ($do == 'sms') { $_W['page']['title'] = '短信通知 - 通知参数 - 通知中心'; $notify['sms'] = array('balance' => $notify['sms']['balance'], 'signature' => $notify['sms']['signature']); } if ($do == 'wechat') { $_W['page']['title'] = '微信通知 - 通知参数 - 通知中心'; $acid = pdo_fetchall("SELECT acid,name FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid AND level = 4", array(':uniacid' => $_W['uniacid']));
if ($row['total'] >= 5) { exit('error-limit'); } $code = $row['verifycode']; $record['total']++; } else { $code = random(6, true); $record['uniacid'] = $_W['uniacid']; $record['receiver'] = $post['no']; $record['verifycode'] = $code; $record['total'] = 1; $record['createtime'] = TIMESTAMP; } if ($post['type'] == 'email') { $content = "您的邮箱验证码为: {$code} 您正在使用{$_W['account']['name']}相关功能, 需要你进行身份确认."; $result = ihttp_email($post['no'], "{$_W['account']['name']}身份确认验证码", $content); } else { require model('cloud'); $content = "您的短信验证码为: {$code} 您正在使用{$_W['account']['name']}相关功能, 需要你进行身份确认.【WORMWOOD】"; $result = cloud_sms_send($post['no'], $content); } if (is_error($result)) { header('error: ' . urlencode($result['message'])); exit('error-fail'); } else { if (!empty($row)) { pdo_update('uni_verifycode', $record, array('id' => $row['id'])); } else { pdo_insert('uni_verifycode', $record); } }
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'); } } }
public function doMobileResearch() { global $_W, $_GPC; $reid = intval($_GPC['reid']); $id = intval($_GPC['id']); $search = pdo_fetch("SELECT * FROM " . tablename('multisearch') . " WHERE id = :id", array(':id' => $reid)); $search['tablename'] = 'multisearch_data_' . $search['id']; $search['fields'] = pdo_fetchall("SELECT * FROM " . tablename('multisearch_fields') . " WHERE reid = :reid AND type = 2 ORDER BY displayorder DESC", array(':reid' => $reid)); if (empty($search['isresearch'])) { message('该查询暂不支持预定!'); } $research = pdo_fetch("SELECT id, data FROM " . tablename('multisearch_research') . " WHERE rowid = :rowid AND openid = :openid", array(':rowid' => $id, ':openid' => $_W['fans']['from_user'])); $research['data'] = iunserializer($research['data']); if (checksubmit('submit')) { if (!empty($search['fields'])) { foreach ($search['fields'] as $row) { if ($row['type'] == 2 && !empty($row['bind'])) { if (isset($this->types[$row['bind']])) { $extra[$row['variable']] = $_GPC[$row['variable']]; } else { $data[$row['variable']] = $_GPC[$row['variable']]; } } } if (!empty($data)) { fans_update($_W['fans']['from_user'], $data); } if (!empty($search['noticeemail'])) { $body = ''; foreach ($search['fields'] as $row) { if ($row['type'] == 2) { $body .= "{$row['title']} : {$_GPC[$row['variable']]} \r\n"; } } ihttp_email($search['noticeemail'], '【' . $search['title'] . '】的预约通知', $body); } if (!empty($research['id'])) { $data = array('data' => iserializer($extra)); pdo_update('multisearch_research', $data, array('id' => $research['id'])); } else { $data = array('weid' => $_W['weid'], 'openid' => $_W['fans']['from_user'], 'reid' => $reid, 'rowid' => $id, 'status' => 0, 'data' => iserializer($extra), 'createtime' => TIMESTAMP); pdo_insert('multisearch_research', $data); } } message('提交信息成功!', $this->createMobileUrl('detail', array('id' => $reid)), 'success'); } $sql = "SELECT * FROM " . tablename($search['tablename']) . " WHERE id = '{$id}'"; $fields = pdo_fetch($sql); $fields['data'] = iunserializer($fields['data']); if (!empty($search['fields'])) { foreach ($search['fields'] as $row) { if ($row['type'] == 2) { if (!empty($row['bind']) && !isset($this->types[$row['bind']])) { $fansfields[] = $row['bind']; } } } } if (!empty($fansfields)) { $fans = fans_search($_W['fans']['from_user'], $fansfields); } include $this->template($search['template'] . '/research'); }
public function doMobileOrder() { global $_GPC, $_W; $this->check_login(); $isauto = $this->_user_info['isauto']; $hid = $_GPC['hid']; $id = $_GPC['id']; $weid = $this->_weid; $price = $_GPC['price']; //$total_price = $_GPC['total_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(); $reply = pdo_fetch("SELECT title,mail FROM " . tablename('hotel2') . " WHERE id = :id ", array(':id' => $hid)); if (empty($reply)) { if ($is_submit) { die(json_encode(array("result" => 0, "error" => "酒店未找到!"))); } else { message("酒店未找到, 请联系管理员!"); } } $pricefield = $this->_user_info['isauto'] == 1 ? "cprice" : "mprice"; $room = pdo_fetch("SELECT *, {$pricefield} as roomprice FROM " . tablename('hotel2_room') . " WHERE id = :id AND hotelid = :hotelid ", 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'); $sql .= " WHERE 1 = 1"; $sql .= " AND roomid = :roomid"; $sql .= " AND roomdate >= :btime AND roomdate < :etime"; $sql .= " AND status = 1"; $params[':roomid'] = $id; $params[':btime'] = $btime; $params[':etime'] = $etime; $room_date_list = pdo_fetchall($sql, $params); //print_r($room_date_list);exit; if ($room_date_list) { $flag = 1; } else { $flag = 0; } $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(); if (empty($user_info['id'])) { $memberid = 0; } else { $memberid = $user_info['id']; } //显示会员价还是普通价 $pricefield = $isauto == 1 ? "cprice" : "mprice"; $params = array(":weid" => $weid, ":hotelid" => $hid); $r_sql = "SELECT roomdate, num, status, " . $pricefield . " as m_price FROM " . tablename('hotel2_room_price'); $r_sql .= " WHERE 1 = 1"; $r_sql .= " AND roomid = " . $id; $r_sql .= " AND weid = :weid"; $r_sql .= " AND hotelid = :hotelid"; $r_sql .= " AND roomdate >=" . $btime . " AND roomdate <" . $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); } //print_r($this_price);exit; 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" => "您的预定数量超过最大限制!"))); } $data = array('realname' => $name, 'mobile' => $mobile); fans_update($from_user, $data); pdo_update("hotel2_member", $data, array("from_user" => $from_user)); $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' => time(), 'paytype' => $_GPC['paytype']); $insert[$pricefield] = $this_price; $insert['sum_price'] = $totalprice * $insert['nums']; // $is_repeat = check_orderinfo($insert); // if ($is_repeat == 1){ // die(json_encode(array("result" => 0, "error" => "您已经预定成功,请不要重复提交"))); // } 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 .= "到店时间: " . $_GPC['btime'] . "<br/>"; //$body .= "离店时间: " . $_GPC['btime'] . "<br/><br/>"; $body .= "请您到管理后台仔细查看. <a href='" . $_W['siteroot'] . create_url('member/login') . "' target='_blank'>立即登录后台</a>"; $result = ihttp_email($reply['mail'], $subject, $body); } //$url = $this->createMobileUrl('index'); $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'); } }
public function doMobileResearch() { global $_W, $_GPC; $weid = $_W['weid']; $reid = intval($_GPC['id']); $sql = 'SELECT * FROM ' . tablename('hnresearch') . ' WHERE `weid`=:weid AND `reid`=:reid'; $params = array(); $params[':weid'] = $_W['uniacid']; $params[':reid'] = $reid; $activity = pdo_fetch($sql, $params); $title = $activity['title']; if ($activity['status'] != '1') { message('当前活动已经停止.'); } if (!$activity) { message('非法访问.'); } if ($activity['starttime'] > TIMESTAMP) { message('当前活动还未开始!'); } if ($activity['endtime'] < TIMESTAMP) { message('当前活动已经结束!'); } $sql = 'SELECT * FROM ' . tablename('hnresearch_fields') . ' WHERE `reid` = :reid'; $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')) { $pretotal = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('hnresearch_rows') . " WHERE reid = :reid AND openid = :openid", array(':reid' => $reid, ':openid' => $_W['fans']['from_user'])); if ($pretotal >= $activity['pretotal']) { message('抱歉,每人只能报名' . $activity['pretotal'] . "次!", $this->createMobileUrl('huodongindex'), 'error'); } if (empty($_W['fans']['from_user'])) { message('非法进去,请从公众号进入!'); } else { $checksql = "SELECT * FROM " . tablename('hnfans') . " WHERE from_user=:from_user AND weid=:weid"; $checkit = pdo_fetch($checksql, array(':from_user' => $_W['fans']['from_user'], ':weid' => $weid)); if (empty($checkit)) { 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'))) { $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('hnresearch_rows', $row) != 1) { message('保存失败.'); } $rerid = pdo_insertid(); if (empty($rerid)) { message('保存失败.'); } foreach ($datas as &$r) { $r['rerid'] = $rerid; pdo_insert('hnresearch_data', $r); } if (empty($activity['starttime'])) { $record = array(); $record['starttime'] = TIMESTAMP; pdo_update('hnresearch', $record, array('reid' => $reid)); } //发送预约 if (!empty($datas) && !empty($activity['noticeemail'])) { foreach ($datas as $row) { $img = "<img src='"; /* 如果预约项目类型是上传图片 */ if (substr($row['data'], 0, 6) == 'images') { $body = $fields[$row['refid']]['title'] . ':' . $img . tomedia($row['data']) . ' />'; } $body .= $fields[$row['refid']]['title'] . ':' . $row['data']; } load()->func('communication'); ihttp_email($activity['noticeemail'], $activity['title'] . '的报名提醒', $body); } message($activity['information'], $this->createMobileUrl('huodongindex'), 'sucess'); //可能需要改成跳转到活动首页 } 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']]; } } } $settings = pdo_fetch("SELECT * FROM " . tablename('meepo_hongniangset') . " WHERE weid=:weid", array(':weid' => $_W['weid'])); load()->func('tpl'); include $this->template('hnsubmit'); }
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'); }
public function payResult($params) { global $_W; WeSession::start($_W['uniacid'], $_W['fans']['from_user'], 60); $fee = intval($params['fee']); $data = array('status' => $params['result'] == 'success' ? 1 : 0); $paytype = array('credit' => '1', 'wechat' => '2', 'alipay' => '2', 'delivery' => '3'); $data['paytype'] = $paytype[$params['type']]; if ($params['type'] == 'wechat') { $data['transid'] = $params['tag']['transaction_id']; } //判断是否是缴纳物业费用 if ($_SESSION['type'] == 'profree') { pdo_update('xcommunity_propertyfree', array('status' => 1), array('id' => $params['tid'])); if ($params['from'] == 'return') { if ($params['type'] == $credit) { message('缴费成功!', $this->createMobileUrl('propertyfree', array('op' => 'display')), 'success'); } else { message('缴费成功!', '../../app/' . $this->createMobileUrl('propertyfree', array('op' => 'display')), 'success'); } } exit; } if ($params['type'] == 'delivery') { $data['status'] = 1; } $sql = 'SELECT `goodsid` FROM ' . tablename('xcommunity_shopping_order_goods') . ' WHERE `orderid` = :orderid'; $goodsId = pdo_fetchcolumn($sql, array(':orderid' => $params['tid'])); $sql = 'SELECT `total`, `totalcnf` FROM ' . tablename('xcommunity_shopping_goods') . ' WHERE `id` = :id'; $goodsInfo = pdo_fetch($sql, array(':id' => $goodsId)); // 更改库存 if ($goodsInfo['totalcnf'] == '1' && !empty($goodsInfo['total'])) { pdo_update('xcommunity_shopping_goods', array('total' => $goodsInfo['total'] - 1), array('id' => $goodsId)); } pdo_update('xcommunity_shopping_order', $data, array('id' => $params['tid'])); if ($params['from'] == 'return') { //积分变更 $this->setOrderCredit($params['tid']); //邮件提醒 if (!empty($this->module['config']['noticeemail'])) { $order = pdo_fetch("SELECT `price`, `paytype`, `from_user`, `addressid` FROM " . tablename('xcommunity_shopping_order') . " WHERE id = '{$params['tid']}'"); $ordergoods = pdo_fetchall("SELECT goodsid, total FROM " . tablename('xcommunity_shopping_order_goods') . " WHERE orderid = '{$params['tid']}'", array(), 'goodsid'); $goods = pdo_fetchall("SELECT id, title, thumb, marketprice, unit, total FROM " . tablename('xcommunity_shopping_goods') . " WHERE id IN ('" . implode("','", array_keys($ordergoods)) . "')"); $address = pdo_fetch("SELECT * FROM " . tablename('xcommunity_shopping_address') . " WHERE id = :id", array(':id' => $order['addressid'])); $body = "<h3>购买商品清单</h3> <br />"; if (!empty($goods)) { foreach ($goods as $row) { $body .= "名称:{$row['title']} ,数量:{$ordergoods[$row['id']]['total']} <br />"; } } $paytype = $order['paytype'] == '3' ? '货到付款' : '已付款'; $body .= "<br />总金额:{$order['price']}元 ({$paytype})<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address['realname']} <br />"; $body .= "地区:{$address['province']} - {$address['city']} - {$address['area']}<br />"; $body .= "详细地址:{$address['address']} <br />"; $body .= "手机:{$address['mobile']} <br />"; load()->func('communication'); ihttp_email($this->module['config']['noticeemail'], '微商城订单提醒', $body); } $setting = uni_setting($_W['uniacid'], array('creditbehaviors')); $credit = $setting['creditbehaviors']['currency']; if ($params['type'] == $credit) { message('支付成功!', $this->createMobileUrl('shopping', array('op' => 'myorder')), 'success'); } else { message('支付成功!', '../../app/' . $this->createMobileUrl('shopping', array('op' => 'myorder')), 'success'); } } }
} $code = $row['verifycode']; $record['total'] = $row['total'] + 1; } else { $code = random(6, true); $record['uniacid'] = $_W['uniacid']; $record['receiver'] = $receiver; $record['verifycode'] = $code; $record['total'] = 1; $record['createtime'] = TIMESTAMP; } if (!empty($row)) { pdo_update('uni_verifycode', $record, array('id' => $row['id'])); } else { pdo_insert('uni_verifycode', $record); } if ($receiver_type == 'email') { load()->func('communication'); $content = "您的邮箱验证码为: {$code} 您正在使用{$uniacid_arr['name']}相关功能, 需要你进行身份确认."; $result = ihttp_email($receiver, "{$uniacid_arr['name']}身份确认验证码", $content); } else { $setting = uni_setting($_W['uniacid'], 'notify'); $content = "您的短信验证码为: {$code} 您正在使用{$uniacid_arr['name']}相关功能, 需要你进行身份确认. " . random(3); load()->func('sms'); $result = sms_send($receiver, $content); } if (is_error($result)) { header('error: ' . urlencode($result['message'])); exit($result['message']); } exit('success');
public function sendEmail($orderData, $orderItem, $form) { if ($form['emailenable'] == 1 && !empty($form['email'])) { load()->func('communication'); $body = "姓名:" . $orderData['uname'] . "\t 手机:" . $orderData['utel'] . "\t数量:" . $orderData['ordernum'] . "\t原价:" . $orderData['o_yprice'] . "\t现价:" . $orderData['o_xprice'] . "\t支付金额:" . $orderData['zf_price']; ihttp_email($form['email'], $orderItem['iname'] . "用户下单提醒", $body . "\n提交订单"); } }
/** * 发送邮件提醒 */ public function sendMail($acname, $applyUser) { global $_W, $_GPC; $weid = $_W['weid']; $list = pdo_fetchall("SELECT * FROM " . tablename($this->activitymail) . " WHERE weid = '{$weid}'"); $data = array('uname' => $_GPC['uname'], 'acname' => $_GPC['acname'], 'sex' => $_GPC['radio'], 'tel' => $_GPC['tel'], 'email' => $_GPC['email'], 'company' => $_GPC['company'], 'aid' => $_GPC['aid'], 'jobtitle' => $_GPC['job'], 'openid' => $openid, 'aid' => $aid, 'createtime' => TIMESTAMP); $body = "用户名:" . $applyUser['uname'] . "\t性别:" . $applyUser['sex'] . "电话:" . $applyUser['tel'] . "公司:" . $applyUser['company'] . "职位:" . $applyUser['jobtitle']; foreach ($list as $mail) { ihttp_email($mail['email'], $acname . "报名用户提醒!", $body . "\n已报名"); } }
public function doMobileResearch() { global $_W, $_GPC; $reid = intval($_GPC['id']); $tableName = $_GPC['tableName']; $sql = 'SELECT * FROM ' . tablename('research') . ' WHERE `weid`=:weid AND `reid`=:reid'; $params = array(); $params[':weid'] = $_W['weid']; $params[':reid'] = $reid; $activity = pdo_fetch($sql, $params); $title = $activity['title']; if ($activity['status'] != '1') { message('当前预约活动已经停止.'); } if (!$activity) { message('非法访问.'); } if ($activity['starttime'] > TIMESTAMP) { message('当前预约活动还未开始!'); } if ($activity['endtime'] < TIMESTAMP) { message('当前预约活动已经结束!'); } $sql = 'SELECT * FROM ' . tablename('research_fields') . ' WHERE `reid`=:reid ORDER BY `refid`'; $params = array(); $params[':reid'] = $reid; $ds = pdo_fetchall($sql, $params); if (!$ds) { message('非法访问.'); } if (checksubmit()) { $pretotal = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('research_rows') . " WHERE reid = :reid AND openid = :openid", array(':reid' => $reid, ':openid' => $_W['fans']['from_user'])); if ($pretotal >= $activity['pretotal']) { message('抱歉!每人只能提交' . $activity['pretotal'] . "次!", referer(), 'error'); } //start $tableType = $_GPC['field_34']; $booktime = empty($_GPC['field_38']) ? strtotime(date('Y-m-d')) : strtotime($_GPC['field_38']); $totalRooms = pdo_fetchcolumn("SELECT tableAmount FROM " . tablename('research_tables') . " WHERE tableName = :tableName ", array(':tableName' => $tableType)); $checkAmount = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('research_bookdetails') . " WHERE tableName = :tableName and arrivalDate = :arrivalDate", array(':tableName' => $tableType, ':arrivalDate' => $booktime)); if ($checkAmount + 1 > $totalRooms) { message('此房间已经预定满!', '', 'tips'); } //end $row = array(); $row['reid'] = $reid; $row['openid'] = $_W['fans']['from_user']; $row['createtime'] = TIMESTAMP; $datas = array(); $fields = array(); foreach ($ds as $r) { $fields[$r['refid']] = $r; } foreach ($_GPC as $key => $value) { if (strexists($key, 'field_')) { $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'))) { $entry['data'] = strval($value); } if (in_array($field['type'], array('checkbox'))) { if (!is_array($value)) { continue; } $entry['data'] = implode(';', $value); } $datas[] = $entry; } } } if ($_FILES) { 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($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); } //插入到 ims_research_booktable_details $detailsData = array(); $detailsData['tableName'] = $_GPC['field_34']; $detailsData['personNo'] = $_GPC['field_35']; $detailsData['contact'] = $_GPC['field_36']; $detailsData['phone'] = $_GPC['field_37']; $arrivalDate = empty($_GPC['field_38']) ? TIMESTAMP : strtotime($_GPC['field_38']); $detailsData['arrivalDate'] = $arrivalDate; $detailsData['remark'] = $_GPC['field_39']; $detailsData['status'] = 'P'; $detailsData['createtime'] = time(); pdo_insert('research_bookdetails', $detailsData); if (empty($activity['starttime'])) { $record = array(); $record['starttime'] = TIMESTAMP; pdo_update('research', $record, array('reid' => $reid)); } //发送预约 if (!empty($datas) && !empty($activity['noticeemail'])) { foreach ($datas as $row) { $body .= "{$fields[$row['refid']]['title']} : {$row['data']} <br />"; } ihttp_email($activity['noticeemail'], $activity['title'] . '的预约提醒', $body); } message($activity['information'], 'refresh'); } $initRange = false; $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['bind']; } } 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']]; } } } include $this->template('submit'); }
public function sendmail($config) { // include 'plugin/email/class.phpmailer.php'; // $mail = new PHPMailer(); // $mail->CharSet = "utf-8"; // $body = $config['body']; // $mail->IsSMTP(); // $mail->SMTPAuth = true; // enable SMTP authentication // $mail->SMTPSecure = $config['secure']; // sets the prefix to the servier // $mail->Host = $config['host']; // sets the SMTP server // $mail->Port = $config['port']; // $mail->Username = $config['sendmail']; // 发件邮箱用户名 // $mail->Password = $config['password']; // 发件邮箱密码 // $mail->From = $config['sendmail']; //发件邮箱 // $mail->FromName = $config['username']; //发件人名称 // $mail->Subject = $config['subject']; //主题 // $mail->WordWrap = 50; // set word wrap // $mail->MsgHTML($body); // $mail->AddAddress($config['mailaddress'], ''); //收件人地址、名称 // $mail->IsHTML(true); // send as HTML // if (!$mail->Send()) { // $status = 0; // } else { // $status = 1; // } // return $status; load()->func('communication'); $result = ihttp_email($config['mailaddress'], $config['subject'], $config['body']); if (is_error($result) && !empty($result['errno'])) { return 0; } return 1; }
public function payResult($params) { global $_W, $_GPC; $data = array('status' => $params['result'] == 'success' ? 3 : 2); $data['pay_type'] = $params['type']; if ($params['type'] == 'wechat') { //$data['transid'] = $params['tag']['transaction_id']; } if ($params['type'] == 'delivery') { $data['status'] = 3; } //pdo_update('str_order', $data, array('id' => $params['tid'], 'uniacid' => $_W['uniacid'])); $order = pdo_fetch('SELECT * FROM ' . tablename('str_order') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $params['tid'])); //获取store信息 $store = pdo_fetch('SELECT email_notice, email FROM ' . tablename('str_store') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $order['sid'])); if ($params['from'] == 'return') { //邮件提醒 if (!empty($store['email_notice'])) { $body = "<h3>订餐菜品清单</h3> <br />"; if (!empty($order)) { $order['dish'] = iunserializer($order['dish']); foreach ($order['dish'] as $row) { $body .= "名称:{$row['title']} ,数量:{$row['num']} 份<br />"; } } $body .= "<br />总金额:{$order['price']}元 (已付款)<br />"; $body .= "<h3>订餐用户详情</h3> <br />"; $body .= "真实姓名:{$order['username']} <br />"; $body .= "地区:{$order['address']}<br />"; $body .= "手机:{$order['mobile']} <br />"; load()->func('communication'); ihttp_email($store['email'], '微外卖订单提醒', $body); } if ($params['type'] == 'credit') { message('支付成功!', $_W['siteroot'] . "app/" . $this->createMobileUrl('orderdetail', array('id' => $order['id'], 'sid' => $order['sid'])), 'success'); } else { message('支付成功!', $_W['siteroot'] . "app/" . $this->createMobileUrl('orderdetail', array('id' => $order['id'], 'sid' => $order['sid'])), 'success'); } } }
public function payResult($params) { $fee = intval($params['fee']); $data = array('status' => $params['result'] == 'success' ? 1 : 0); if ($params['type'] == 'wechat') { $data['transid'] = $params['tag']['transaction_id']; } pdo_update('shopping_order', $data, array('id' => $params['tid'])); if ($params['from'] == 'return') { //邮件提醒 if (!empty($this->module['config']['noticeemail'])) { $order = pdo_fetch("SELECT price, from_user 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('shopping_address') . " WHERE id = :id", array(':id' => $order['addressid'])); $body = "<h3>购买商品清单</h3> <br />"; if (!empty($goods)) { foreach ($goods as $row) { $body .= "名称:{$row['title']} ,数量:{$ordergoods[$row['id']]['total']} <br />"; } } $body .= "<br />总金额:{$order['price']}元 (已付款)<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address['realname']} <br />"; $body .= "地区:{$address['province']} - {$address['city']} - {$address['area']}<br />"; $body .= "详细地址:{$address['address']} <br />"; $body .= "手机:{$address['mobile']} <br />"; ihttp_email($this->module['config']['noticeemail'], '微商城订单提醒', $body); } if ($params['type'] == 'credit2') { message('支付成功!', $this->createMobileUrl('myorder'), 'success'); } else { message('支付成功!', '../../' . $this->createMobileUrl('myorder'), 'success'); } } }
private function getFromNoticeeMail($noticee) { global $_W; load()->func('communication'); //调用http通信文件 if (!empty($this->module['config']['noticeemail']) || !empty($noticee)) { $address = pdo_fetch("SELECT * FROM " . tablename('wwx_fxxt_address') . " WHERE id = :id", array(':id' => $noticee['addressid'])); $body = "<h3>购买商品清单</h3> <br />"; if (!empty($noticee['bodygoods'])) { $body .= $noticee['bodygoods']; } $body .= "<br />总金额:{$noticee['price']}元 (货到付款)<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address[realname]} <br />"; $body .= "地区:{$address[province]} - {$address[city]} - {$address[area]}<br />"; $body .= "详细地址:{$address[address]} <br />"; $body .= "手机:{$address[mobile]} <br /> <br /> <br />"; ihttp_email($this->module['config']['noticeemail'], "{$_W['account']['name']}商城订单提醒", $body); } }
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'); } }
$option = pdo_fetch("select title,marketprice,weight,stock from " . tablename("xcommunity_shopping_goods_option") . " where id=:id limit 1", array(":id" => $ordergoods[$row['id']]['optionid'])); if ($option) { $row['title'] = "[" . $option['title'] . "]" . $row['title']; } $body .= "名称:{$row['title']} ,数量:{$ordergoods[$row['id']]['total']} <br />"; } } $paytype = $order['paytype'] == '3' ? '货到付款' : '已付款'; $body .= "<br />总金额:{$order['price']}元 ({$paytype})<br />"; $body .= "<h3>购买用户详情</h3> <br />"; $body .= "真实姓名:{$address['realname']} <br />"; $body .= "地区:{$address['province']} - {$address['city']} - {$address['area']}<br />"; $body .= "详细地址:{$address['address']} <br />"; $body .= "手机:{$address['mobile']} <br />"; load()->func('communication'); ihttp_email($this->module['config']['noticeemail'], '微商城订单提醒', $body); } pdo_update('xcommunity_shopping_order', array('status' => '1', 'paytype' => '3'), array('id' => $orderid)); message('订单提交成功,请您收到货时付款!', $this->createMobileUrl('shopping', array('op' => 'myorder')), 'success'); } if (checksubmit()) { if ($order['paytype'] == 1 && $_W['fans']['credit2'] < $order['price']) { message('抱歉,您帐户的余额不够支付该订单,请充值!', create_url('mobile/module/charge', array('name' => 'member', 'weid' => $_W['uniacid'])), 'error'); } if ($order['price'] == '0') { $this->payResult(array('tid' => $orderid, 'from' => 'return', 'type' => 'credit2')); exit; } } // 商品编号 $sql = 'SELECT `goodsid` FROM ' . tablename('xcommunity_shopping_order_goods') . " WHERE `orderid` = :orderid";