|
|
@@ -313,6 +313,9 @@ 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('商品不存在');
|
|
|
+ }
|
|
|
if($goods['STORE_NUMS']>0){
|
|
|
$discount = $goods['SELL_DISCOUNT'];
|
|
|
$realPrice = $goods['SELL_PRICE'] * $discount;
|
|
|
@@ -381,6 +384,9 @@ 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('商品不存在');
|
|
|
+ }
|
|
|
if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
|
|
|
$data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
|
|
|
$goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
|