<?php

namespace app\admin\validate\medical;

use support\Validate;

class ShopValidate extends Validate
{
    protected $rule = [
        'shop_id' => 'require|integer',
        'shop_name|店铺名称' => 'require',
        'shop_real_name|负责人' => 'require',
        'shop_logo|LOGO' => 'url',
        'shop_img|展示图' => 'regex:/^[0-9a-zA-Z\.\/]+$/',
//        'shop_label' => '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9\_\-\,\s]+$/u',
        'shop_category_id' => 'require|integer',
        'shop_score|店铺评分' => 'require|float',
        'shop_type|店铺类型' => 'require|in:1,2,3,4,5',
        'shop_is_audit|是否需要发布审核' => 'require|in:0,1',
        'shop_lat|纬度' => 'regex:/^[0-9a-zA-Z\.]+$/',
        'shop_lng|经度' => 'regex:/^[0-9a-zA-Z\.]+$/',
        'shop_phone|电话' => 'mobile',
        'shop_sort|排序' => 'require|integer',
        'shop_status|状态' => 'require|in:0,1'
    ];

    protected $message = [];

    protected $scene = [
        'add' => ['shop_name', 'shop_real_name', 'shop_logo', 'shop_img', 'shop_label', 'shop_category_id', 'shop_score', 'shop_type',
            'shop_is_audit', 'shop_lat', 'shop_lng', 'shop_phone', 'shop_sort', 'shop_status'],
        'update' => ['shop_id', 'shop_name', 'shop_real_name', 'shop_logo', 'shop_img', 'shop_label', 'shop_category_id', 'shop_score',
            'shop_type', 'shop_is_audit', 'shop_lat', 'shop_lng', 'shop_phone', 'shop_sort', 'shop_status'],
    ];
}