shish 4 anni fa
parent
commit
cd87ae52cf
1 ha cambiato i file con 10 aggiunte e 9 eliminazioni
  1. 10 9
      biz-ghs/item/services/ItemService.php

+ 10 - 9
biz-ghs/item/services/ItemService.php

@@ -61,8 +61,8 @@ class ItemService extends BaseService
         $stockWarning = isset($data['stockWarning']) && preg_match("/^[1-9][0-9]*$/", $data['stockWarning']) ? $data['stockWarning'] : 5;
 
         //判断平台花材是否存在
-        $checkItem = PtItemClass::getById($itemId);
-        if (empty($checkItem)) {
+        $ptItem = PtItemClass::getById($itemId);
+        if (empty($ptItem)) {
             util::fail("平台花材不存在");
         }
         $existItemClass = ItemClassClass::exists(['id' => $classId, 'sjId' => $sjId]);
@@ -72,13 +72,14 @@ class ItemService extends BaseService
 
         //补全花材信息
         $data['name'] = $name;
-        $data['alias'] = $checkItem['alias'];
-        $data['py'] = $checkItem['py'];
-        $data['cover'] = $checkItem['cover'];
-        $data['ratio'] = $checkItem['ratio'];
-        $data['weight'] = $checkItem['weight'];
-        $data['bigUnit'] = $checkItem['bigUnit'];
-        $data['smallUnit'] = $checkItem['smallUnit'];
+        $data['alias'] = $ptItem['alias'];
+        $data['py'] = $ptItem['py'];
+        $data['cover'] = $ptItem['cover'];
+        $data['ratio'] = $ptItem['ratio'];
+        $data['weight'] = $ptItem['weight'];
+        $data['bigUnit'] = $ptItem['bigUnit'];
+        $data['smallUnit'] = $ptItem['smallUnit'];
+        $data['variety'] = $ptItem['variety'] ?? 0;
         $data['stockWarning'] = $stockWarning;
 
         //写入一条item,同时写入一条itemInfo(初始化库存)