|
|
@@ -201,6 +201,10 @@ class ApproachOrderForm extends Model
|
|
|
|
|
|
// 一个订单只能包含一类商品
|
|
|
$goods = ShopGoods::find()->select('ID,CATEGORY_TYPE')->where(['in', 'ID', $this->goodsId])->andWhere(['STATUS' => 1])->asArray()->all();
|
|
|
+ if (!$goods) {
|
|
|
+ $this->addError($attribute, 'Products does not exists!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
$goodsCategoryType = array_unique(array_column($goods, 'CATEGORY_TYPE'));
|
|
|
if (count($goodsCategoryType) != 1) {
|
|
|
$this->addError($attribute, 'Order cannot contain multiple product categories');//订单不能包含多种商品分类
|