|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771 |
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 张帅
- * PhpStorm OrderService.php
- * Create By 2016/11/16 17:13 $
- */
-
- namespace Order\Service;
-
-
- use Base\Tool\LoginTool;
- use Base\Tool\WxPayService;
- use Order\Model\BaseSupplier;
- use Order\Model\OrderlistModel;
- use Model\Model\OrderMain;
- use Order\Model\RunMain;
- use Base\Lib\phpqrcode\QrCode;
- use Order\Model\WechatCustomer;
- use Service\Service\OrderLog;
- use Trip\Service\BaseService;
- use Util\Util\CurlInterface;
- use Util\Util\Util;
-
- class OrderService
- {
- /**
- * Function Description:获取初始化数据
- * Function Name: getRunDetail
- * @param $run_id
- * @param $start_area_id
- * @param $end_area_id
- * @param $channel_id
- *
- * @return array|mixed|string
- *
- * @author 张帅
- */
- public function getRunDetail($run_id, $start_area_id, $end_area_id, $channel_id)
- {
- //获取班次详情
- $run_info = $this->getRunInfo($run_id);
- if (!$run_info['flag']) {
- return $run_info;
- }
- $BaseService = new BaseService();
- $poi_info = $BaseService->getPoiInfoArr();
- $poi_info = $poi_info['poi_info'];
- $run['run_id'] = $run_info['data']['run_id'];
- $run['start_area_id'] = $start_area_id;
- $run['start_area_name'] = $poi_info[$start_area_id]['area_name'];
- $run['end_area_id'] = $end_area_id;
- $run['end_area_name'] = $poi_info[$end_area_id]['area_name'];
- $run['run_date'] = $run_info['data']['run_date'];
- $run['run_time'] = $run_info['data']['run_time'];
- //获取上车站点
- $start_station = $this->getStartStation($run_id, $start_area_id);
- if (!$start_station['flag']) {
- return $start_station;
- }
- $start_res_arr = $start_station['data'];
- $run['start_res_arr'] = $start_res_arr;
- //获取默认选中的上车站
- $start_res_id = $start_res_arr[0]['res_id'];
- $run['select_start_res']['res_id'] = $start_res_arr[0]['res_id'];
- $run['select_start_res']['res_name'] = $start_res_arr[0]['res_name'];
- $run['select_start_res']['res_time'] = $start_res_arr[0]['res_time'];
- //获取下车站点
- $end_station = $this->getEndStation($run_id, $run_id, $start_res_id, $end_area_id);
- if (!$end_station['flag']) {
- return $end_station;
- }
- $end_res_arr = $end_station['data'];
- $run['end_res_arr'] = $end_res_arr;
- //获取默认选中的上车站
- $end_res_id = $end_res_arr[0]['res_id'];
- $run['select_end_res']['res_id'] = $end_res_arr[0]['res_id'];
- $run['select_end_res']['res_name'] = $end_res_arr[0]['res_name'];
- $run['select_end_res']['res_time'] = $end_res_arr[0]['res_time'];
- //获取票种信息
- $ticket_info = $this->getTicketInfo($run_id, $start_res_id, $end_res_id);
- if (!$ticket_info['flag']) {
- return $ticket_info;
- }
- $ticket_info = $ticket_info['data'];
- //处理票种详情
- $ticket_info = $this->execTicket($ticket_info);
- //获取票种id
- $ticket_id = $ticket_info['ticket_id'];
- //获取优惠价
- $discount_price = $this->getDiscountPrice($ticket_id, $channel_id);
- if (!$discount_price['flag']) {
- return $discount_price;
- }
- $discount_price = $discount_price['data'];
- if (count($discount_price) == 0) {
- $discount_price = '0';
- } else {
- $discount_price = $discount_price['off_value'];
- }
- $ticket_info['discount_price'] = $discount_price;
- $run['ticket_info'] = $ticket_info;
- return Util::returnArrSu('', $run);
- }
-
- /**
- * Function Description:通过上车站点获取初始化数据
- * Function Name: getRunDetailByStart
- * @param $run_id
- * @param $start_res_id
- * @param $end_area_id
- * @param $channel_id
- *
- * @return array|mixed|string
- *
- * @author 张帅
- */
- public function getRunDetailByStart($run_id, $start_res_id, $end_area_id, $channel_id)
- {
- //获取下车站点
- $end_station = $this->getEndStation($run_id, $run_id, $start_res_id, $end_area_id);
- if (!$end_station['flag']) {
- return $end_station;
- }
- $end_res_arr = $end_station['data'];
- $run['end_res_arr'] = $end_res_arr;
- //获取默认选中的上车站
- $end_res_id = $end_res_arr[0]['res_id'];
- $run['select_end_res']['res_id'] = $end_res_arr[0]['res_id'];
- $run['select_end_res']['res_name'] = $end_res_arr[0]['res_name'];
- $run['select_end_res']['res_time'] = $end_res_arr[0]['res_time'];
- //获取票种信息
- $ticket_info = $this->getTicketInfo($run_id, $start_res_id, $end_res_id);
- if (!$ticket_info['flag']) {
- return $ticket_info;
- }
- $ticket_info = $ticket_info['data'];
- //处理票种详情
- $ticket_info = $this->execTicket($ticket_info);
- //获取票种id
- $ticket_id = $ticket_info['ticket_id'];
- //获取优惠价
- $discount_price = $this->getDiscountPrice($ticket_id, $channel_id);
- if (!$discount_price['flag']) {
- return $discount_price;
- }
- $discount_price = $discount_price['data'];
- if (count($discount_price) == 0) {
- $discount_price = '0';
- } else {
- $discount_price = $discount_price['off_value'];
- }
- $ticket_info['discount_price'] = $discount_price;
- $run['ticket_info'] = $ticket_info;
- return Util::returnArrSu('', $run);
- }
-
- /**
- * Function Description:通过下车站点获取初始化数据
- * Function Name: getRunDetailByEnd
- * @param $run_id
- * @param $start_res_id
- * @param $end_res_id
- * @param $channel_id
- *
- * @return array|mixed|string
- *
- * @author 张帅
- */
- public function getRunDetailByEnd($run_id, $start_res_id, $end_res_id, $channel_id)
- {
- //获取票种信息
- $ticket_info = $this->getTicketInfo($run_id, $start_res_id, $end_res_id);
- if (!$ticket_info['flag']) {
- return $ticket_info;
- }
- $ticket_info = $ticket_info['data'];
- //处理票种详情
- $ticket_info = $this->execTicket($ticket_info);
- //获取票种id
- $ticket_id = $ticket_info['ticket_id'];
- //获取优惠价
- $discount_price = $this->getDiscountPrice($ticket_id, $channel_id);
- if (!$discount_price['flag']) {
- return $discount_price;
- }
- $discount_price = $discount_price['data'];
- if (count($discount_price) == 0) {
- $discount_price = '0';
- } else {
- $discount_price = $discount_price['off_value'];
- }
- $ticket_info['discount_price'] = $discount_price;
- $run['ticket_info'] = $ticket_info;
- return Util::returnArrSu('', $run);
- }
-
- /**
- * Function Description:获取班次信息详情
- * Function Name: getRunInfo
- * @param $run_id
- *
- * @return mixed
- *
- * @author 张帅
- */
- public function getRunInfo($run_id)
- {
- $run_main = new RunMain();
- $run_info = $run_main->getRunDetail($run_id);
- return $run_info;
- }
-
- /**
- * Function Description:获取上车站点数据
- * Function Name: getStartStation
- * @param $run_id
- * @param $start_area_id
- *
- * @return array
- *
- * @author 张帅
- */
- public function getStartStation($run_id, $start_area_id)
- {
- $run_main = new RunMain();
- $start_station = $run_main->getStartStation($run_id, $start_area_id);
- return $start_station;
- }
-
- /**
- * Function Description:获取下车站点数据
- * Function Name: getEndStation
- * @param $run_id
- * @param $run_id
- * @param $start_res_id
- * @param $end_area_id
- *
- * @return array
- *
- * @author 张帅
- */
- public function getEndStation($run_id, $run_id, $start_res_id, $end_area_id)
- {
- $run_main = new RunMain();
- $end_station = $run_main->getEndStation($run_id, $start_res_id, $end_area_id);
- return $end_station;
- }
-
- /**
- * Function Description:获取票种信息
- * Function Name: getTicketInfo
- * @param $run_id
- * @param $start_res_id
- * @param $end_res_id
- *
- * @return array
- *
- * @author 张帅
- */
- public function getTicketInfo($run_id, $start_res_id, $end_res_id)
- {
- $run_main = new RunMain();
- $ticket_info = $run_main->getTicketInfo($run_id, $start_res_id, $end_res_id);
- return $ticket_info;
- }
-
- /**
- * Function Description:获取优惠价格
- * Function Name: getDiscountPrice
- * @param $ticket_id
- * @param $channel_id
- *
- * @return array
- *
- * @author 张帅
- */
- public function getDiscountPrice($ticket_id, $channel_id)
- {
- $run_main = new RunMain();
- $discount_price = $run_main->getDiscountPrice($ticket_id, $channel_id);
- return $discount_price;
- }
-
- /**
- * Function Description:
- * Function Name: execTicket
- * @param $ticket_info
- *
- * @return mixed
- *
- * @author 倪宗锋
- */
- public function execTicket($ticket_info)
- {
- $time_diff = strtotime($ticket_info['end_time']) - strtotime($ticket_info['start_time']);
- $remain = $time_diff % 86400;
- if ($remain <= 0) {
- $remain = 24 * 3600 + $remain;
- }
- $hours = intval($remain / 3600);
- $remain = $remain % 3600;
- $min = intval($remain / 60);
- $ticket_info['price'] = ceil($ticket_info['price']);
- $ticket_info['total_time'] = $hours . '时' . $min . '分';
- unset($ticket_info['line_id']);
- unset($ticket_info['start_time']);
- unset($ticket_info['end_time']);
- return $ticket_info;
- }
-
- /**
- * Function Description:添加乘客人
- * Function Name: addCustomer
- * @param $customer_name
- * @param $customer_id_card
- *
- * @return string
- *
- * @author 张帅
- */
- public function addCustomer($customer_name, $customer_id_card)
- {
- $we_user_id = LoginTool::$userId;//$_SESSION['we_user_id'];
- $wechat_customer = new WechatCustomer();
- $result = $wechat_customer->addCustomer($customer_name, $customer_id_card, $we_user_id);
- return $result;
- }
-
- /**
- * Function Description:修改联系人信息
- * Function Name: uptCustomer
- * @param $customer_name
- * @param $customer_id_card
- * @param $customer_id
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function uptCustomer($customer_name, $customer_id_card, $customer_id)
- {
- $wechat_customer = new WechatCustomer();
- $result = $wechat_customer->uptCustomer($customer_name, $customer_id_card, $customer_id);
- return $result;
- }
-
- /**
- * Function Description:获取乘客人
- * Function Name: getCustomerList
- *
- * @return string
- *
- * @author 张帅
- */
- public function getCustomerList()
- {
- $we_user_id = LoginTool::$userId;//$_SESSION['we_user_id'];
- $wechat_customer = new WechatCustomer();
- $result = $wechat_customer->getCustomerList($we_user_id);
- return $result;
- }
-
- /**
- * Function Description:订单提交
- * Function Name: submitOrder
- * @param $params
- *
- * @return array
- *
- * @author 倪宗锋
- */
- public function submitOrder($params)
- {
- //第一步 本地下单
- //价格校验
- // $getOrder = $this->getPrice($params['ticket_info'], $params['channel_id']);
- // if (!$getOrder) {
- // return Util::returnArrEr('订票失败');
- // }
- $result = $this->addOrder($params);
- $orderId = $result['data'];
- if (!$result['flag'] && !empty($result['data'])) {
- //如果下单失败,执行退票操作
- $this->cancelOrder($orderId);
- return Util::returnArrEr($result['msg']);
- }
- //本地下单成功后 则前往微信下单
- //如果是M站 web 则跳转
- if ($params['pay_type'] == '278') {
- //跳转地址 用于网页跳转
- $url = 'http://wx.zhizhuchuxing.com/wechat/WxPay/realpay/weChatShopPay.php?order_id=' . $orderId;
- //记录下单日志
- OrderLog::addOrder($orderId, 2);
- return Util::returnArrSu('', '', $url);
- }
- //否则就是app站点 则调用微信下单接口 并获取返回值`
- $wxPayService = new WxPayService();
- $result = $wxPayService->unifiedOrderByOrderId($orderId);//去微信下单并获取返回值
- if ($result['flag'] == true) {//记录下单日志
- OrderLog::addOrder($orderId, 2);
- }
- return $result;
- }
-
- /**
- * Function Description:添加订单 服务器数据库添加订单信息
- * Function Name: addOrder
- * @param $params
- *
- * @return array
- *
- * @author 张帅
- */
- public function addOrder($params)
- {
- $base_supplier = new BaseSupplier();
- $member_id = LoginTool::$userId;
- //1.获取业务员
- $salesman = $base_supplier->getSalesman($params['channel_id']);
- if (!$salesman['flag']) {
- return $salesman;
- }
- $params['salesman'] = $salesman['data']['sales_man'];
- //2.提交订单
- $order_main = new OrderMain();
- $order_id = $order_main->submitOrder($params);
- if (!$order_id['flag']) {
- return $order_id;
- }
- //3.获取订单号
- $order_id = $order_id['data'];
- //4.更新订单order_book_status
- $order_book_status_result = $order_main->updateBookStatus($order_id);
- if (!$order_book_status_result['flag']) {
- return $order_book_status_result;
- }
-
- //5.如果是往返订单,把订单手机城数组
- $order_id3 = explode(',', $order_id);
- if (count($order_id3) > 1) {
- $order_id1 = $order_id3[0];//去程订单
- $order_id2 = $order_id3[1];//返程订单
- //将往返订单连接起来
- $result = $order_main->linkOrder($order_id1, $order_id2);
- if (!$result) {
- return Util::returnArrEr('订单连接失败', $order_id1);
- }
- } else {
- $order_id1 = $order_id3[0];//单程订单
- }
-
- //6.修改订单的会员id
- $member_result = $order_main->updateMemberId($member_id, $order_id);
- if (!$member_result) {
- return Util::returnArrEr('插入订单失败', $order_id1);
- }
- return $result = Util::returnArrSu('', $order_id1);
- }
-
- /**
- * Function Description:验证身份证
- * Function Name: isCardID
- * @param $sId
- *
- * @return array
- *
- * @author 张帅
- */
- public function isCardID($sId)
- {
- $aCity = array(
- 11 => "北京",
- 12 => "天津",
- 13 => "河北",
- 14 => "山西",
- 15 => "内蒙古",
- 21 => "辽宁",
- 22 => "吉林",
- 23 => "黑龙江",
- 31 => "上海",
- 32 => "江苏",
- 33 => "浙江",
- 34 => "安徽",
- 35 => "福建",
- 36 => "江西",
- 37 => "山东",
- 41 => "河南",
- 42 => "湖北",
- 43 => "湖南",
- 44 => "广东",
- 45 => "广西",
- 46 => "海南",
- 50 => "重庆",
- 51 => "四川",
- 52 => "贵州",
- 53 => "云南",
- 54 => "西藏",
- 61 => "陕西",
- 62 => "甘肃",
- 63 => "青海",
- 64 => "宁夏",
- 65 => "新疆",
- 71 => "台湾",
- 81 => "香港",
- 82 => "澳门",
- 91 => "国外"
- );
- $iSum = 0;
- $result1 = Util::checkPattern('', $sId, '/^\d{17}(\d|x)$/i');
- //你输入的身份证长度或格式错误
- if (!$result1) {
- return Util::returnArrEr('你输入的身份证长度或格式错误');
- }
- $sId = str_replace('X', 'a', $sId);
- $sId = str_replace('x', 'a', $sId);
- $city = substr($sId, 0, 2);
- //你的身份证地区非法
- if (!isset($aCity[$city])) {
- return Util::returnArrEr('你的身份证地区非法');
- }
- $sBirthday = substr($sId, 6, 4) . '-' . substr($sId, 10, 2) . '-' . substr($sId, 12, 2);
- $result2 = Util::checkPattern('', $sBirthday, '/^(19|20)\d{2}-(1[0-2]|0?[1-9])-(0?[1-9]|[1-2][0-9]|3[0-1])$/');
- //身份证上的出生日期非法
- if (!$result2) {
- return Util::returnArrEr('身份证上的出生日期非法');
- }
-
- for ($i = 17; $i >= 0; $i--) {
- $pow = 1;
- for ($j = 1; $j <= $i; $j++) {
- $pow *= 2;
- }
- $charAt = 17 - $i;
- if ($sId[$charAt] == 'a') {
- $sId[$charAt] = 10;
- }
- $iSum += ($pow % 11) * $sId[$charAt];
- }
- //你输入的身份证号非法
- if ($iSum % 11 != 1) {
- return Util::returnArrEr('你输入的身份证号非法');
- }
- return Util::returnArrSu();
- }
-
- /**
- * Des:获取电子车票二维码,根据订单号生成二维码和检票信息
- * Name: getETicket
- * @param $order_id
- * @return string
- * @author 倪宗锋
- */
- public function getETicket($order_id)
- {
- $qr_path = "images/temp/QrCode/$order_id.png";
- $logo_qr_path = "images/temp/QrCode/logo$order_id.png";
- $errorCorrectionLevel = 'L'; //容错级别
- $matrixPointSize = 7; //生成图片大小
- $content = $order_id;
- // 生成二维码图片
- if (file_exists($qr_path))
- unlink($qr_path);
- if (file_exists($logo_qr_path))
- unlink($logo_qr_path);
- QrCode::png($content, $qr_path, $errorCorrectionLevel, $matrixPointSize, 2);
- $QR = $qr_path;
- // 输出二维码图片
- return "/public/$QR";
- }
-
- /**
- * Des:修改订单状态,插入支付凭证
- * Name: updateOrderStatus
- * @param $order_id
- * @param $pay_num
- * @return array
- * @author 张帅
- */
- public function updateOrderStatus($order_id, $pay_num)
- {
- $order_main = new OrderMain();
- //1.判断订单是否完成
- $check_result = $order_main->checkStatus($order_id);
- //执行sql 错误
- if (!$check_result['flag']) {
- return $check_result;
- }
-
- //已出票
- if ($check_result['data'] == 146) {
- return $check_result;
- }
-
- $result1 = $order_main->updateOrderStatus($order_id);
- if (!$result1) {
- return $result1;
- }
- $order_group = $result1['data'];
- $order_group = explode(',', $order_group);
-
- $result = $order_main->insSerialNumber($order_id, $pay_num);
-
- //7.发短信
- $url1='http://cs1.zhizhuchuxing.com/api/msg/order-send-msg';
- $data = array('order_id' => $order_group[0], 'msg_type' => 'wx' );
- $a = new CurlInterface($data, 5);
- $a->setBaseUrl($url1);
- $a->execute('', 'POST');
-
- if (isset($order_group[1])) {
- $data = array('order_id' => $order_group[1]);
- $a = new CurlInterface($data, 5);
- $a->setBaseUrl($url1);
- $a->execute('', 'POST');
- }
- OrderLog::addOrderStatusLog($order_id, 2);//添加订单状态变更记录 2:支付
- return $result;
- }
-
-
- /**
- * Function Description:退票
- * Function Name: cancelOrder
- * @param $order_id
- *
- * @return string
- *
- * @author 张帅
- */
- public function cancelOrder($order_id)
- {
- $order_main = new OrderMain();
- $result = $order_main->cancelOrder($order_id);
- if (!$result) {
- return Util::returnJsEr('退票失败');
- } else {
- return Util::returnJsSu('退票成功');
- }
- }
-
- /**
- * Function Description:退钱
- * Function Name: cancelPay
- * @param $order_id
- *
- * @return string
- *
- * @author 张帅
- */
- public function cancelPay($order_id)
- {
- //1.获取订单详情
- $order_list = new OrderlistModel();
- $order_detail = $order_list->getOrderall($order_id);
- if (!$order_detail['flag']) {
- return Util::returnJsEr('网络原因,退票失败');
- }
- $order_detail = $order_detail['data'];
- $price = $order_detail['price'];
- $order_id = $order_detail['order_id'];
-
- //2.判断时间是否符合退票时间
- $run_time = $order_detail[0]['run_date'] . ' ' . $order_detail[0]['start_time'];
- $time_check = strtotime($run_time) - time();
- if ($time_check < 1800) {
- return Util::returnJsEr('开车前30分钟禁止退票,请刷新页面确认时间');
- }
-
-
- $order_id_arr = explode(',', $order_id);
- if (count($order_id_arr) > 1) {
- $go_order_id = $order_id_arr[0];//去程订单号
- $back_order_id = $order_id_arr[1];//返程订单号
- } else {
- $go_order_id = $order_id_arr[0];
- $back_order_id = '';
- }
-
- //3.获取支付凭证
- $order_main = new OrderMain();
- $serial_result = $order_main->getSerialNumber($go_order_id);
- if (!$serial_result['flag']) {
- return json_encode($serial_result);
- }
- $serial_number = $serial_result['data'];
-
- //4.数据库系统退票
- $cancel_result = $order_main->cancelOrderOne($go_order_id);
- if (!$cancel_result) {
- return Util::returnJsEr('去返程订单系统退票出错,请稍后重试' . $go_order_id);
- }
- if ($back_order_id != '') {
- $cancel_result = $order_main->cancelOrderOne($back_order_id);
- if (!$cancel_result) {
- return Util::returnJsEr('返程订单系统退票出错,请稍后重试' . $back_order_id);
- }
- }
-
- //5.将数据插入退票表
- $insert_result = $order_main->insCancelWeChatOrder($go_order_id, $price, $serial_number);
- if (!$insert_result) {
- return json_encode($insert_result);
- }
- OrderLog::cancelOrder($order_id, 2);
- return Util::returnJsSu('退票成功');
- }
-
- /**
- * Function Description:校验价格
- * Function Name: getPrice
- * @param $tick_info
- * @param $channel_id
- *
- * @return bool
- *
- * @author 娄梦宁
- */
- public function getPrice($tick_info, $channel_id)
- {
- $orderMain = new OrderMain();
- $runMain = new RunMain();
- $count = substr_count($tick_info, '{');
- if ($count == 1) {//单程票
- $tick_info = ltrim($tick_info, '{');
- $tick_info = rtrim($tick_info, '}');
- $tick_info_arr = explode(',', $tick_info);
- $tick_id = $tick_info_arr[2];
- $price_check = $orderMain->getPriceGo($tick_id);
- $price = $tick_info_arr[3];
- if ($price_check == $price) {
- return true;
- }
- } elseif ($count == 2) {//往返票种
- $tick_info = str_replace('}{', ',', $tick_info);
- $tick_info = ltrim($tick_info, '{');
- $tick_info = rtrim($tick_info, '}');
- $tick_info_arr = explode(',', $tick_info);
- $go_tick_id = $tick_info_arr[2];
- $go_tick_price = $tick_info_arr[3];
- $go_discount_price1 = $runMain->getDiscountPrice($go_tick_id, $channel_id);
- $go_price = $orderMain->getPriceGo($go_tick_id);
- if (count($go_discount_price1) == 0) {
- $go_discount_price = '0';
- } else {
- $go_discount_price = $go_discount_price1['data']['off_value'];
- }
- $back_tick_id = $tick_info_arr[7];
- $back_tick_price = $tick_info_arr[8];
- $back_discount_price1 = $runMain->getDiscountPrice($back_tick_id, $channel_id);
- $back_price = $orderMain->getPriceGo($back_tick_id);
- if (count($back_discount_price1) == 0) {
- $back_discount_price = '0';
- } else {
- $back_discount_price = $back_discount_price1['data']['off_value'];
- }
- if ($go_tick_price == ($go_price - $go_discount_price) && $back_tick_price == ($back_price - $back_discount_price)) {
- return true;
- }
- }
- return false;
- }
-
- }
|