本文整理汇总了PHP中Sms::sendSms方法的典型用法代码示例。如果您正苦于以下问题:PHP Sms::sendSms方法的具体用法?PHP Sms::sendSms怎么用?PHP Sms::sendSms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sms
的用法示例。
在下文中一共展示了Sms::sendSms方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smssendtest
public function smssendtest()
{
if (strlen($_GET['mp']) != 11) {
$this->error('请输入正确的手机号');
}
$this->error(Sms::sendSms('admin', 'hello,你好', $_GET['mp']));
}
示例2: index
public function index($orderid, $paytype, $third_id)
{
$product_cart_model = M('product_cart');
$out_trade_no = $orderid;
$order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
if (!$this->wecha_id) {
$this->wecha_id = $order['wecha_id'];
}
$sepOrder = 0;
if (!$order) {
$order = $product_cart_model->where(array('id' => $out_trade_no))->find();
$sepOrder = 1;
}
if ($order) {
if ($order['paid'] != 1) {
exit('该订单还未支付');
}
/************************************************/
Sms::sendSms($this->token, '您的微信里有团购订单已经付款');
/************************************************/
header('Location:/index.php?g=Wap&m=Groupon&a=myOrders&token=' . $order['token'] . '&wecha_id=' . $order['wecha_id']);
} else {
exit('订单不存在:' . $out_trade_no);
}
}
示例3: index
public function index()
{
$set_id = $this->_get('id', 'intval');
$formData = $this->_createForms($this->token, $set_id);
if (IS_POST) {
$limit_info = $this->limit_db->where(array('limit_id' => $this->thisForm['limit_id']))->find();
if ($limit_info['enddate']) {
if ($limit_info['enddate'] < time()) {
$this->error('抱歉,时间已过期,无法提交');
}
}
if (0 < $limit_info['today_total']) {
$time = strtotime(date('Y-m-d'));
$total = $this->info_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'set_id' => $this->thisForm['set_id'], 'add_time' => array('gt', $time)))->count();
if ($limit_info['today_total'] <= $total) {
$this->error('抱歉,今日只能提交' . $limit_info['today_total'] . '次');
}
}
if (0 < $limit_info['sub_total']) {
$total = $this->info_db->where(array('token' => $this->token, 'set_id' => $this->thisForm['set_id'], 'wecha_id' => $this->wecha_id))->count();
if ($limit_info['sub_total'] <= $total) {
$this->error('抱歉,提交总数已经超过' . $limit_info['sub_total'] . '次');
}
}
$data['token'] = $this->token;
$data['wecha_id'] = $this->wecha_id;
$data['set_id'] = $set_id;
$data['add_time'] = time();
$data['user_name'] = empty($this->fans['wechaname']) ? '匿名' : $this->fans['wechaname'];
$data['phone'] = empty($this->fans['tel']) ? '匿名' : $this->fans['tel'];
$array = array();
foreach ($this->_request() as $key => $value) {
if ($value == '') {
$array[] = array($key => '未填写');
}
}
$arr = array();
foreach ($array as $k => $v) {
foreach ($v as $key => $value) {
$arr[$key] = $value;
}
}
$b = $this->_request();
$request = array_merge($b, $arr);
$data['sub_info'] = $this->_serializeSubInfo($request, $set_id);
if ($this->info_db->add($data)) {
Sms::sendSms($this->token, '你的表单“' . $this->thisForm['title'] . '”中有新的信息');
$this->success($this->thisForm['succ_info']);
} else {
$this->error($this->thisForm['err_info']);
}
} else {
$spoor = $this->info_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'set_id' => $set_id))->count();
$this->assign('spoor', $spoor);
$this->assign('verify', $formData['verify']);
$this->assign('formData', $formData['string']);
$this->display();
}
}
示例4: index
public function index($orderid, $paytype = '', $third_id = '')
{
$wecha_id = '';
$token = '';
if ($order = M('dish_order')->where(array('orderid' => $orderid))->find()) {
//TODO 发货的短信提醒
$token = $order['token'];
$wecha_id = $order['wecha_id'];
//$order['paid']=1;
$Dishcompany = M('Dish_company')->where(array('cid' => $order['cid']))->find();
$kconoff = $Dishcompany['kconoff'];
if ($order['paid']) {
$temp = unserialize($order['info']);
$tmparr = array('token' => $token, 'cid' => $order['cid'], 'order_id' => $order['id'], 'paytype' => $order['paytype']);
$log_db = M('Dishout_salelog');
if (!empty($temp) && is_array($temp)) {
$DishDb = M('Dish');
$mDishSet = ThirdPayDishOut::getDishMainCompany($token);
foreach ($temp as $kk => $vv) {
$did = isset($vv['did']) ? $vv['did'] : $kk;
$dishofcid = $order['cid'];
if ($mDishSet['cid'] != $order['cid'] && $mDishSet['dishsame'] == 1) {
$dishofcid = $mDishSet['cid'];
$kconoff = $mDishSet['kconoff'];
}
$tmpdish = $DishDb->where(array('id' => $did, 'cid' => $dishofcid))->find();
if ($kconoff && !empty($tmpdish) && $tmpdish['instock'] > 0) {
$DishDb->where(array('id' => $did, 'cid' => $dishofcid))->setDec('instock', $vv['num']);
}
$logarr = array('did' => isset($vv['did']) ? $vv['did'] : $kk, 'nums' => $vv['num'], 'unitprice' => $vv['price'], 'money' => $vv['num'] * $vv['price'], 'dname' => $vv['name'], 'addtime' => $order['time'], 'addtimestr' => date('Y-m-d H:i:s', $order['time']), 'comefrom' => 0);
$savelogarr = array_merge($tmparr, $logarr);
$log_db->add($savelogarr);
}
}
$company = M('Company')->where(array('token' => $token, 'id' => $order['cid']))->find();
if (empty($company) || !is_array($company)) {
header('Location:' . U('DishOut/index', array('token' => $token, 'wecha_id' => $wecha_id)));
}
Sms::sendSms($token, "顾客{$order['name']}刚刚对订单号:{$orderid}的订单进行了支付,请您注意查看并处理", $company['mp']);
$model = new templateNews();
$siteurl = $_SERVER['HTTP_HOST'];
$siteurl = strtolower($siteurl);
if (strpos($siteurl, "http:") === false && strpos($siteurl, "https:") === false) {
$siteurl = 'http://' . $siteurl;
}
$siteurl = rtrim($siteurl, '/');
/*$model->sendTempMsg('OPENTM202521011', array('href' =>U('DishOut/myOrder', array('token' => $token, 'wecha_id' => $wecha_id, 'cid' => $order['cid']), true, false, true), 'wecha_id' => $wecha_id, 'first' => '外卖订餐交易提醒', 'keyword1' => $orderid, 'keyword2' => date("Y年m月d日H时i分s秒"), 'remark' => '支付成功,感谢您的光临,欢迎下次再次光临!'));*/
$model->sendTempMsg('OPENTM202521011', array('href' => $siteurl . '/index.php?g=Wap&m=DishOut&a=myOrder&token=' . $token . '&wecha_id=' . $wecha_id . '&cid=' . $order['cid'], 'wecha_id' => $wecha_id, 'first' => '外卖订餐交易提醒', 'keyword1' => $orderid, 'keyword2' => date("Y年m月d日H时i分s秒"), 'remark' => '支付成功,感谢您的光临,欢迎下次再次光临!'));
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'des' => htmlspecialchars_decode($order['des'], ENT_QUOTES), 'companytel' => $company['tel'], 'truename' => htmlspecialchars_decode($order['name'], ENT_QUOTES), 'tel' => $order['tel'], 'address' => htmlspecialchars_decode($order['address'], ENT_QUOTES), 'buytime' => $order['time'], 'orderid' => $order['orderid'], 'sendtime' => $order['reservetime'] > 0 ? $order['reservetime'] : '尽快送达', 'price' => $order['price'], 'total' => $order['total'], 'typename' => '外卖', 'ptype' => $order['paytype'], 'list' => $temp);
$msg = ArrayToStr::array_to_str($msg, $order['paid']);
$op->printit($token, $order['cid'], 'DishOut', $msg, $order['paid']);
}
header('Location:' . U('DishOut/myOrder', array('token' => $token, 'wecha_id' => $wecha_id, 'cid' => $order['cid'])));
} else {
exit('抱歉,订单信息出错');
}
}
示例5: index
public function index($orderid, $paytype = '', $third_id = '')
{
if ($order = M('Product_cart')->where(array('orderid' => $orderid))->find()) {
//TODO 发货的短信提醒
if ($order['paid']) {
$userInfo = D('Userinfo')->where(array('token' => $order['token'], 'wecha_id' => $order['wecha_id']))->find();
$carts = unserialize($order['info']);
$tdata = self::getCat($carts, $order['token'], $order['cid'], $userInfo['getcardtime']);
$list = array();
$info = '';
$pre = '';
foreach ($tdata[0] as $va) {
$t = array();
$salecount = 0;
if (!empty($va['detail'])) {
foreach ($va['detail'] as $v) {
$t = array('num' => $v['count'], 'colorName' => $v['colorName'], 'formatName' => $v['formatName'], 'price' => $v['price'], 'name' => $va['name']);
$list[] = $t;
$salecount += $v['count'];
}
} else {
$t = array('num' => $va['count'], 'price' => $va['price'], 'name' => $va['name']);
$list[] = $t;
$salecount = $va['count'];
}
$info .= $pre . $va['name'];
$pre = ',';
D("Product")->where(array('id' => $va['id']))->setInc('salecount', $salecount);
}
if ($order['twid']) {
if ($set = M("Twitter_set")->where(array('token' => $order['token'], 'cid' => $order['cid']))->find()) {
$price = $set['percent'] * 0.01 * $order['totalprice'];
$info = $info ? '购买' . $info . '等产品,订单号:' . $orderid : '购买订单号:' . $orderid;
D("Twitter_log")->add(array('token' => $order['token'], 'cid' => $order['cid'], 'twid' => $order['twid'], 'type' => 3, 'dateline' => time(), 'param' => $order['totalprice'], 'price' => $price, 'wecha_id' => $order['wecha_id'], 'info' => $info));
if ($count = M("Twitter_count")->where(array('token' => $order['token'], 'cid' => $order['cid'], 'twid' => $order['twid']))->find()) {
D("Twitter_count")->where(array('id' => $count['id']))->setInc('total', $price);
} else {
D("Twitter_count")->add(array('token' => $order['token'], 'cid' => $order['cid'], 'twid' => $order['twid'], 'total' => $price, 'remove' => 0));
}
}
}
$company = D('Company')->where(array('token' => $order['token'], 'id' => $order['cid']))->find();
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'companytel' => $company['tel'], 'truename' => $order['truename'], 'tel' => $order['tel'], 'address' => $order['address'], 'buytime' => $order['time'], 'orderid' => $order['orderid'], 'sendtime' => '', 'price' => $order['price'], 'total' => $order['total'], 'list' => $list);
$msg = ArrayToStr::array_to_str($msg, 1);
$op->printit($order['token'], $order['cid'], 'Store', $msg, 1);
$userInfo = D('Userinfo')->where(array('token' => $order['token'], 'wecha_id' => $order['wecha_id']))->find();
Sms::sendSms($order['token'], "您的顾客{$userInfo['truename']}刚刚对订单号:{$orderid}的订单进行了支付,请您注意查看并处理");
$model = new templateNews();
$model->sendTempMsg('OPENTM202521011', array('href' => U('Store/my', array('token' => $order['token'], 'wecha_id' => $order['wecha_id'], 'twid' => $order['twid']), true, false, true), 'wecha_id' => $order['wecha_id'], 'first' => '购买商品提醒', 'keyword1' => $orderid, 'keyword2' => date("Y年m月d日H时i分s秒"), 'remark' => '购买成功,感谢您的光临,欢迎下次再次光临!'));
}
header('Location:/index.php?g=Wap&m=Store&a=my&token=' . $order['token'] . '&wecha_id=' . $order['wecha_id'] . '&twid=' . $order['twid']);
} else {
exit('订单不存在:' . $out_trade_no);
exit('订单不存在');
}
}
示例6: index
public function index(){
$set_id = $this->_get('id','intval');
$formData = $this->_createForms($this->token,$set_id);
if(IS_POST){
$limit_info = $this->limit_db->where(array('limit_id'=>$this->thisForm['limit_id']))->find();
if($limit_info['enddate']){
if($limit_info['enddate']<time()){
$this->error('抱歉,时间已过期,无法提交');
}
}
if($limit_info['today_total'] >0){
$time = strtotime(date('Y-m-d')); //凌晨时间
$total = $this->info_db->where(array('wecha_id'=>$this->token,'wecha_id'=>$this->wecha_id,'add_time'=>array('gt',$time)))->count();
if($total >= $limit_info['today_total']){
$this->error('抱歉,今日只能提交'.$limit_info['today_total'].'次');
}
}
if($limit_info['sub_total'] >0){
$total = $this->info_db->where(array('wecha_id'=>$this->token,'wecha_id'=>$this->wecha_id))->count();
if($total >= $limit_info['sub_total']){
$this->error('抱歉,提交总数已经超过'.$limit_info['sub_total'].'次');
}
}
$data['token'] = $this->token;
$data['wecha_id'] = $this->wecha_id;
$data['set_id'] = $set_id;
$data['add_time'] = time();
$data['user_name'] = empty($this->fans['wechaname'])?'匿名':$this->fans['wechaname'];
$data['phone'] = empty($this->fans['tel'])?'匿名':$this->fans['tel'];
$data['sub_info'] = $this->_serializeSubInfo($this->_request(),$set_id);
if($this->info_db->add($data)){
Sms::sendSms($this->token, '你的表单“'.$this->thisForm['title'].'”中有新的信息'); //发送商家短信
$this->success($this->thisForm['succ_info']);
}else{
$this->error($this->thisForm['err_info']);
}
}else{
//提交记录
$spoor = $this->info_db->where(array('token'=>$this->token,'wecha_id'=>$this->wecha_id,'set_id'=>$set_id))->count();
$this->assign('spoor',$spoor);
//dump($formData['verify']);
$this->assign('verify',$formData['verify']);
$this->assign('formData',$formData['string']);
$this->display();
}
}
示例7: index
public function index($orderid, $paytype = '', $third_id = ''){
if ($order = M('Hotels_order')->where(array('orderid' => $orderid))->find()) {
//TODO 发货的短信提醒
if ($order['paid']) {
$userInfo = D('Userinfo')->where(array('token' => $order['token'], 'wecha_id' => $order['wecha_id']))->find();
$sort = M('Hotels_house_sort')->where(array('id' => $order['sid'], 'token' => $order['token']))->find();
$days = (strtotime($order['enddate']) - strtotime($order['startdate'])) / 86400;
$price = $userInfo['getcardtime'] > 0 ? ($sort['vprice'] ? $sort['vprice'] : $sort['price']) : $sort['price'];
$company = M('Company')->where(array('id' => $order['cid'], 'token' => $order['token']))->find();
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'companytel' => $company['tel'], 'truename' => $order['name'], 'tel' => $order['tel'], 'address' => '', 'buytime' => $order['time'], 'orderid' => $order['orderid'], 'sendtime' => '', 'price' => $order['price'], 'total' => $order['nums'], 'list' => array(array('name' => $sort['name'], 'day' => $days, 'price' => $price, 'num' => $order['nums'], 'startdate' => $order['startdate'], 'enddate' => $order['enddate'])));
$msg = ArrayToStr::array_to_str($msg, 1);
$op->printit($order['token'], $order['cid'], 'Hotel', $msg, 1);
Sms::sendSms($order['token'] . "_" . $order['cid'], "顾客{$order['name']}刚刚对订单号:{$orderid}的订单进行了支付,请您注意查看并处理");
$model = new templateNews();
$href = C('site_url').'/index.php?g=Wap&m=Hotels&a=my&token=' . $order['token'] . '&wecha_id=' . $order['wecha_id'] . '&cid=' . $order['cid'];
$model->sendTempMsg('OPENTM202521011', array('href' => $href, 'wecha_id' => $order['wecha_id'], 'first' => '预订房间提醒', 'keyword1' => $orderid, 'keyword2' => date("Y年m月d日H时i分s秒"), 'remark' => '预订房间成功,感谢您的光临,欢迎下次再次光临!'));
}
header('Location:/index.php?g=Wap&m=Hotels&a=my&token='.$order['token'].'&wecha_id='.$order['wecha_id'].'&cid='.$order['cid']);
// $this->redirect(U('Hotels/my', array('token'=>$this->token, 'wecha_id' => $this->wecha_id)));
}else{
exit('订单不存在');
}
// $product_cart_model=M('product_cart');
// $out_trade_no=$orderid;
// $order=$product_cart_model->where(array('orderid'=>$out_trade_no))->find();
// if (!$this->wecha_id){
// $this->wecha_id=$order['wecha_id'];
// }
// $sepOrder=0;
// if (!$order){
// $order=$product_cart_model->where(array('id'=>$out_trade_no))->find();
// $sepOrder=1;
// }
// if($order){
// if($order['paid']!=1){exit('该订单还未支付');}
// /************************************************/
// Sms::sendSms($this->token,'您的微信里有团购订单已经付款');
// /************************************************/
// header('Location:/index.php?g=Wap&m=Groupon&a=myOrders&token='.$order['token'].'&wecha_id='.$order['wecha_id']);
// }else{
// exit('订单不存在:'.$out_trade_no);
// }
}
示例8: index
public function index($orderid, $paytype, $third_id)
{
$product_cart_model = M('product_cart');
$out_trade_no = $orderid;
$order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
if (!$this->wecha_id) {
$this->wecha_id = $order['wecha_id'];
}
$sepOrder = 0;
if (!$order) {
$order = $product_cart_model->where(array('id' => $out_trade_no))->find();
$sepOrder = 1;
}
if ($order) {
if ($order['paid'] != 1) {
exit('该订单还未支付');
}
if (!empty($order['sn']) && empty($order['sn_content'])) {
$where['sendstutas'] = 0;
$where['order_id'] = 0;
$where['token'] = $this->token;
$where['pid'] = $order['productid'];
$productSn = M('ProductSn');
$models = $productSn->where($where)->limit($order['total'])->order('id ASC')->select();
foreach ($models as $key => $model) {
$model['order_id'] = $order['id'];
$model['sendstutas'] = 1;
$model['sendtime'] = time();
$model['wecha_id'] = $order['wecha_id'];
$updateWhere['id'] = $model['id'];
$updateWhere['sendstutas'] = 0;
unset($model['id']);
$productSn->where($updateWhere)->save($model);
$models[$key] = $model;
}
$order['sent'] = 1;
$order['handled'] = 1;
$order['sn_content'] = serialize($models);
$product_cart_model->save($order);
} else {
M('Product')->where(array('id' => $order['productid']))->setDec('groupon_num', $order['total']);
}
/************************************************/
Sms::sendSms($this->token, '您的微信里有团购订单已经付款');
/************************************************/
header('Location:/index.php?g=Wap&m=Groupon&a=myOrders&token=' . $order['token'] . '&wecha_id=' . $order['wecha_id']);
} else {
exit('订单不存在:' . $out_trade_no);
}
}
示例9: leave
public function leave()
{
//留言信息插入处理
$leave_model = M("leave");
$message = $this->_get('message');
$name = $this->_get('name');
$msgarr = array();
$msgarr['checked'] = 1 - intval($this->needCheck);
$msgarr['name'] = $name;
$msgarr['message'] = $message;
$msgarr['wecha_id'] = $this->wecha_id;
$msgarr['token'] = $this->token;
$msgarr['time'] = time();
//根据token 来确定同一用户60秒以后才能留言
$lasttime = $leave_model->where(array("token" => $this->token))->getField("max(time)");
//获得准备数据 是否与数据库中数据留言是同一人
$timeres = time() - $lasttime;
if ($timeres < $this->sepTime) {
$this->ajaxReturn("", "您已留言,请60秒以后再留言", 0);
exit;
} else {
$res = $leave_model->add($msgarr);
//echo $res;exit;
if ($res) {
Sms::sendSms($this->token, '留言板有新的留言');
$msgarr['id'] = $res;
if ($msgarr['checked'] == 1) {
$msgarr['time'] = date("Y-m-d H:i:s", $msgarr['time']);
$data['data'] = $msgarr;
$data['info'] = "留言成功";
$data['status'] = 1;
$this->ajaxReturn($data);
exit;
} else {
$data['data'] = $msgarr;
$data['info'] = "留言成功,正在审核中";
$data['status'] = 2;
$this->ajaxReturn($data);
exit;
}
} else {
$data['data'] = "";
$data['info'] = "留言失败";
$data['status'] = 0;
$this->ajaxReturn($data);
exit;
}
}
}
示例10: orderInfo
/**
* 订单详情
*/
public function orderInfo() {
$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$hotelOrder = M('Hotels_order');
if ($thisOrder = $hotelOrder->where(array('id' => $id, 'token' => $this->token, 'cid' => $this->_cid))->find()) {
if (IS_POST) {
$status = isset($_POST['status']) ? intval($_POST['status']) : 0;
$paid = isset($_POST['paid']) ? intval($_POST['paid']) : 0;
$hotelOrder->where(array('id' => $thisOrder['id']))->save(array('status' => $status, 'paid' => $paid));
$company = M('Company')->where(array('token' => $this->token, 'id' => $thisOrder['cid']))->find();
if ($paid && empty($thisOrder['paid'])) {
$sort = M('Hotels_house_sort')->where(array('id' => $thisOrder['sid'], 'token' => $this->token))->find();
$days = (strtotime($thisOrder['enddate']) - strtotime($thisOrder['startdate'])) / 86400;
$price = $this->fans['getcardtime'] > 0 ? ($sort['vprice'] ? $sort['vprice'] : $sort['price']) : $sort['price'];
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'companytel' => $company['tel'], 'truename' => $thisOrder['name'], 'tel' => $thisOrder['tel'], 'address' => '', 'buytime' => $thisOrder['time'], 'orderid' => $thisOrder['orderid'], 'sendtime' => '', 'price' => $thisOrder['price'], 'total' => $thisOrder['nums'], 'list' => array(array('name' => $sort['name'], 'day' => $days, 'price' => $price, 'num' => $thisOrder['nums'], 'startdate' => $thisOrder['startdate'], 'enddate' => $thisOrder['enddate'])));
$msg = ArrayToStr::array_to_str($msg, 1);
$op->printit($this->token, $this->_cid, 'Hotel', $msg, 1);
}
Sms::sendSms($this->token, "{$company['name']}欢迎您,本店对您的订单号为:{$thisOrder['orderid']}的订单状态进行了修改,如有任何疑意,请您及时联系本店!", $thisOrder['tel']);
$this->success('修改成功',U('Hotels/orderInfo',array('token'=>session('token'),'id'=>$thisOrder['id'])));
} else {
$sort = M('Hotels_house_sort')->where(array('cid' => $this->_cid, 'token' => $this->token, 'id' => $thisOrder['sid']))->find();
$thisOrder['housename'] = isset($sort['name']) ? $sort['name'] : '';
$this->assign('thisOrder', $thisOrder);
$this->display();
}
}
}
示例11: payReturn
/**
* 支付成功后的回调函数
*/
public function payReturn()
{
$orderid = $_GET['orderid'];
if ($order = M('Hotels_order')->where(array('orderid' => $orderid, 'token' => $this->token))->find()) {
//TODO 发货的短信提醒
if ($order['paid']) {
//Sms::sendSms($this->token, "您刚刚对订单号:{$orderid}的订单进行了支付,欢迎您的入住!", $order['tel']);
Sms::sendSms($this->token . "_" . $order['cid'], "顾客{$order['name']}刚刚对订单号:{$orderid}的订单进行了支付,请您注意查看并处理");
}
$this->redirect(U('Hotels/my', array('token' => $this->token, 'wecha_id' => $this->wecha_id)));
} else {
exit('订单不存在');
}
}
示例12: payReturn
protected function payReturn()
{
// $data = D('busines_second');
// $t_busines = D('busines');
$tb_resbook = D('reservebook');
$orderid = filter_var($this->_get('orderid'), FILTER_SANITIZE_STRING);
$token = filter_var($this->_get('token'), FILTER_SANITIZE_STRING);
$checkOrder = $tb_resbook->where(array('orderid' => $orderid, 'token' => $token))->find();
//根据订单号查出$order
if ($checkOrder) {
//如果订单存在
if ($checkOrder['paid'] === 1) {
//支付成功,发信息,跳转到订单别表页面
$this->assign('type', $checkOrder['type']);
$this->assign('token', $checkOrder['token']);
$this->assign('wecha_id', $checkOrder['wecha_id']);
//发送给商家
Sms::sendSms($checkOrder['token'], "亲爱的,您的会员 {$checkOrder['truename']},已经购买了{$checkOrder['orderName']} 并付款成功,金额为{$checkOrder['payprice']},订单号为{$checkOrder['orderid']}. " . date('Y-m-d H:i:s', time()));
//发给单个连锁商家
// Sms::sendSms(token_商家ID, 短信内容);
//发送给粉丝
Sms::endSms($checkOrder['token'], "亲爱的 {$checkOrder['truename']},您购买的{$checkOrder['orderName']} 已经付款成功,金额为{$checkOrder['payprice']},订单号为{$checkOrder['orderid']},感谢您惠顾! " . date('Y-m-d H:i:s', time()), $checkOrder['tel']);
self::mylist();
exit;
} else {
//如果没支付,则进入另外一个判断,如果订单没有支付,这里应该回滚库存.setInc()
M('busines_second')->where(array('sid' => $checkOrder['rid'], 'type' => $checkOrder['type'], 'token' => $checkOrder['token']))->setInc('googsnumber');
}
} else {
// $this->redirect('Business/index', array('token'=>$this->_get('token'),
// 'wecha_id'=>$this->_get('wecha_id'),'type'=>$this->_get('type'),'bid'=>$this->_get('bid'),
// 'sid'=>$this->_get('sid')), 2, '您好,系统里没有该订单...');
exit('订单不存在!');
}
}
示例13: saveorder
/**
* 提交订单
*/
public function saveorder()
{
$dataBase = D('Hotels_order');
if (IS_POST) {
$price = 0;
if ($sort = M('Hotels_house_sort')->where(array('cid' => $this->_cid, 'token' => $this->token, 'id' => $_POST['sid']))->find()) {
if ($this->fans['getcardtime'] > 0) {
$price = $sort['vprice'] ? $sort['vprice'] : $sort['price'];
} else {
$price = $sort['price'];
}
}
$days = (strtotime($_POST['enddate']) - strtotime($_POST['startdate'])) / 86400;
$sday = date("Y年m月d日", strtotime($_POST['startdate']));
$eday = date("Y年m月d日", strtotime($_POST['enddate']));
if ($_POST['startdate'] < date("Ymd") || $days < 1) {
$this->error('您预定的时间不正确');
}
//处理预定房间的数量
$in = date("Ymd", strtotime($_POST['startdate']));
$etime = strtotime($_POST['enddate']);
$hotelSort = M("Hotels_house_sort")->where(array('id' => $_POST['sid'], 'token' => $this->token))->find();
$time = strtotime($_POST['startdate']);
for (; $time < $etime;) {
$order = M('Hotels_order')->field('sum(nums) as num')->where(array('startdate' => array('ELT', date('Ymd', $time)), 'enddate' => array('GT', date('Ymd', $time)), 'token' => $this->token, 'cid' => $this->_cid, 'sid' => $_POST['sid'], 'status' => array('ELT', 1)))->find();
$oldnum = isset($order['num']) ? $order['num'] : 0;
$total = $_POST['nums'] + $oldnum;
if ($total > $hotelSort['houses']) {
$this->error('您预定的房间数在' . date('Y年m月d日', strtotime($time)) . '超出总房间数了,请重新预定');
} else {
$time += 86400;
}
}
$_POST['orderid'] = $orderid = substr($this->wecha_id, -1, 4) . date("YmdHis");
$_POST['price'] = $_POST['nums'] * $days * $price;
$_POST['time'] = time();
//保存个人信息
$userinfo_model = M('Userinfo');
$thisUser = $userinfo_model->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->find();
if (empty($thisUser)) {
$userRow = array('tel' => $_POST['tel'], 'truename' => $_POST['name'], 'address' => '');
$userRow['token'] = $this->token;
$userRow['wecha_id'] = $this->wecha_id;
$userRow['wechaname'] = '';
$userRow['qq'] = 0;
$userRow['sex'] = -1;
$userRow['age'] = 0;
$userRow['birthday'] = '';
$userRow['info'] = '';
$userRow['total_score'] = 0;
$userRow['sign_score'] = 0;
$userRow['expend_score'] = 0;
$userRow['continuous'] = 0;
$userRow['add_expend'] = 0;
$userRow['add_expend_time'] = 0;
$userRow['live_time'] = 0;
$userinfo_model->add($userRow);
}
if ($dataBase->create() !== false) {
$action = $dataBase->add();
if ($action != false) {
$company = M('Company')->where(array('id' => $this->_cid, 'token' => $this->token))->find();
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'companytel' => $company['tel'], 'truename' => $_POST['name'], 'tel' => $_POST['tel'], 'address' => '', 'buytime' => time(), 'orderid' => $_POST['orderid'], 'sendtime' => '', 'price' => $_POST['price'], 'total' => $_POST['nums'], 'list' => array(array('name' => $sort['name'], 'day' => $days, 'price' => $price, 'num' => $_POST['nums'], 'startdate' => $_POST['startdate'], 'enddate' => $_POST['enddate'])));
$msg = ArrayToStr::array_to_str($msg);
$op->printit($this->token, $this->_cid, 'Hotel', $msg, 0);
Sms::sendSms($this->token . "_" . $this->_cid, "顾客{$_POST['name']}刚刚预定了{$sday}到{$eday},{$days}天的{$sort['name']},请您注意查看并处理");
// $alipayConfig = M('Alipay_config')->where(array('token' => $this->token))->find();
// if ($_POST['paymode'] == 1 && $alipayConfig['open']) {
// $this->success('正在提交中...', U('Alipay/pay',array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'from'=> 'Hotels', 'orderName' => $orderid, 'single_orderid' => $orderid, 'price' => $_POST['price'])));
// } elseif ($_POST['paymode'] == 4 && $this->fans['balance']) {
// $this->success('正在提交中...', U('CardPay/pay',array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'from'=> 'Hotels', 'orderName' => $orderid, 'single_orderid' => $orderid, 'price' => $_POST['price'])));
// } else {
// $model = new templateNews();
// $model->sendTempMsg('TM00820', array('href' => U('Hotels/my',array('token' => $this->token, 'wecha_id' => $this->wecha_id)), 'wecha_id' => $this->wecha_id, 'first' => '预订房间提醒', 'keynote1' => '订单未支付', 'keynote2' => date("Y年m月d日H时i分s秒"), 'remark' => '预订房间成功,感谢您的光临,欢迎下次再次光临!'));
// $this->success('预定成功,进入您的订单页', U('Hotels/my',array('token' => $this->token, 'wecha_id' => $this->wecha_id)));
// }
$config = M('Alipay_config')->where(array('token' => $this->token))->find();
$model = new templateNews();
$model->sendTempMsg('TM00184', array('href' => U('Hotels/my', array('token' => $this->token, 'wecha_id' => $this->wecha_id), true, false, true), 'wecha_id' => $this->wecha_id, 'first' => '预订房间提醒', 'ordertape' => date("Y年m月d日H时i分s秒"), 'ordeID' => $orderid, 'remark' => '预订房间成功,感谢您的光临,欢迎下次再次光临!'));
if ($_POST['paymode'] == 4 && $this->fans['balance']) {
$this->success('正在提交中...', U('CardPay/pay', array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'from' => 'Hotels', 'orderName' => $orderid, 'single_orderid' => $orderid, 'price' => $_POST['price'])));
} elseif ($config['open']) {
$this->success('正在提交中...', U('Alipay/pay', array('token' => $this->token, 'wecha_id' => $this->wecha_id, 'from' => 'Hotels', 'orderName' => $orderid, 'single_orderid' => $orderid, 'price' => $_POST['price'])));
} else {
$this->success('预定成功,进入您的订单页', U('Hotels/my', array('token' => $this->token, 'wecha_id' => $this->wecha_id)));
}
} else {
$this->error('操作失败');
}
} else {
$this->error($dataBase->getError());
}
}
}
示例14: index
public function index()
{
$agent = $_SERVER['HTTP_USER_AGENT'];
if (!strpos($agent, "icroMessenger")) {
//echo '此功能只能在微信浏览器中使用';exit;
}
$cardid = intval($this->_get('cardid'));
//$sql=D('Userinfo');
$card = D('Member_card_create');
$data['wecha_id'] = $this->_get('wecha_id');
$data['token'] = $this->_get('token');
//
$cardInfoRow['wecha_id'] = $this->_get('wecha_id');
$cardInfoRow['token'] = $this->_get('token');
$cardInfoRow['cardid'] = $this->_get('cardid');
$cardinfo = $card->where($cardInfoRow)->find();
//是否领取过
$this->assign('cardInfo', $cardinfo);
//
$member_card_set_db = M('Member_card_set');
$thisCard = $member_card_set_db->where(array('token' => $this->_get('token'), 'id' => intval($_GET['cardid'])))->find();
if (!$thisCard && $cardid) {
exit;
}
//
$sql = D('Userinfo');
$userinfo = $sql->where($data)->find();
if ($thisCard['memberinfo'] != false) {
$img = $thisCard['memberinfo'];
} else {
$img = 'tpl/Wap/default/common/images/userinfo/fans.jpg';
}
$this->assign('cardnum', $cardinfo['number']);
$this->assign('homepic', $img);
$this->assign('info', $userinfo);
$this->assign('cardid', $cardid);
//redirect url
if (isset($_GET['redirect'])) {
$urlinfo = explode('|', $_GET['redirect']);
$parmArr = explode(',', $urlinfo[1]);
$parms = array('token' => $cardInfoRow['token'], 'wecha_id' => $cardInfoRow['wecha_id']);
if ($parmArr) {
foreach ($parmArr as $pa) {
$pas = explode(':', $pa);
$parms[$pas[0]] = $pas[1];
}
}
$redirectUrl = U($urlinfo[0], $parms);
$this->assign('redirectUrl', $redirectUrl);
}
//
if (IS_POST) {
//如果有post提交,说明是修改
$data['wechaname'] = $this->_post('wechaname');
$data['tel'] = $this->_post('tel');
if (empty($data['tel'])) {
$this->error("手机号必填。");
exit;
}
$data['truename'] = $this->_post('truename');
$data['qq'] = $this->_post('qq');
$data['sex'] = $this->_post('sex');
$data['bornyear'] = $this->_post('bornyear');
$data['bornmonth'] = $this->_post('bornmonth');
$data['bornday'] = $this->_post('bornday');
$data['portrait'] = $this->_post('portrait');
//如果会员卡不为空[更新]
//写入两个表 Userinfo Member_card_create
if ($cardid == 0) {
$infoWhere = array();
$infoWhere['wecha_id'] = $data['wecha_id'];
$infoWhere['token'] = $data['token'];
$userInfoExist = M('Userinfo')->where($infoWhere)->find();
if ($userInfoExist) {
M('Userinfo')->where($infoWhere)->save($data);
} else {
M('Userinfo')->add($data);
}
S('fans_' . $this->token . '_' . $this->wecha_id, NULL);
echo 1;
exit;
} else {
if ($cardinfo) {
//如果Member_card_create 不为空,说明领过卡,但是可以修改会员信息
$update['wecha_id'] = $data['wecha_id'];
$update['token'] = $data['token'];
unset($data['wecha_id']);
unset($data['token']);
if (M('Userinfo')->where($update)->save($data)) {
S('fans_' . $this->token . '_' . $this->wecha_id, NULL);
echo 1;
exit;
} else {
echo 0;
exit;
}
} else {
Sms::sendSms($this->token, '有新的会员领了会员卡');
$card = M('Member_card_create')->field('id,number')->where("token='" . $this->_get('token') . "' and cardid=" . intval($_POST['cardid']) . " and wecha_id = ''")->order('id ASC')->find();
//
//.........这里部分代码省略.........
示例15: index
public function index($orderid, $paytype = '', $third_id = '')
{
$wecha_id = '';
$token = '';
$cid = 0;
$dish_order_db = M('dish_order');
if ($order = $dish_order_db->where(array('tmporderid' => $orderid))->find()) {
//TODO 发货的短信提醒
$token = $order['token'];
$wecha_id = $order['wecha_id'];
$cid = $order['cid'];
$company = M('Company')->where(array('token' => $token, 'id' => $cid))->find();
$Dishcompany = M('Dish_company')->where(array('cid' => $cid))->find();
$kconoff = $Dishcompany['kconoff'];
$orderid = $order['orderid'];
if (empty($company) || !is_array($company)) {
header('Location:' . U('Repast/myOrders', array('token' => $token, 'wecha_id' => $wecha_id)));
}
$temp = !empty($order['info']) ? unserialize($order['info']) : array();
$temp = isset($temp['list']) ? $temp['list'] : $temp;
//$order['paid'] = 1;
if ($order['paid']) {
if (!empty($temp) && is_array($temp)) {
$log_db = M('Dishout_salelog');
$tmparr = array('token' => $token, 'cid' => $order['cid'], 'order_id' => $order['id'], 'paytype' => $order['paytype']);
$DishDb = M('Dish');
$mDishSet = ThirdPayRepast::getDishMainCompany($token);
foreach ($temp as $kk => $vv) {
$did = isset($vv['did']) ? $vv['did'] : $kk;
if ($did > 0) {
$flag = isset($vv['flag']) ? $vv['flag'] : '';
$newk = $flag . 'jc' . $did;
if (!($order['paycount'] > 0) || $kk == $newk) {
$dishofcid = $cid;
if ($mDishSet['cid'] != $cid && $mDishSet['dishsame'] == 1) {
$dishofcid = $mDishSet['cid'];
$kconoff = $mDishSet['kconoff'];
}
$tmpdish = $DishDb->where(array('id' => $did, 'cid' => $dishofcid))->find();
if ($kconoff && !empty($tmpdish) && $tmpdish['instock'] > 0) {
$DishDb->where(array('id' => $did, 'cid' => $dishofcid))->setDec('instock', $vv['num']);
}
$logarr = array('did' => $did, 'nums' => $vv['num'], 'unitprice' => $vv['price'], 'money' => $vv['num'] * $vv['price'], 'dname' => $vv['name'], 'addtime' => $order['time'], 'addtimestr' => date('Y-m-d H:i:s', $order['time']), 'comefrom' => 1);
$savelogarr = array_merge($tmparr, $logarr);
$log_db->add($savelogarr);
}
}
}
$dish_order_db->where(array('id' => $order['id'], 'cid' => $order['cid']))->setInc('paycount', 1);
}
if ($order['takeaway'] == 2 && $order['isover'] == 2) {
M('Dining_table')->where(array('id' => $order['tableid'], 'cid' => $order['cid']))->save(array('status' => 0));
} elseif ($order['takeaway'] == 2 && $order['isover'] == 1) {
$dish_order_db->where(array('id' => $order['id'], 'cid' => $order['cid']))->save(array('paid' => 0));
}
if ((empty($temp) || count($temp) == 1 && isset($temp['table'])) && $temp['total'] == 0) {
$temp = false;
$order['total'] = 1;
$bookTable = $order['price'];
} elseif ($order['takeaway'] == 2 && $order['advancepay'] > 0) {
$bookTable = false;
if ($order['paycount'] == 1) {
$realpay = $myorder['price'] - $myorder['havepaid'];
} elseif ($order['paycount'] == 0) {
$advancepay = $order['advancepay'];
}
$dish_order_db->where(array('id' => $order['id'], 'cid' => $order['cid']))->save(array('havepaid' => $order['advancepay'], 'advancepay' => 0));
} else {
$bookTable = false;
if (isset($temp['table']) && !empty($temp['table'])) {
$bookTable = $temp['table']['price'];
unset($temp['table']);
}
$realpay = $myorder['price'] - $myorder['havepaid'];
}
$op = new orderPrint();
$msg = array('companyname' => $company['name'], 'des' => $order['des'], 'companytel' => $company['tel'], 'truename' => $order['name'], 'tel' => $order['tel'], 'address' => $order['address'], 'buytime' => $order['time'], 'orderid' => $order['orderid'], 'bookTable' => $bookTable, 'price' => $order['price'], 'total' => $order['total'], 'ptype' => $order['paytype'], 'list' => $temp, 'advancepay' => isset($advancepay) ? $advancepay : false, 'realpay' => isset($realpay) ? $realpay : false);
$msg['typename'] = $order['takeaway'] == 2 ? '现场点餐' : '预约点餐';
if ($order['takeaway'] == 1) {
$msg['sendtime'] = $order['reservetime'];
$msg['typename'] = '外卖';
} elseif ($order['takeaway'] == 0) {
$tmpstr = ThirdPayRepast::GetCanTimeByoid($cid, $order['id'], $order['tableid']);
$msg['reservestr'] = $tmpstr ? date('Y-m-d', $order['reservetime']) . ' ' . $tmpstr : date('Y-m-d H:i', $order['reservetime']);
}
if ($order['tableid']) {
$t_table = M("Dining_table")->where(array('id' => $order['tableid']))->find();
$msg['tablename'] = isset($t_table['name']) ? $t_table['name'] : '';
}
$msg = ArrayToStr::array_to_str($msg, 1);
$op->printit($token, $cid, 'Repast', $msg, 1);
Sms::sendSms($token . "_" . $cid, "顾客{$order['name']}刚刚对订单号:{$orderid}的订单进行了支付,请您注意查看并处理");
$siteurl = $_SERVER['HTTP_HOST'];
$siteurl = strtolower($siteurl);
if (strpos($siteurl, "http:") === false && strpos($siteurl, "https:") === false) {
$siteurl = 'http://' . $siteurl;
}
$siteurl = rtrim($siteurl, '/');
$model = new templateNews();
/*$model->sendTempMsg('OPENTM202521011', array('href' =>U('Repast/myOrders', array('token' => $token, 'wecha_id' => $wecha_id, 'cid' => $cid), true, false, true), 'wecha_id' => $wecha_id, 'first' => '餐饮订餐交易提醒', 'keyword1' => $orderid, 'keyword2' => date("Y年m月d日H时i分s秒"), 'remark' => '支付成功,感谢您的光临,欢迎下次再次光临!'));*/
//.........这里部分代码省略.........