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

class Info extends Validate{

    protected $rule = [
        //前台发布
        'content'           => 'require',
        'telphone'          => 'mobile',
        'task_money'        => 'number',
        'member_miniapp_id' => 'require|number',
        'uid'               => 'require|number',
        'cate_id'           => 'require|number',
        'info_id'           => 'require|number',
        //认证
        'logo'              => 'require',
        'uid'               => 'require|number',
        'title'             => 'require',
        'note'              => 'require|max:70',
        'is_vip'            => 'require|number|between: 0,1',
        'vip_title'         => 'require|max:20',
        'vip_about'         => 'require|max:120',
        'vip_time'          => 'require|date',
        //模板设置
        'id'                => 'require|number',
        'name'              => 'require',
        'titles'            => 'array',
        'values'            => 'array',
        'types'             => 'array',

    ];
    protected $message = [
        //前台发布
        'content'           => '信息内容必须填写',
        'telphone'          => '手机号格式不正确',
        'task_money'        => '福利金只能填写数字',
        'member_miniapp_id' => '应用ID失败,建议关闭小程序重新打开',
        'uid'               => '用户不存在,请重新登录小程序',
        'cate_id'           => '请选择发布栏目',
        'info_id'           => '发布主题不存在',
        //认证
        'logo'              => '城市号头像必须填写',
        'uid'               => '用户不存在',
        'title'             => '城市号名称必须填写',
        'note'              => '城市号必须简介',
        'is_vip'            => '必须选择认证号',
        'vip_title'         => '认证主体必须填写',
        'vip_about'         => '认证主体简介必须填写',
        //模板设置
        'id'                => '资源丢失',
        'name'              => '模板名称必须填写',
        'titles'            => '表单值设置不正确1',
        'values'            => '表单值设置不正确2',
        'types'             => '表单值设置不正确3',
    ];

    protected $scene = [
        'sendInfo'  => ['cate_id','content','telphone','member_miniapp_id','uid'],
        'sendReply' => ['uid','content','member_miniapp_id'],
        'mpEdit'    => ['logo','uid','title','note','is_vip'],
        'mpVip'     => ['logo','uid','title','note','is_vip','vip_title','vip_about','vip_time'],
        'tpl'       => ['id','name','titles','values','types'],
    ];
}