|
|
@@ -16,12 +16,6 @@ class AddForm extends BaseForm
|
|
|
*/
|
|
|
public $name;
|
|
|
|
|
|
- /**
|
|
|
- * 商品分类ID
|
|
|
- * @var int
|
|
|
- */
|
|
|
- public $catId;
|
|
|
-
|
|
|
/**
|
|
|
* 商品单价
|
|
|
* @var float
|
|
|
@@ -40,18 +34,6 @@ class AddForm extends BaseForm
|
|
|
*/
|
|
|
public $sold;
|
|
|
|
|
|
- /**
|
|
|
- * 商品种类ID
|
|
|
- * @var int
|
|
|
- */
|
|
|
- public $kindId;
|
|
|
-
|
|
|
- /**
|
|
|
- * 商品种类名称
|
|
|
- * @var string
|
|
|
- */
|
|
|
- public $kindName;
|
|
|
-
|
|
|
/**
|
|
|
* 花朵数量
|
|
|
* @var int
|
|
|
@@ -76,18 +58,43 @@ class AddForm extends BaseForm
|
|
|
*/
|
|
|
public $stock;
|
|
|
|
|
|
- /**
|
|
|
- * 商品SPU编码
|
|
|
- * @var string
|
|
|
- */
|
|
|
- public $spu;
|
|
|
-
|
|
|
/**
|
|
|
* 商品分类ID
|
|
|
* @var array
|
|
|
*/
|
|
|
public $catIds;
|
|
|
|
|
|
+ /**
|
|
|
+ * 库存状态
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ public $stockSet;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品状态
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ public $status;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否需要发货
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ public $needSend;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 运费类型
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ public $freightType;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 自动涨价
|
|
|
+ * @var int
|
|
|
+ */
|
|
|
+ public $autoRise;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* {@inheritdoc}
|
|
|
*/
|
|
|
@@ -105,12 +112,17 @@ class AddForm extends BaseForm
|
|
|
['catIds', 'default', 'value' => []],
|
|
|
|
|
|
// 数据类型验证
|
|
|
- [['name', 'kindName', 'cover', 'spu'], 'string'],
|
|
|
- [['catId', 'kindId', 'flowerNum', 'stock'], 'integer'],
|
|
|
+ [['name', 'cover'], 'string'],
|
|
|
+ [['flowerNum', 'stock'], 'integer'],
|
|
|
['priceType', 'in', 'range' => [0, 1]],
|
|
|
- [['price'], 'number', 'min' => 0, 'message' => '商品价格必须大于或等于0'],
|
|
|
+ ['price', 'number', 'min' => 0, 'message' => '商品价格必须大于或等于0'],
|
|
|
['flowerNum', 'number', 'min' => 0, 'message' => '花朵数量必须大于或等于0'],
|
|
|
['sold', 'integer', 'min' => 0, 'message' => '已售数量必须大于或等于0'],
|
|
|
+ [['stockSet'], 'in', 'range' => [0, 1]],
|
|
|
+ [['needSend'], 'in', 'range' => [0, 1]],
|
|
|
+ [['freightType'], 'in', 'range' => [0, 1]],
|
|
|
+ [['status'], 'in', 'range' => [0, 1]],
|
|
|
+ [['autoRise'], 'in', 'range' => [0, 1]],
|
|
|
|
|
|
// 添加条件验证
|
|
|
// ['price', 'required', 'message' => '请填写商品价格', 'when' => function($model) {
|
|
|
@@ -146,7 +158,6 @@ class AddForm extends BaseForm
|
|
|
{
|
|
|
return [
|
|
|
'name' => '商品名称',
|
|
|
- 'catId' => '商品分类',
|
|
|
'price' => '商品价格',
|
|
|
//'num' => '商品数量',
|
|
|
'kindId' => '商品种类ID',
|
|
|
@@ -156,6 +167,7 @@ class AddForm extends BaseForm
|
|
|
'cover' => '商品封面图',
|
|
|
'stock' => '商品库存',
|
|
|
'spu' => '商品编码',
|
|
|
+ 'autoRise' => '自动涨价',
|
|
|
];
|
|
|
}
|
|
|
}
|