<?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 Info extends Validate{

    protected $rule = [
        //前台发布
        'content'           => 'require',
        'telphone'          => 'mobile',
        'task_money'        => 'number',
        'member_miniapp_id' => 'require|number',
        'user_id'           => 'require|number',
        'cate_id'           => 'require|number',
        'info_id'           => 'require|number',
        //配置
        'today'             => 'require|array',
        'charge'            => 'require|number|between:0,20',
        'bring'             => 'require|number|between:0,50',
        'reward'            => 'require|number|between:0,50',
        //认证
        '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',

    ];
    protected $message = [
        //前台发布
        'content'           => '信息内容必须填写',
        'telphone'          => '手机号格式不正确',
        'task_money'        => '福利金只能填写数字',
        'member_miniapp_id' => '应用ID失败,建议关闭小程序重新打开',
        'user_id'           => '用户不存在,请重新登录小程序',
        'cate_id'           => '请选择发布栏目',
        'info_id'           => '发布主题不存在',
        //配置
        'today'             => '置顶信息必须设置',
        'charge'            => '推广手续费必须填写（0-20之间）',
        'bring'             => '老带新必须填写（0-50之间）',
        'reward'            => '新带新必须填写（0-50之间）',
        //认证
        'logo'               => '城市号头像必须填写',
        'uid'                => '用户不存在',
        'title'              => '城市号名称必须填写',
        'note'               => '城市号必须简介',
        'is_vip'             => '必须选择认证号',
        'vip_title'          => '认证主体必须填写',
        'vip_about'          => '认证主体简介必须填写',
    ];

    protected $scene = [
        'sendInfo'  => ['cate_id','content','telphone','member_miniapp_id','user_id'],
        'sendReply' => ['user_id','content','member_miniapp_id'],
        'config'    => ['today','charge','bring','reward'],
        'mpEdit'    => ['logo','uid','title','note','is_vip'],
        'mpVip'     => ['logo','uid','title','note','is_vip','vip_title','vip_about','vip_time'],
    ];
}