|
|
@@ -386,6 +386,7 @@ class OrderForm extends Model
|
|
|
$goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
|
|
|
if (!$goods) {
|
|
|
throw new Exception('商品不存在');
|
|
|
+ return;
|
|
|
}
|
|
|
if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
|
|
|
$data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
|
|
|
@@ -508,6 +509,10 @@ class OrderForm extends Model
|
|
|
foreach ($this->goodsNum as $k => $v) {
|
|
|
if ($v) {
|
|
|
$goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
|
|
|
+ if (!$goods) {
|
|
|
+ throw new Exception('商品已下架');
|
|
|
+ return;
|
|
|
+ }
|
|
|
if($goods['STORE_NUMS']>0){
|
|
|
$discount = $goods['SELL_DISCOUNT'];
|
|
|
$realPrice = $goods['SELL_PRICE'] * $discount;
|
|
|
@@ -567,6 +572,10 @@ class OrderForm extends Model
|
|
|
foreach ($this->goodsNum as $k => $v){
|
|
|
if ($v){
|
|
|
$goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
|
|
|
+ if (!$goods) {
|
|
|
+ throw new Exception('商品已下架');
|
|
|
+ return;
|
|
|
+ }
|
|
|
if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
|
|
|
$data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
|
|
|
$goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
|