$val) { $itemInfo = $val->itemInfo ?? ''; if (empty($itemInfo)) { continue; } $arr = json_decode($itemInfo, true); $name = $arr['itemName'] ?? ''; $cover = $arr['itemCover'] ?? ''; $num = $val->itemNum ?? 0; $bigPrice = $val->bigPrice ?? 0; $totalPrice = bcmul($bigPrice, $num, 2); $val->name = $name; $val->cover = $cover; $val->totalPrice = $totalPrice; $val->save(); echo "id:" . $val->id . "\n"; } } } public function actionTz() { $shop = ShopClass::getById(36523, true); $ids = [25836, 25841]; $productList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', null, true); if (!empty($productList)) { WxMessageClass::stockWarningInform($shop, $productList); } } public function actionXj() { $list = XjClass::getAllByCondition(['id>' => 0], null, '*', null, true); if (!empty($list)) { foreach ($list as $item) { $ptItemId = $item->ptItemId ?? 0; $mainId = $item->mainId ?? 0; $has = ItemClass::getByCondition(['mainId' => $mainId, 'itemId' => $ptItemId], true); if (!empty($has)) { $productId = $has->id ?? 0; $item->itemId = $productId; $item->save(); } } } } }