From 9d701e076c0e57db62a94273e2cd3ecaf6d07d33 Mon Sep 17 00:00:00 2001 From: nizongfeng Date: Mon, 1 Nov 2021 14:17:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/model/CfHotelInfo.php | 2 +- application/admin/service/OrderHotelDao.php | 14 ++++++-------- application/admin/service/OrderItemDao.php | 8 +++----- application/admin/service/OrderMainDao.php | 11 ++++++----- application/admin/service/PurchaseDao.php | 9 +++------ application/admin/service/PurchasePriceDao.php | 2 +- application/database.php | 2 +- 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/application/admin/model/CfHotelInfo.php b/application/admin/model/CfHotelInfo.php index 4608e2f..8b2e501 100755 --- a/application/admin/model/CfHotelInfo.php +++ b/application/admin/model/CfHotelInfo.php @@ -36,7 +36,7 @@ class CfHotelInfo extends Model }elseif($name){ $this->where(['hotel_name'=>['like','%'.$name.'%']]); } - return $this->select(); + return $this->select()->toArray(); } diff --git a/application/admin/service/OrderHotelDao.php b/application/admin/service/OrderHotelDao.php index 2d30767..6f1fb59 100644 --- a/application/admin/service/OrderHotelDao.php +++ b/application/admin/service/OrderHotelDao.php @@ -66,8 +66,6 @@ class OrderHotelDao "customer_name" => $param['customer_name'], "customer_comments" => empty($param['customer_comments'])?"":$param['customer_comments'], "trade_order_number" => $param['trade_order_number'], - "res_person" => $param['res_person'], - "res_person_id" => empty($param['res_person_id'])?0:$param['res_person_id'], "del_flag"=>0 ]; $orderHotelModel = new OrderHotel(); @@ -93,7 +91,7 @@ class OrderHotelDao { try { $model = new CfHotelInfo(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取酒店信息失败:" . $id); } @@ -112,7 +110,7 @@ class OrderHotelDao { try { $model = new CfRoomInfo(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取房型信息失败:" . $id); } @@ -131,7 +129,7 @@ class OrderHotelDao { try { $model = new CfRoomPlan(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取价格方案信息失败:" . $id); } @@ -149,7 +147,7 @@ class OrderHotelDao public function setSubOrderAmount( int $subOrderId) { try{ $purchaseModel = new Purchase(); - $purchaseList = $purchaseModel->where(["order_detail_id"=>$subOrderId,"del_flag"=>0])->select(); + $purchaseList = $purchaseModel->where(["order_detail_id"=>$subOrderId,"del_flag"=>0])->select()->toArray(); $cost = 0; $amount = 0; $count = 0; @@ -175,7 +173,7 @@ class OrderHotelDao public function getInfoById($id) { try { $model = new OrderHotel(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取子订单信息失败:" . $id); } @@ -211,7 +209,7 @@ class OrderHotelDao public function getListByOrderId($orderId){ $subOrderModel = new OrderHotel(); try { - $subOrderList = $subOrderModel->where(["order_id" => $orderId, "del_flag" => 0])->select(); + $subOrderList = $subOrderModel->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); if (null == $subOrderList) { return Util::returnArrSu("",[]); } diff --git a/application/admin/service/OrderItemDao.php b/application/admin/service/OrderItemDao.php index dfbebb0..707b5bc 100644 --- a/application/admin/service/OrderItemDao.php +++ b/application/admin/service/OrderItemDao.php @@ -51,10 +51,8 @@ class OrderItemDao "confirm_status" => $param['confirm_status'], "confirm_no" => $param['confirm_no'], "customer_name" => $param['customer_name'], - "customer_comments" => $param['customer_comments'], + "customer_comments" => empty($param['customer_comments'])?"":$param['customer_comments'], "trade_order_number" => $param['trade_order_number'], - "res_person" => $param['res_person'], - "res_person_id" => $param['res_person_id'], "del_flag"=>0 ]; $orderHotelModel = new OrderHotel(); @@ -80,7 +78,7 @@ class OrderItemDao { try { $model = new CfItem(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取附加项目信息失败:" . $id); } @@ -125,7 +123,7 @@ class OrderItemDao public function getInfoById($id) { try { $model = new OrderItem(); - $result = $model->where(["id" => $id])->find(); + $result = $model->where(["id" => $id])->find()->toArray(); if ($result == null) { return Util::returnArrEr("获取子订单信息失败:" . $id); } diff --git a/application/admin/service/OrderMainDao.php b/application/admin/service/OrderMainDao.php index fed82f2..da6d9b9 100644 --- a/application/admin/service/OrderMainDao.php +++ b/application/admin/service/OrderMainDao.php @@ -58,8 +58,8 @@ class OrderMainDao try { $itemModel = new OrderItem(); $hotelModel = new OrderHotel(); - $itemList = $itemModel->where(["order_id" => $orderId])->select(); - $hotelList = $hotelModel->where(["order_id" => $orderId])->select(); + $itemList = $itemModel->where(["order_id" => $orderId])->select()->toArray(); + $hotelList = $hotelModel->where(["order_id" => $orderId])->select()->toArray(); $amount = 0; $cost = 0; foreach ($itemList as $item) { @@ -87,7 +87,7 @@ class OrderMainDao public function getInfoById($id) { try { $orderMainModel = new OrderMain(); - $orderMain = $orderMainModel->where(["id" => $id])->find(); + $orderMain = $orderMainModel->where(["id" => $id])->find()->toArray(); if (null == $orderMain) { return Util::returnArrEr("订单查询失败:".$id); } @@ -106,11 +106,12 @@ class OrderMainDao */ public function setSubOrderShow($purchaseShow,$orderHotel,$orderItem){ $result = []; + foreach ($orderItem as $item) { $item['prod_type'] = 'item'; foreach ($purchaseShow as $key=> $purchase) { if ($item['id'] == $key) { - array_merge($item,$purchase); + $item = array_merge($item,$purchase); } } $result[] = $item; @@ -119,7 +120,7 @@ class OrderMainDao $hotel['prod_type'] = 'hotel'; foreach ($purchaseShow as $key=> $purchase) { if ($hotel['id'] == $key) { - array_merge($hotel,$purchase); + $hotel = array_merge($hotel,$purchase); } } $result[] = $hotel; diff --git a/application/admin/service/PurchaseDao.php b/application/admin/service/PurchaseDao.php index 28d881c..91d6e4c 100644 --- a/application/admin/service/PurchaseDao.php +++ b/application/admin/service/PurchaseDao.php @@ -99,7 +99,7 @@ class PurchaseDao public function setPurchaseAmount(int $purchaseId){ try{ $purchasePrice = new PurchasePrice(); - $purchasePriceList = $purchasePrice->where(["purchase_id"=>$purchaseId,"del_flag"=>0])->select(); + $purchasePriceList = $purchasePrice->where(["purchase_id"=>$purchaseId,"del_flag"=>0])->select()->toArray(); $cost = 0; $amount = 0; $cnt = 0; @@ -143,7 +143,7 @@ class PurchaseDao public function getListByOrderId($orderId) { $model = new Purchase(); try { - $list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select(); + $list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); if (null == $list) { return Util::returnArrSu("",[]); } @@ -182,10 +182,7 @@ class PurchaseDao $purchaseShow["purchasePriceList"][]=$priceShow; } } - if (null == $result[$purchase['order_detail_id']]) { - $result[$purchase['order_detail_id']] = []; - } - $result[$purchase['order_detail_id']][]= $purchaseShow; + $result[$purchase['order_detail_id']]= $purchaseShow; } return Util::returnArrSu("", $result); } diff --git a/application/admin/service/PurchasePriceDao.php b/application/admin/service/PurchasePriceDao.php index 96c1a05..1a180a1 100644 --- a/application/admin/service/PurchasePriceDao.php +++ b/application/admin/service/PurchasePriceDao.php @@ -83,7 +83,7 @@ class PurchasePriceDao public function getPurchasePriceListByOrderId($orderId) { $model = new PurchasePrice(); try { - $list = $model->where(["order_id" => $orderId, "del_flag" => $orderId])->select(); + $list = $model->where(["order_id" => $orderId, "del_flag" => 0])->select()->toArray(); if (null == $list) { return Util::returnArrSu("", []); } diff --git a/application/database.php b/application/database.php index 8ae62dd..3b082ba 100755 --- a/application/database.php +++ b/application/database.php @@ -46,7 +46,7 @@ return [ // 是否严格检查字段是否存在 'fields_strict' => true, // 数据集返回类型 - 'resultset_type' => 'array', + 'resultset_type' => 'collection', // 自动写入时间戳字段 'auto_timestamp' => false, // 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s