checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); $order_common_model = new JielongOrderCommon(); $condition = array ( [ "member_id", "=", $this->member_id ], [ "site_id", "=", $this->site_id ] ); $order_status = isset($this->params[ 'order_status' ]) ? $this->params[ 'order_status' ] : ''; switch ( $order_status ) { case "0"://待付款 $condition[] = [ "order_status", "=", 0 ]; break; case "1"://已完成 $condition[] = [ "order_status", "=", 1 ]; break; case "-1"://已关闭 $condition[] = [ "order_status", "=", -1 ]; break; } $page_index = isset($this->params[ 'page' ]) ? $this->params[ 'page' ] : 1; $page_size = isset($this->params[ 'page_size' ]) ? $this->params[ 'page_size' ] : PAGE_LIST_ROWS; $res = $order_common_model->getMemberOrderPageList($condition, $page_index, $page_size, "create_time desc"); return $this->response($res); } /** * 订单详情 */ public function detail() { $token = $this->checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); $order_common_model = new JielongOrderCommon(); $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0; $result = $order_common_model->getMemberOrderDetail($id, $this->member_id, $this->site_id); return $this->response($result); } /** * 关闭订单 */ public function close() { $token = $this->checkToken(); if ($token[ 'code' ] < 0) return $this->response($token); $id = isset($this->params[ 'id' ]) ? $this->params[ 'id' ] : 0; if (empty($id)) { return $this->response($this->error('', 'REQUEST_JIELONG_ID')); } $order_model = new OrderModel(); $log_data = [ 'uid' => $this->member_id, 'action_way' => 1 ]; $order_common_model = new JielongOrderCommon(); $order_id = $order_common_model->getJielongOrderId($id); $result = $order_model->orderClose($order_id, $log_data); return $this->response($result); } }