|
|
@@ -461,6 +461,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('Products does not exists!');
|
|
|
+ }
|
|
|
if($goods['STORE_NUMS']>0){
|
|
|
if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
|
|
|
$discount = $goodsType[$goods['TYPE']]['discount'];
|
|
|
@@ -560,6 +563,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('Products does not exists!');
|
|
|
+ }
|
|
|
if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
|
|
|
$data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
|
|
|
$goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
|
|
|
@@ -793,6 +799,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('Products does not exists!');
|
|
|
+ }
|
|
|
if($goods['STORE_NUMS']>0){
|
|
|
if ($goods['TYPE'] == 1 || $goods['TYPE'] == 2) {
|
|
|
$discount = $goodsType[$goods['TYPE']]['discount'];
|
|
|
@@ -862,6 +871,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('Products does not exists!');
|
|
|
+ }
|
|
|
if ($goods['STORE_NUMS'] >= $this->goodsNum[$k]){
|
|
|
$data = ShopGoods::find()->where(['ID' => $ids[$k]])->one();
|
|
|
$goods_store_nums = $data->STORE_NUMS - $this->goodsNum[$k];
|