Parcourir la source

feat: NG-15: 新会员注册时增加国家与语言选项.

kevin il y a 1 an
Parent
commit
2f63abc742

+ 2 - 0
common/messages/en-US/ctx.php

@@ -328,6 +328,8 @@ return [
     'orderNotExist' => 'order does not exist',
     'orderHasBeenConnected' => 'The order has been connected to the net, and this period cannot be adjusted',
     'invalidPcNo' => 'Invalid Pc No.',
+    'sellPriceStandardMustGreaterThanZero' => 'Standard price must be greater than 0',
+    'pvMustGreaterThanZero' => 'BV must be greater than 0',
 
     #Log
     'adminUserDoesNotExist'  => 'Administrator does not exist',

+ 2 - 0
common/messages/zh-CN/ctx.php

@@ -328,6 +328,8 @@ return [
     'totalTax' => '数额总计',
     'totalAmount' => '总金额',
     'signature' => '签名',
+    'sellPriceStandardMustGreaterThanZero' => '标准价格必须大于0',
+    'pvMustGreaterThanZero' => 'pv必须大于0',
 
     #Log
     'adminUserDoesNotExist'  => '管理员不存在',

+ 12 - 0
common/models/forms/ShopGoodsForm.php

@@ -62,6 +62,7 @@ class ShopGoodsForm extends Model
             [['selectedIds'], 'isSelected'],
             [['sort'], 'isSort'],
             [['sellDiscount'], 'isDiscount'],
+            [['pricePv', 'sellPriceStandard'], 'isPrice'],
         ];
     }
 
@@ -173,6 +174,17 @@ class ShopGoodsForm extends Model
         }
     }
 
+    public function isPrice($attributes)
+    {
+        if ($this->pricePv <= 0) {
+            $this->addError($attributes, \Yii::t('ctx', 'pvMustGreaterThanZero'));
+        }
+
+        if ($this->sellPriceStandard <= 0) {
+            $this->addError($attributes, \Yii::t('ctx', 'sellPriceStandardMustGreaterThanZero'));
+        }
+    }
+
     /**
      * 添加
      * @return ShopGoods|null