优化采购单删除逻辑

在删除采购单时,增加了删除关联购物车信息和采购产品报价的逻辑,确保数据的一致性和完整性。
This commit is contained in:
mkm 2024-10-13 11:57:22 +08:00
parent f9a93b1e18
commit 45c32ddd40

View File

@ -9,6 +9,7 @@ use app\api\logic\order\OrderLogic;
use app\common\model\beforehand_order\BeforehandOrder;
use app\common\logic\BaseLogic;
use app\common\model\beforehand_order_cart_info\BeforehandOrderCartInfo;
use app\common\model\purchase_product_offer\PurchaseProductOffer;
use app\common\model\store_branch_product\StoreBranchProduct;
use app\common\model\store_order\StoreOrder;
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
@ -400,7 +401,12 @@ class BeforehandOrderLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
return BeforehandOrder::destroy($params['id']);
$res= BeforehandOrder::destroy($params['id']);
if($res){
BeforehandOrderCartInfo::where('bhoid',$params['id'])->update(['delete_time'=>time()]);
PurchaseProductOffer::where('order_id',$params['id'])->update(['delete_time'=>time()]);
}
return $res;
}