Browse Source

接口优化

dev
nizongfeng 3 years ago
parent
commit
9d701e076c
7 changed files with 21 additions and 27 deletions
  1. +1
    -1
      application/admin/model/CfHotelInfo.php
  2. +6
    -8
      application/admin/service/OrderHotelDao.php
  3. +3
    -5
      application/admin/service/OrderItemDao.php
  4. +6
    -5
      application/admin/service/OrderMainDao.php
  5. +3
    -6
      application/admin/service/PurchaseDao.php
  6. +1
    -1
      application/admin/service/PurchasePriceDao.php
  7. +1
    -1
      application/database.php

+ 1
- 1
application/admin/model/CfHotelInfo.php View File

@@ -36,7 +36,7 @@ class CfHotelInfo extends Model
}elseif($name){
$this->where(['hotel_name'=>['like','%'.$name.'%']]);
}
return $this->select();
return $this->select()->toArray();
}




+ 6
- 8
application/admin/service/OrderHotelDao.php View File

@@ -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("",[]);
}


+ 3
- 5
application/admin/service/OrderItemDao.php View File

@@ -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);
}


+ 6
- 5
application/admin/service/OrderMainDao.php View File

@@ -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;


+ 3
- 6
application/admin/service/PurchaseDao.php View File

@@ -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);
}

+ 1
- 1
application/admin/service/PurchasePriceDao.php View File

@@ -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("", []);
}


+ 1
- 1
application/database.php View File

@@ -46,7 +46,7 @@ return [
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
'resultset_type' => 'collection',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式,默认为Y-m-d H:i:s


Loading…
Cancel
Save