feat: #10000 更新

This commit is contained in:
赵世界 2023-04-25 18:27:07 +08:00
parent 1a3bd12ee2
commit 4cb1b405f1
2 changed files with 4 additions and 1 deletions

View File

@ -90,6 +90,7 @@ class GoodsCombinationController extends Controller
$stock = $num;
}
}
$status = $stock ? (5 < $stock ? 1 : 2) : 0;
if ($id = $request->input('id')) {
$sku = GoodsSku::query()->findOrFail($id);
} else {
@ -97,6 +98,7 @@ class GoodsCombinationController extends Controller
$sku->goods_id = 0;
$sku->is_combination = 1;
}
$sku->status = $status;
$sku->title = $request->input('title');
$sku->sku_code = $request->input('external_sku_id');
$sku->external_sku_id = $request->input('external_sku_id');

View File

@ -66,9 +66,10 @@ class CombinationGoodsImport implements ToArray, SkipsEmptyRows, WithStartRow
$stock = $num;
}
}
$status = $stock ? (5 < $stock ? 1 : 2) : 0;
$sku = GoodsSku::query()->updateOrCreate(
['external_sku_id' => $info['external_sku_id'], 'is_combination' => 1],
['title' => $info['title'], 'goods_id' => 0, 'sku_code' => $info['external_sku_id'], 'stock' => $stock]
['title' => $info['title'], 'goods_id' => 0, 'sku_code' => $info['external_sku_id'], 'stock' => $stock, 'status' => $status]
);
CombinationGood::query()
->where('goods_sku_id', $sku->id)