|
|
@@ -16,6 +16,8 @@ class MasterWokerValidate extends BaseValidate
|
|
|
'code' => 'require|checkCode',
|
|
|
'password' => 'require|length:6,20|alphaNum',
|
|
|
'password_confirm' => 'require|confirm',
|
|
|
+ 'field' => 'require|checkField',
|
|
|
+ 'value' => 'require',
|
|
|
];
|
|
|
|
|
|
|
|
|
@@ -27,8 +29,20 @@ class MasterWokerValidate extends BaseValidate
|
|
|
'password.length' => '密码须在6-25位之间',
|
|
|
'password.alphaNum' => '密码须为字母数字组合',
|
|
|
'password_confirm.require' => '请确认密码',
|
|
|
- 'password_confirm.confirm' => '两次输入的密码不一致'
|
|
|
+ 'password_confirm.confirm' => '两次输入的密码不一致',
|
|
|
+ 'field.require' => '参数缺失',
|
|
|
+ 'value.require' => '值不存在',
|
|
|
];
|
|
|
+ protected function checkField($value, $rule, $data)
|
|
|
+ {
|
|
|
+ $allowField = [
|
|
|
+ 'nickname', 'sex', 'real_avatar','avatar', 'real_name',
|
|
|
+ ];
|
|
|
+ if (!in_array($value, $allowField)) {
|
|
|
+ return '参数错误';
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
public function checkCode($code, $rule, $data)
|
|
|
{
|
|
|
@@ -49,4 +63,9 @@ class MasterWokerValidate extends BaseValidate
|
|
|
{
|
|
|
return $this->only(['password', 'password_confirm']);
|
|
|
}
|
|
|
+
|
|
|
+ public function sceneSetInfo()
|
|
|
+ {
|
|
|
+ return $this->only(['field', 'value']);
|
|
|
+ }
|
|
|
}
|