TimestampBehavior::class, 'value' => time() ] ]; } public function rules() { return [ [['store_id', 'name', 'detail', 'attr'], 'required', 'on' => self::whenSave()], [['store_id', 'cat_id', 'status', 'is_delete', 'created_at', 'updated_at', 'sort', 'virtual_sales', 'is_recommend'], 'integer', 'on' => self::whenSave()], [['price', 'original_price'], 'number', 'on' => self::whenSave()], [['detail', 'attr', 'cover_pic', 'subtitle'], 'string', 'on' => self::whenSave()], [['name', 'material_id'], 'string', 'max' => 255, 'on' => self::whenSave()], [['status', 'cat_id', 'store_id'], 'integer', 'on' => self::whenList()], [['name'], 'string', 'max' => 60, 'on' => self::whenList()], ]; } public function attributeLabels() { return [ 'id' => 'ID', 'store_id' => 'Store ID', 'name' => '商品名称', 'subtitle' => '副标题', 'price' => '售价', 'original_price' => '原价(只做显示用)', 'detail' => '商品详情,图文', 'cat_id' => '商品类别', 'status' => '上架状态:0=下架,1=上架', 'is_delete' => 'Is Delete', 'attr' => '规格的库存及价格', 'sort' => '排序 升序', 'virtual_sales' => '虚拟销量', 'is_recommend' => '是否推荐', 'cover_pic' => '商品缩略图', 'material_id' => '图片物料id', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } public static function whenSave () { return 'save'; } public static function whenList () { return 'list'; } }