|
@@ -196,7 +196,21 @@ class ControlGoods extends Model
|
|
|
if (!$ControlGoods) {
|
|
if (!$ControlGoods) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
- $ControlGoods->delete();
|
|
|
|
|
- return true;
|
|
|
|
|
|
|
+ DB::beginTransaction();
|
|
|
|
|
+ try {
|
|
|
|
|
+ $ControlGoodsCompanyModel = new ControlGoodsCompanyModel();
|
|
|
|
|
+ $company_id_log = $ControlGoodsCompanyModel->where('control_product_logid', $ControlGoods->id)->get();
|
|
|
|
|
+ if (!empty($company_id_log)) {
|
|
|
|
|
+ $ControlGoodsCompanyModel->where('control_product_logid', $ControlGoods->id)->delete();
|
|
|
|
|
+ }
|
|
|
|
|
+ $ControlGoods->delete();
|
|
|
|
|
+ DB::commit();
|
|
|
|
|
+ return true;
|
|
|
|
|
+ // 成功处理...
|
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
|
+ DB::rollBack();
|
|
|
|
|
+ // 错误处理...
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|