OrderValidate.php 1.1 KB
<?php
/**
 * Created by PhpStorm.
 * User: 29925
 * Date: 2018/8/16
 * Time: 15:21
 */

namespace app\admin\validate;

use think\Validate;

class OrderValidate extends Validate
{

    protected $rule = [
        'user_id'           => 'require',
        'sort_id'           => 'require',
        'order_sn'          => 'require',
        'options'           => 'require',
        'number'            => 'require|number',
        'over_time'         => 'require',
    ];

    protected $message = [
        'user_id.require'       => '用户ID不能为空',
        'sort_id.require'       => '订单类型不能为空',
        'options.require'       => '订单内容不能为空',
        'order_sn.require'      => '订单号不能为空',
        'number.require'        => '订单确认码不能为空',
        'number.number'         => '订单确认码必须为数字',
        'over_time.require'     => '超时时间不能为空',
    ];

    protected $scene = [
        'add'  => ['user_id', 'sort_id', 'options', 'order_sn', 'number', 'over_time'],
        'edit' => ['options'],
    ];
}