/** * 订票统计 * @param $stationid * @return $data */ public function orderCount($page, $pagesize, $condition) { $db = new Psys_StationRule(); switch ($condition['order_state']) { case '1': $condition['order_state'] = 'timeout'; break; case '2': $condition['order_state'] = 'wait'; break; case '3': $condition['order_state'] = 'pay'; break; case '4': $condition['order_state'] = 'returned'; break; case '5': $condition['order_state'] = 'success'; break; } $data = $db->OrderInfo($page, $pagesize, $condition); foreach ($data as &$v1) { $v1['detail'] = json_decode($v1['detail'], true); } foreach ($data as &$v1) { switch ($v1['state']) { case 'timeout': $v1['state'] = '超时未付'; break; case 'wait': $v1['state'] = '待支付'; break; case 'pay': $v1['state'] = '已支付'; break; case 'returned': $v1['state'] = '已退款'; break; case 'success': $v1['state'] = '已成交'; break; case 'finish': $v1['state'] = '已成交'; break; } } foreach ($data as $k1 => &$v1) { $v1['from'] = $v1['detail']['from_station_name']; $v1['to'] = $v1['detail']['to_station_name']; $v1['train_number'] = $v1['detail']['train_number']; $v1['seat_name'] = $v1['detail']['seat_name']; $v1['ticket_count'] = $v1['detail']['ticket_count']; unset($v1['detail']); } return $data; }