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

    protected $rule = [
        'id'                => 'require|integer',
        'member_miniapp_id' => 'require|integer',
        'manage_uid'        => 'require|integer|>:0',
        'charge'            => 'require|integer|>=:3',
        'cate_id'           => 'require|integer',
        'cate_sid'          => 'require|integer',
        'sort'              => 'require|integer',
        'name'              => 'require',
        'title'             => 'require',
        'address'           => 'require',
        'longitude'         => 'require',
        'latitude'          => 'require',
        'telphone'          => 'require',
        'img'               => 'require',
        'imgs'              => 'require|array',
        'mch_id'            => 'integer|length:10',
        'citycode'          => 'integer|length:6',
        'citypath'          => 'require',
        'tags'              => 'require',
    ];
    
    protected $message = [
        'id'                => '编辑ID',
        'member_miniapp_id' => '当前应用APP_ID',
        'manage_uid'        => '好店店长必须填写',
        'charge'            => '让利比例必须填写切大于3%',
        'sort'              => '必须输入整数',
        'cate_id'           => '行业分类必须选择',
        'cate_sid'          => '二级分类必须选择',
        'name'              => '好店名称必须填写',
        'title'             => '分店名称必须填写',
        'address'           => '地址必须填写',
        'longitude'         => '位置经度必须填写',
        'latitude'          => '位置纬度必须填写',
        'telphone'          => '联系电话必须填写',
        'img'               => '默认图片必须填写',
        'imgs'              => '展示图片必须上传',
        'mch_id'            => '微信商户号填写错误',
        'citycode'          => '6位城市行政编码必须填写',
        'tags'              => '推荐关键词必须填写',
        'citypath'          => '所在城市必须选项',
    ];

    protected $scene = [
        'edit'    => ['member_miniapp_id','citycode','manage_uid', 'cate_id', 'cate_sid', 'name', 'address', 'longitude', 'latitude', 'telphone','tags','img', 'imgs','mch_id'],
        'chain'   => ['title', 'address','telphone','longitude','latitude'],
        'reg'     => ['citypath','name', 'address','telphone','longitude','latitude','charge'],
        'gmedit'  => ['name', 'address','telphone','longitude','latitude','mch_id'],
    ];
}