|
|
@@ -69,22 +69,6 @@ class StatBookController extends BaseController
|
|
|
}
|
|
|
$where['bookSn'] = $bookSn;
|
|
|
$list = BookItemClass::getAllByCondition($where, 'addTime DESC', '*');
|
|
|
- if (!empty($list)) {
|
|
|
- $ids = array_column($list, 'itemId');
|
|
|
- $itemList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, 'id,stock', 'id', true);
|
|
|
- foreach ($list as $key => $val) {
|
|
|
- $productId = $val['itemId'] ?? 0;
|
|
|
- $product = $itemList[$productId] ?? null;
|
|
|
- if (empty($product)) {
|
|
|
- util::fail('没有花材信息,ID:' . $productId);
|
|
|
- }
|
|
|
- $stock = $product->stock;
|
|
|
- $list[$key]['stock'] = floatval($stock);
|
|
|
- $time = $val['time'];
|
|
|
- $shortTime = substr($time, 4, 4);
|
|
|
- $list[$key]['shortTime'] = $shortTime;
|
|
|
- }
|
|
|
- }
|
|
|
util::success(['list' => $list]);
|
|
|
}
|
|
|
|