<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 会员卡管理
 */
namespace app\allwin\validate;
use think\Validate;

class Vipcard extends Validate{

    protected $rule = [
        'id'         => 'require|number',
        'coupon_ids' => 'array',
        'sort'       => 'require|number',
        'name'       => 'require',
        'tips'       => 'require',
        'price'      => 'require|float',
        'coupon_num' => 'require|number',
        'is_tax'     => 'require|number|between:0,1',
        'nominate'   => 'require|number|between:0,40',
    ];

    protected $message = [
        'id'         => '数据不存在',
        'coupon_ids' => '优惠券不存在',
        'sort'       => '排序序号必须填写',
        'name'       => '名称必须输入',
        'tips'       => '友情提示必须输入',
        'price'      => '价格必须输入',
        'coupon_num' => '优惠券数量输入',
        'is_tax'     => '消费奖励必须输入',
        'nominate'   => '推荐人消费奖励必须输入[0-30]',
    ];

    protected $scene = [
        'sort'   => ['id','sort'],
        'edit'   => ['name','tips','price','coupon_num','is_tax','nominate'],
        'regvip' => ['id','coupon_ids'],
    ];
}