|
|
@@ -76,6 +76,24 @@ class XjController extends BaseController
|
|
|
if ($product->mainId != $this->mainId) {
|
|
|
util::fail('不是您的花材');
|
|
|
}
|
|
|
+ $data = $post['data'] ?? '';
|
|
|
+ $arr = json_decode($data, true);
|
|
|
+ if (empty($arr)) {
|
|
|
+ util::fail('没有找到花材列表');
|
|
|
+ }
|
|
|
+ foreach ($arr as $item) {
|
|
|
+ $id = $item['id'] ?? 0;
|
|
|
+ $stock = $item['stock'] ?? -1;
|
|
|
+ $xj = XjClass::getById($id, true);
|
|
|
+ if (empty($xj)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if ($xj->itemId != $itemId) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $xj->stock = $stock;
|
|
|
+ $xj->save();
|
|
|
+ }
|
|
|
util::complete();
|
|
|
}
|
|
|
|