bourse stock
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
6.5 KiB

<?php
namespace app\home\validate;
class UserValidate extends BaseHomeValidate
{
protected $rule = [
'country_id' => 'require|isString',
'file_id' => 'require|integer',
'day' => 'require|integer',
'num' => 'require|integer',
'email_code' => 'require|isString',
'sms_code' => 'require|isString',
'email_type' => 'require|in:1,2', // 1 给已经绑定的号发 2 给未绑定的号发
'email' => 'requireIf:email_type,2|email|length:5,40',
'business' => 'require|in:1,2', // 1 非交易业务 2交易业务
'nation' => 'requireIf:phone_type,2|isString',
'phone' => 'requireIf:phone_type,2|isString|length:5,40',
'phone_type' => 'require|in:1,2',// 1 给已经绑定的号发 2 给未绑定的号发
'pay_password' => 'require|isString',
'pay_password_new' => 'require|isString|length:6,150',
'password' => 'require|isString',
'password_new' => 'require|isString|length:6,150',
'nick_name' => 'require|isString|length:2,100',
'first_name' => 'isString|length:2,100',
'last_name' => 'isString|length:2,100',
'gender' => 'isString|in:0,1,2',
];
protected $message = [
'num.require' => 'The num is required.',
'day.require' => 'The day is required.',
'country_id.require' => 'The country code is required.',
'country_id.isString' => 'The country code format is incorrect.',
'file_id.isString' => 'The file is required.',
'file_id.integer' => 'The file is missing.',
'email_type.require' => 'The email sending type is required.',
'email_type.in' => 'The email sending type format is incorrect.',
'email.requireIf' => 'The email is required.',
'email.email' => 'The email format is incorrect.',
'email.length' => 'The email should be between 5 and 40 characters.',
'business.require' => 'The business type is required.',
'business.in' => 'The business type is incorrect.',
'nation.requireIf' => 'The country code is required.',
'phone.requireIf' => 'The phone number is required.',
'phone.isString' => 'The phone number format is incorrect.',
'phone.length' => 'The phone number should be between 5 and 40 characters.',
'nation.isString' => 'The country code format is incorrect.',
'phone_type.require' => 'The phone message sending type is required.',
'phone_type.in' => 'The phone message sending type is incorrect.',
'email_code.require' => 'The email verification code is required.',
'email_code.isString' => 'The email verification code format is incorrect.',
'pay_password.isString' => 'The collection password format is incorrect.',
'pay_password.require' => 'The collection password is required.',
'pay_password_new.require' => 'The new collection password is required.',
'pay_password_new.isString' => 'The new collection password format is incorrect.',
'pay_password_new.length' => 'The new collection password length format is incorrect.',
'password.isString' => 'The login password format is incorrect.',
'password.require' => 'The login password is required.',
'password_new.isString' => 'The new login password format is incorrect.',
'password_new.require' => 'The new login password is required',
'password_new.length' => 'The new login length format is incorrect.',
'sms_code.require' => 'The SMS verification code is required.',
'sms_code.isString' => 'The SMS verification code format is incorrect.',
'nick_name.require' => 'Nickname is required.',
'nick_name.isString' => 'The name format is incorrect.',
'nick_name.length' => 'The name should be between 2 and 100 characters.',
'first_name.isString' => 'The name format is incorrect.',
'first_name.length' => 'The name should be between 2 and 100 characters.',
'last_name.isString' => 'The name format is incorrect.',
'last_name.length' => 'The name should be between 2 and 100 characters.',
'gender.isString' => 'The gender format is incorrect.',
'gender.in' => 'The gender format is incorrect.',
];
protected $scene = [
'setCountry' => ['country_id'],
'updateHeadImg' => ['file_id'],
'sendEmail' => ['email_type', 'email', 'business'],
'sendSms' => ['phone_type', 'phone', 'business', 'nation'],
// 'setPayPasswordByEmail' => ['email_code', 'pay_password'],
// 'setPayPasswordBySms' => ['sms_code', 'phone', 'pay_password', 'nation'],
'setPayPasswordByEmail' => ['pay_password'],
'setPayPasswordBySms' => ['phone', 'pay_password', 'nation'],
'updateInfo' => ['nick_name', 'first_name', 'last_name', 'gender'],
// 'updatePayPasswordBySms' => ['sms_code','pay_password', 'pay_password_new'],
'updatePayPasswordBySms' => ['pay_password', 'pay_password_new'],
// 'updatePayPasswordByEmail' => ['email_code','pay_password','pay_password_new'],
'updatePayPasswordByEmail' => ['pay_password', 'pay_password_new'],
// 'resetPayPasswordBySms' => ['sms_code', 'pay_password_new'],
// 'resetPayPasswordByEmail' => ['email_code', 'pay_password_new'],
'resetPayPasswordBySms' => ['pay_password_new'],
'resetPayPasswordByEmail' => ['pay_password_new'],
// 'updatePasswordBySms' => ['sms_code', 'password', 'password_new'],
// 'updatePasswordByEmail' => ['email_code', 'password', 'password_new'],
// 'resetPasswordBySms' => ['sms_code', 'password_new'],
// 'resetPasswordByEmail' => ['email_code', 'password_new'],
'updatePasswordBySms' => ['password', 'password_new'],
'updatePasswordByEmail' => ['password', 'password_new'],
'resetPasswordBySms' => ['password_new'],
'resetPasswordByEmail' => ['password_new'],
// 'bindEmail' => ['email', 'email_code'], // 绑定邮箱
'bindEmail' => ['email'], // 绑定邮箱
// 'updateEmail' => ['email', 'email_code', 'password'], // 修改绑定邮箱
'updateEmail' => ['email', 'password'], // 修改绑定邮箱
// 'bindPhone' => ['phone', 'nation','sms_code'], // 绑定手机号
'bindPhone' => ['phone', 'nation'], // 绑定手机号
// 'updatePhone' => ['phone', 'nation','sms_code','password'], // 修改绑定手机号
'updatePhone' => ['phone', 'nation', 'password'], // 修改绑定手机号
'apply_loan' => ['num', 'day'], // 修改绑定手机号
];
}