|
@@ -29,20 +29,24 @@ class TzProduct extends Base
|
|
|
public static function onAfterInsert(Model $model): void
|
|
|
{
|
|
|
if($model['type']==2){
|
|
|
- $adjust=$model->Adjust;
|
|
|
- ProductStock::OutStock($model['product_id'],$model['num']);
|
|
|
- $log = [
|
|
|
- "type" => 1,
|
|
|
- 'order_item_id' => $adjust->manager_id,
|
|
|
- 'product_id' => $model['product_id'],
|
|
|
- 'num' => $model['num'],
|
|
|
- "fz_date" => $adjust->Manager->fz_date,
|
|
|
- 'unit_price' =>$model['unit_price'],
|
|
|
- 'rate' => $model->Product->cat_tax,
|
|
|
- 'apply_id' => $model->checkUid,
|
|
|
- 'apply_name' => $model->checkUname,
|
|
|
- ];
|
|
|
- (new ProductOnlog)->save($log);
|
|
|
+ try{
|
|
|
+ $adjust=$model->Adjust;
|
|
|
+ ProductStock::OutStock($model['product_id'],$model['num']);
|
|
|
+ $log = [
|
|
|
+ "type" => 1,
|
|
|
+ 'order_item_id' => $adjust->manager_id,
|
|
|
+ 'product_id' => $model['product_id'],
|
|
|
+ 'num' => $model['num'],
|
|
|
+ "fz_date" => $adjust->Manager->fz_date,
|
|
|
+ 'unit_price' =>$model['unit_price'],
|
|
|
+ 'rate' => $model->Product->cat_tax,
|
|
|
+ 'apply_id' => $model->checkUid,
|
|
|
+ 'apply_name' => $model->checkUname,
|
|
|
+ ];
|
|
|
+ (new ProductOnlog)->save($log);
|
|
|
+ }catch (\Exception $e){
|
|
|
+ throw new \Exception($e->getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|