|
|
@@ -15,16 +15,19 @@ class EffectiveLogic extends BaseLogic
|
|
|
{
|
|
|
$orderGoods = OrderGoods::whereIn('sn',RechargeOrder::where('work_id',$work->id)->column('sn'))->findOrEmpty();
|
|
|
$effective = EffectiveCategory::with('effectiveRule')->where('goods_category_id',$orderGoods->goods_category_id)->findOrEmpty();
|
|
|
- OrderEffectiveLog::create([
|
|
|
- 'effective_id' => $effective->effectiveRule->id,
|
|
|
- 'sn' => $orderGoods['sn'],
|
|
|
- 'user_id' => $work['user_id'],
|
|
|
- 'work_id' => $work->work_id,
|
|
|
- 'goods_id' => $orderGoods->goods_id,
|
|
|
- 'effective_unit' => $effective->effectiveRule->effective_unit,
|
|
|
- 'effective_num' => $effective->effectiveRule->effective_num,
|
|
|
- 'remark' => $effective->effectiveRule->remark,
|
|
|
- 'end_effective_time' => date("Y-m-d H:i:s",EffectiveRules::formatEndEffectiveTime(time() ,$effective->effectiveRule->effective_num,$effective->effectiveRule->effective_unit)),
|
|
|
- ]);
|
|
|
+ if(!$effective->isEmpty()){
|
|
|
+ OrderEffectiveLog::create([
|
|
|
+ 'effective_id' => $effective->effectiveRule->id,
|
|
|
+ 'sn' => $orderGoods['sn'],
|
|
|
+ 'user_id' => $work['user_id'],
|
|
|
+ 'work_id' => $work->work_id,
|
|
|
+ 'goods_id' => $orderGoods->goods_id,
|
|
|
+ 'effective_unit' => $effective->effectiveRule->effective_unit,
|
|
|
+ 'effective_num' => $effective->effectiveRule->effective_num,
|
|
|
+ 'remark' => $effective->effectiveRule->remark,
|
|
|
+ 'end_effective_time' => date("Y-m-d H:i:s",EffectiveRules::formatEndEffectiveTime(time() ,$effective->effectiveRule->effective_num,$effective->effectiveRule->effective_unit)),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|