coupon-admin/app/validate/BusinessValidate.php

52 lines
2.1 KiB
PHP

<?php
namespace app\validate;
use think\Validate;
class BusinessValidate extends Validate
{
protected $rule = [
'type' => 'require|gt:0',
'business_name|商家名称' => 'require|length:3,32',
'business_subtitle|商家简称' => 'require|length:3,32',
'business_license|营业执照' => 'require|length:3,150',
'contact_name|联系人' => 'require|length:1,32',
'contact_phone|联系电话' => 'require|mobile',
'lat' => 'require|between:-90,90',
'lng' => 'require|between:-180,180',
'province|所属省份' => 'require',
'city|所属城市' => 'require',
'county|所属区县' => 'require',
'business_address|商家地址' => 'require|length:1,250',
//'characteristic|商家特色' => 'length:0,250',
'background|商家背景图' => 'require|length:0,250',
'business_circle_id|所属商圈' => 'egt:0',
];
protected $message = [
'type.require' => '请选择商家分类!',
'type.gt' => '请选择商家分类!',
'business_name' => '商家名称只能是3-32个汉字',
'business_subtitle' => '商家简称称只能是3-32个汉字',
'lat.require' => '地址定位信息错误,请重新定位!',
'lat.between' => '地址定位信息错误,请重新定位!',
'lng.require' => '地址定位信息错误,请重新定位!',
'lng.between' => '地址定位信息错误,请重新定位!',
'business_circle_id.egt' => '请选择所属商圈!',
];
protected $scene = [
// 认证商家
'apiRegister' => ['type', 'business_name', 'business_subtitle', 'business_license', 'contact_name', 'contact_phone',
'lat', 'lng', 'province', 'city', 'county', 'business_address', 'business_circle_id'],
// 商家编辑可编辑资料(基本信息修改需要审核通过后才能变更)
'apiEdit' => ['lat', 'lng', 'province', 'city', 'county', 'business_address', 'characteristic', 'background', 'business_circle_id'],
];
}