<?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\bestbao\validate;
use think\Validate;

class Ask extends Validate{

    protected $rule = [
        'id'      => 'require|integer',
        'is_ad'   => 'require|integer|in:0,1',
        'is_top'  => 'require|integer|in:0,1',
        'title'   => 'require',
        'content' => 'require',
        'img'     => 'require',
        'imgs'    => 'require',
        'answer'  => 'require',
        'reimg'   => 'require',
        'price'   => 'require',
        'sort'    => 'require',
    ];

    protected $message = [
        'id'      => 'ID丢失',
        'title'   => '标题必须填写',
        'content' => '内容必须填写',
        'img'     => '默认图片必须选择',
        'imgs'    => '图片必须选择',
        'answer'  => '回答内容必须填写',
        'reimg'   => '回答图片必须填写',
        'price'   => '价格必须填写',
        'is_ads'  => '是否广告必须选择',
        'sort'    => '排序必须填写',
    ];

    protected $scene = [
        'sort' => ['id','sort'],
        'add' =>  ['is_ad','is_top','title','content','price'],
        'edit' => ['id','is_ad','is_top','title','content','price'],
    ];
}