<?php

namespace app\admin\validate\sys_manage;

use support\Validate;

class PostageTemplateValidate extends Validate
{
    protected $rule = [
        'postage_id' => 'require|integer',
        'postage_name名称' => 'require|regex:/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-\s]+$/u',
        'postage_type|类型' => 'require|in:1,2',
        'postage_first_weight|首重' => 'require|float',
        'postage_first_price|首重价格' => 'require|float',
        'postage_extend_weight|续重' => 'require|float',
        'postage_extend_price|续重价格' => 'require|float',
        'postage_status|状态' => 'in:1,2',
    ];

    protected $message = [];

    protected $scene = [
        'add' => ['postage_name', 'postage_type', 'postage_first_weight', 'postage_first_price', 'postage_extend_weight', 'postage_extend_price', 'postage_status'],
        'update' => ['postage_id', 'postage_name', 'postage_type', 'postage_first_weight', 'postage_first_price', 'postage_extend_weight', 'postage_extend_price', 'postage_status'],
    ];
}