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

    protected $rule = [
        'id'                => 'require|number',
        'member_miniapp_id' => 'require|number',
        'title'             => 'require',
        'bonus_types'       => 'require|number|between:0,1',
        'bonus_user_types'  => 'require|number|between:0,2',
        'share_ratio_user'  => 'require|number|between:0,200',
        'share_ratio'       => 'require|float|between:0.3,200',
        'price'             => 'require|float',
        'name'              => 'require',
        'address'           => 'require',
        'tel'               => 'require',
        'share_img'         => 'require',
        'img'               => 'require',
        'share_title'       => 'require',
        'share_text'        => 'require',
        'note'              => 'require',
        'content'           => 'require',
        'about'             => 'require',
        'pictext'           => 'require',
        'img'               => 'require',
        'imgs'              => 'require|array',
        'start_time'        => 'require|dateFormat: Y-m-d H: i: s',
        'end_time'          => 'require|dateFormat: Y-m-d H: i: s',
        'telphone'          => 'require|mobile',
        'telname'           => 'require',
        'tel'               => 'require',
        'mycode'            => 'require',
        'tips'              => 'require',
        'store_id'          => 'require|number|>:0',
    ];

    protected $message = [
        'id'                => '未找到活动内容',
        'member_miniapp_id' => '应用管理出错,请重新切换管理',
        'title.require'     => '活动名称必须填写',
        'title'             => '活动名称不能超过10个字符',
        'bonus_types'       => '随机红包必须选择',
        'bonus_user_types'  => '红包对象必须选择',
        'share_ratio'       => '普通红包必须填写0.3-200之间的数字',
        'share_ratio_user'  => '会员红包必须填写0-200之间的数字',
        'price'             => '订单金额必须填写',
        'name'              => '店铺名称必须填写',
        'address'           => '店铺地址必须填写',
        'tel'               => '联系电话必须填写',
        'share_img'         => '分享默认图片没有上传',
        'share_title'       => '分享标题必须填写',
        'share_text'        => '分享内容必须填写',
        'note'              => '活动须知必须填写',
        'content'           => '活动内容必须填写',
        'about'             => '商家介绍必须填写',
        'pictext'           => '图文展示展示必须填写',
        'img'               => '没有选择默认图片',
        'imgs'              => '活动图片必须填写',
        'start_time'        => '活动开始时间必须填写,且规则必须是 2020-01-02 00:00:00',
        'end_time'          => '活动结束时间必须填写,且规则必须是 2020-01-02 00:00:00',
        'telphone.require'  => '手机号必须填写',
        'telphone.mobile'   => '手机号输入错误',
        'tel'               => '联系电话必须填写',
        'telname'           => '姓名必须填写',
        'mycode'            => '客服二维码必须填写',
        'tips'              => '友情提示必须填写',
        'store_id'          => '好店未找到',
    ];

    protected $scene = [
        'add'   => ['telphone','mycode','tips','member_miniapp_id','bonus_types','bonus_user_types','title','share_ratio','share_ratio_user','price','share_img','share_title','share_text' ,'note','img','imgs','start_time' ,'end_time'],
        'edit'  => ['id','telphone','mycode','tips','member_miniapp_id','bonus_types','bonus_user_types','title','share_ratio','share_ratio_user','price','share_img','share_title','share_text' ,'note','img','imgs','start_time' ,'end_time'],
        'store' => ['member_miniapp_id','name','tel','end_time','content','note','about' ,'pictext','img','imgs','store_id'],
        'order' => ['id','member_miniapp_id','telphone','telname'],
        'service' => ['member_miniapp_id','name','telphone','telname'],
        'okpass' => ['id','member_miniapp_id','store_id'],  //核销
    ];
}    