public function delay() { if (session('userid')) { $oid = $_GET['oid']; if ($oid) { $order_db = M('Order'); $userid = session('userid'); $map['oid'] = $oid; $map['userid'] = $userid; $oinfo = $order_db->table(C('DB_PREFIX') . 'order O')->join(C('DB_PREFIX') . 'Users U on O.userid = U.userid')->join(C('DB_PREFIX') . 'Users CU on O.cuserid = CU.userid')->join(C('DB_PREFIX') . 'Province P on U.province = P.code')->join(C('DB_PREFIX') . 'City CT on U.city = CT.code')->join(C('DB_PREFIX') . 'Car C on O.cid = C.cid')->join(C('DB_PREFIX') . 'Carbrand CB on C.cbrand = CB.brandid')->join(C('DB_PREFIX') . 'Carmodel CM on C.cmodel = CM.modelid')->field("O.*,C.cppro,C.cpzm,C.cpnum,U.name as username, U.sex, U.tel as usertel,CU.name as cusername,CU.tel as cusertel, CU.openid as cuopenid, P.name as provincename,CT.name as cityname,CB.brandname,CM.name as modelname")->where($map)->find(); $data['is_delay'] = '1'; $ress = $order_db->where($map)->save($data); if ($ress) { $oinfo['username'] = namereplace($oinfo['username'], $oinfo['sex']); $ccontent = $oinfo['username'] . "已经申请延迟1天还车,请您确认。如您同意延迟换车,则按正常费率计算延迟费用;如您不同意订单延迟,对于超时还车将按1.5倍计费,请在微信客户端回复确认。"; sendmsg($oinfo['cusertel'], $ccontent); $content = "您对" . $oinfo['modelname'] . $oinfo['brandname'] . "(" . $oinfo['cppro'] . $oinfo['cpzm'] . $oinfo['cpnum'] . ")的换驾单 已经申请延迟1天还车,请等待车主确认;如车主同意延迟换车,则按正常费率计算延迟费用;如车主不同意延迟,请按原定时间还车,否则将收取1.5倍超时罚金"; sendmsg($oinfo['usertel'], $content); $sysmsg_db = D('Sysmsg'); $sysmsg_db->sendmsg($oinfo['cuserid'], "您有一个换驾单驾友申请延迟还车,请查看。", '2', '0', $oinfo['oid']); if ($oinfo['cuopenid']) { @import("Wxapi.Wxpuch", APP_PATH, '.class.php'); $pushwx = new \Wxpuch(); $openid = $oinfo['cuopenid']; $template_id = "alI51h9F3yYcJ9FQ6_z_-HTVcvKgjmmJi3ozFcGFRSY"; $url = "http://www.52huanjia.com/clyy/weixin/index/morder/oid/" . $oid; $data = array('first' => array('value' => urlencode("您好,你有一个换驾单的驾友申请延迟还车,请查看处理。"), 'color' => "#000000"), 'orderNo' => array('value' => urlencode($oinfo['order_sn']), 'color' => '#000000'), 'orderStatus' => array('value' => urlencode('驾友申请延迟还车'), 'color' => '#000000'), 'takeCarAt' => array('value' => urlencode($oinfo['bgtime']), 'color' => '#000000'), 'returnCarAt' => array('value' => urlencode($oinfo['endtime']), 'color' => '#000000'), 'carType' => array('value' => urlencode($oinfo['brandname'] . $oinfo['name'] . "(" . $oinfo['cppro'] . $oinfo['cpzm'] . substr_replace($oinfo['cpnum'], '****', 0, 4) . ")"), 'color' => '#000000'), 'remark' => array('value' => urlencode('你有一个换驾单的驾友申请延迟还车,请您查看处理。'), 'color' => '#000000')); $pushwx->doSend($openid, $template_id, $url, $data); } } $this->redirect('Index/vieworder', array('oid' => $oid, 'shuaxin' => rand())); } else { $this->redirect('User/myorder'); } } else { $this->redirect('User/login'); } }
public function opaydeback() { if (isset($_POST['signature'])) { if (verify($_POST)) { if ($_POST['respCode'] == '00') { $order_db = M('Order'); $order_sn = $_POST['orderId']; $map['order_sn'] = $order_sn; $oinfo = $order_db->table(C('DB_PREFIX') . 'order O')->join(C('DB_PREFIX') . 'Users U on O.userid = U.userid')->join(C('DB_PREFIX') . 'Users CU on O.cuserid = CU.userid')->join(C('DB_PREFIX') . 'Province P on U.province = P.code')->join(C('DB_PREFIX') . 'City CT on U.city = CT.code')->join(C('DB_PREFIX') . 'Car C on O.cid = C.cid')->join(C('DB_PREFIX') . 'Carbrand CB on C.cbrand = CB.brandid')->join(C('DB_PREFIX') . 'Carmodel CM on C.cmodel = CM.modelid')->field("O.*,C.cppro,C.cpzm,C.cpnum,U.name as username, U.sex, U.tel as usertel,CU.name as cusername,CU.tel as cusertel,CU.openid as cuopenid,P.name as provincename,CT.name as cityname,CB.brandname,CM.name as modelname")->where($map)->find(); if ($oinfo['status'] != '3') { $odata['status'] = '3'; $omap['oid'] = $oinfo['oid']; $odata['trade_no'] = $_POST['queryId']; $ores = $order_db->where($omap)->save($odata); $oinfo['username'] = namereplace($oinfo['username'], $oinfo['sex']); $jycontent1 = $oinfo['provincename'] . $oinfo['cityname'] . $oinfo['username'] . "已经成功支付【" . $oinfo['bgtime'] . "-" . $oinfo['endtime'] . "】的换驾订单押金;您的车辆换驾订单已经生效;请按时准备换驾车辆,像对待老朋友一样,将带有您个人魅力的爱车按时交接给" . $oinfo['username'] . "。"; sendmsg($oinfo['cusertel'], $jycontent1); $jycontent2 = "您已经成功支付换驾押金,您的换驾订单已经生效;请您及时登录网站支付违章押金,如无违章记录,违章押金将在还车后30天内全额返还。您可以采用共享豆(共享豆不足可充值)、信用卡(预授权)、储值卡进行支付。"; sendmsg($oinfo['usertel'], $jycontent2); $sysmsg_db = D('Sysmsg'); $sysmsg_db->sendmsg($oinfo['cuserid'], "您有一个订单状态变更,驾友已支付完成订单和车辆押金,请查看。", '2', '0', $oinfo['oid']); //模版消息推送 if ($oinfo['cuopenid']) { @import("Wxapi.Wxpuch", APP_PATH, '.class.php'); $pushwx = new \Wxpuch(); $openid = $oinfo['cuopenid']; $template_id = "alI51h9F3yYcJ9FQ6_z_-HTVcvKgjmmJi3ozFcGFRSY"; $url = "http://www.52huanjia.com/clyy/weixin/index/morder/oid/" . $oinfo['oid']; $data = array('first' => array('value' => urlencode("您好,你有一个换驾单驾友已支付,换架单已生效,请查看。"), 'color' => "#000000"), 'orderNo' => array('value' => urlencode($oinfo['order_sn']), 'color' => '#000000'), 'orderStatus' => array('value' => urlencode('驾友已支付,待缴违章押金。'), 'color' => '#000000'), 'takeCarAt' => array('value' => urlencode($oinfo['bgtime']), 'color' => '#000000'), 'returnCarAt' => array('value' => urlencode($oinfo['endtime']), 'color' => '#000000'), 'carType' => array('value' => urlencode($oinfo['modelname'] . $oinfo['brandname'] . "(" . $oinfo['cppro'] . $oinfo['cpzm'] . substr_replace($oinfo['cpnum'], '****', 0, 4) . ")"), 'color' => '#000000'), 'remark' => array('value' => urlencode('您的车辆换驾订单已经生效;请按时准备换驾车辆,像对待老朋友一样,将带有您个人魅力的爱车按时交接给驾友。'), 'color' => '#000000')); $pushwx->doSend($openid, $template_id, $url, $data); } echo "200"; } else { echo "200"; } } } } }