stocks -= $quantity; // 售罄 if ($good->stocks == 0) { $good->status = ScoreGoodStatus::SELL_OUT; } return $good->save(); }); } }