Browse Source

删除子订单

dev
nizongfeng 3 years ago
parent
commit
3483af13d6
4 changed files with 48 additions and 0 deletions
  1. +11
    -0
      application/admin/controller/OrderMain.php
  2. +9
    -0
      application/admin/service/OrderHotelDao.php
  3. +9
    -0
      application/admin/service/OrderItemDao.php
  4. +19
    -0
      application/admin/service/OrderMainService.php

+ 11
- 0
application/admin/controller/OrderMain.php View File

@@ -256,6 +256,17 @@ class OrderMain extends Backend
return json($result);
}

/**
* 删除子订单
* @return \think\response\Json
*/
public function delSubOrder(){
$params=$this->request->post();
$orderMainService = new OrderMainService();
$result = $orderMainService->delSubOrder($params);
return json($result);
}

public function newAdd(){
$params=$this->request->post();
$hotelMain = $params["orderMain"];


+ 9
- 0
application/admin/service/OrderHotelDao.php View File

@@ -190,4 +190,13 @@ class OrderHotelDao
$model = new OrderHotel();
$model->save(["del_flag"=>1],["order_id"=>$order_id]);
}

/**
* 删除记录
* @param $id
*/
public function delById($id) {
$model = new OrderHotel();
$model->save(["del_flag"=>1],["id"=>$id]);
}
}

+ 9
- 0
application/admin/service/OrderItemDao.php View File

@@ -144,4 +144,13 @@ class OrderItemDao
$model->save(["del_flag"=>1],["order_id"=>$order_id]);
}

/**
* 删除记录
* @param $id
*/
public function delById($id) {
$model = new OrderItem();
$model->save(["del_flag"=>1],["id"=>$id]);
}

}

+ 19
- 0
application/admin/service/OrderMainService.php View File

@@ -182,4 +182,23 @@ class OrderMainService
}
return Util::returnArrSu($subOrderId);
}

/**
* 删除子订单
* @param $param
* @return array
*/
public function delSubOrder($param){
try {
if ($param['prodType'] == 'hotel') {
$subOrderDao = new OrderHotelDao();
} else {
$subOrderDao = new OrderItemDao();
}
$subOrderDao->delById($param['id']);
return Util::returnArrSu();
}catch (Exception $e){
return Util::returnArrEr("删除子订单失败".$e->getMessage());
}
}
}

Loading…
Cancel
Save