| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 小夏 < 449134904@qq.com>
- // +----------------------------------------------------------------------
- namespace app\weixin\validate;
- use think\Validate;
- class AddressValidate extends Validate
- {
- protected $rule = [
- 'realname' => 'require|chsDash|length:2,6',
- 'mobile' => 'require|mobile|length:11,20',
- 'address' => 'require|length:2,150',
- 'is_default' => 'int',
- ];
- protected $message = [
- 'realname.require' => '收货人姓名不为空',
- 'realname.*' => '收货人姓名格式不正确',
- 'mobile.require' => '手机号码不为空',
- 'mobile.*' => '手机号码格式不正确',
- 'address.require' => '收货地址不为空',
- 'address.*' => '收货地址格式错误',
- ];
- /**
- * 验证字段描述
- * @var array
- */
- protected $field = [
- 'realname'=> '收货人姓名',
- 'mobile'=> '手机号码',
- 'address'=> '收货地址',
- ];
- protected $regex = [
- 'mobile'=> '/^((13[0-9])|(14[5,7])|(15[0-9])|(16[6-8])|(17[0,1,3,5-8])|(18[0-9])|(19[8,9]))\\d{8}$/',
- ];
- protected $scene = [
- 'info' => ['realname','mobile','address'],
- ];
- }
|