|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 娄梦宁
- * PhpStorm OrdersModel.php
- * Create By 2016/11/29 9:44 $
- */
-
-
- namespace Order\Model;
-
-
- use Base\Tool\DbTable;
-
- class OrdersModel extends DbTable
- {
- public $db = 'CST';
-
- /**
- * Function Description:订单列表
- * Function Name: getList
- * @param $arr
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function getList($arr){
- $userId=$arr['userId'];
- if($arr['order_status']==0){
- $type="in(145,146,147,148)";
- }else{
- $type='='.$arr['order_status'];
- }
- $limit=$arr['limit'];
- $page=$arr['page'];
- $page=($page-1)*$limit;
- $sql=""."SELECT
- c.run_date as start_date,
- c.parent_order_id as order_id,
- c.create_time,
- c.order_status,
- c.PROD_START_STATION_res_NAME AS start_res_name,
- c.PROD_end_STATION_res_NAME AS end_res_name,
- (select FLOOR(order_price) from order_main a where a.member_id=$userId and a.order_id=c.parent_order_id and a.ORDER_PROD_TYPE != 25 ) order_price,
- c.PROD_START_STATION_TIME AS start_time,
- c.PROD_START_STATION_AREA_name AS start_area_name,
- c.PROD_end_STATION_AREA_name AS end_area_name,
- IFNULL(d.id,0) as to_from
- FROM
- order_main c
- LEFT JOIN opera_line b ON c.PARENT_PROD_ID = b.line_id
- left join to_from d on d.to_orderid=c.PARENT_ORDER_ID or d.back_orderid=c.PARENT_ORDER_ID
- WHERE
- b.cancel_flag = 0
- AND c.member_id = $userId
- AND c.ORDER_STATUS $type
- and c.order_prod_type <>369
- and c.PARENT_ORDER_ID <>0
- GROUP BY
- c.parent_order_id
- ORDER BY
- c.create_time desc
- LIMIT $page,$limit ";
- $result=$this->fetchAll($sql);
- return $result;
- }
-
- /**
- * Function Description:判断往返程,
- * Function Name: getBack
- * @param $order_id
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function getBack($order_id){
- $sql=""."select to_orderid,back_orderid from to_from where to_orderid=$order_id or back_orderid=$order_id ";
- $result=$this->fetchRow($sql);
- return $result;
- }
-
- /**
- * Function Description:获取订单详情
- * Function Name: getDetaile
- * @param $order_id
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function getDetaile($order_id){
- $sql=""."SELECT
- c.run_date as start_date,
- a.order_id,
- a.create_time,
- a.order_status,
- c.PROD_START_STATION_res_NAME AS start_res_name,
- c.PROD_end_STATION_res_NAME AS end_res_name,
- substring_index(
- substring_index(a.ORDER_DESCRIPTION, ',' ,- 1),
- '|',
- 1
- ) AS pcount,
- c.prod_name AS seat_type,
- a.customer_name,
- a.customer_mobile,
- floor(a.order_price) AS order_price,
- c.PROD_START_STATION_TIME AS start_time,
- c.PROD_end_STATION_TIME AS end_time,
- c.PROD_START_STATION_AREA_NAME AS start_area_name,
- c.PROD_END_STATION_AREA_NAME AS end_area_name,
- c.order_prod_type
- FROM
- order_main a
- LEFT JOIN order_main c ON c.PARENT_ORDER_ID = a.order_id
- LEFT JOIN opera_line b ON c.PARENT_PROD_ID = b.line_id
- WHERE
- a.cancel_flag = 0
- AND b.cancel_flag = 0
- AND a.order_id IN ($order_id)
- GROUP BY
- a.order_id
- ORDER BY
- a.order_id";
- $result=$this->fetchAll($sql);
- return $result;
- }
-
- /**
- * Function Description:客运班线获取出行人数组
- * Function Name: getCustomer
- * @param $order_id
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function getCustomer($order_id){
- $sql=''."SELECT
- customer_name,
- customer_id_no as customer_idcard
- FROM
- order_main
- WHERE
- PARENT_ORDER_ID = $order_id";
- $result=$this->fetchAll($sql);
- return $result;
- }
- }
|