<?php
namespace app\admin\validate\medical;

use think\Validate;

class MedicalCareProductValidate extends Validate
{
    protected $rule =   [
        'product_id'            => 'require',
        'product_name'          => 'require',
        'product_category_id'   => 'require',
        'product_shop_id'       => 'require',
        'product_is_show'       => 'require',
        'product_sort'          => 'require',
        'product_sales'         => 'require',
        'product_price'         => 'require',
        'product_cost'          => 'require',
        'product_ot_price'      => 'require',
        'product_stock'         => 'require',
        'product_ficti'         => 'require',
        'product_image'         => 'require',
        'product_type'          => 'require',
        'product_postage_id'          => 'require',
    ];

    protected $message  =   [
        'product_id.require'            => '产品ID不能为空',
        'product_shop_id.require'       => '店铺ID不能为空',
        'product_category_id.require'   => '产品分类编号不能为空',
        'product_name.require'          => '产品名称不能为空',
        'product_is_show.require'       => '产品状态不能为空',
        'product_sort.require'          => '产品排序不能为空',
        'product_sales.require'         => '产品销量不能为空',
        'product_cost.require'          => '成本价格不能为空',
        'product_ot_price.require'      => '产品原价不能为空',
        'product_stock.require'         => '产品总库存不能为空',
        'product_ficti.require'         => '产品虚拟销量不能为空',
        'product_image.require'         => '产品主图不能为空',
        'product_type.require'          => '产品类型不能为空',
        'product_postage_id.require'    => '运费模板不能为空1',
    ];

    //场景
    protected $scene = [
        'add'           => [
            'product_sales','product_cost','product_ot_price',
            'product_stock','product_ficti','product_image',
            'product_name','product_is_show','product_sort',
            'product_type','product_shop_id','product_category_id',
            'product_postage_id'
            ],
        'update'        => [
            'product_sales','product_cost','product_ot_price',
            'product_stock','product_ficti','product_image',
            'product_name','product_is_show','product_sort',
            'product_type','product_id','product_shop_id','product_category_id',
            'product_postage_id'
        ],
        'info'          => ['product_id'],
        'del'           => ['product_id']
    ];
}
