Browse Source

优化

master
wanghongjun 2 years ago
parent
commit
16be37640c
  1. 29
      app/controller/AgentTeam.php
  2. 2
      app/validate/Agent.php

29
app/controller/AgentTeam.php

@ -242,6 +242,35 @@ class AgentTeam extends BaseController
]); ]);
} }
/**
* 找回密码
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function modifyPassword()
{
$data = Request::param();
try {
// 验证代理输入
validate(Agent::class)->scene('modifyPassword')->check($data);
$userModel = new AgentUser();
$user = $userModel->retrieve(['password' => $data['password'],'aid' => $this->request->userInfo['id']]);
if ($user['status']) {
return $this->renderSuccess('修改成功');
} else {
return $this->renderError($user['msg']);
}
} catch (ValidateException $exception) {
return $this->renderError($exception->getMessage());
}
}
/** /**
* 上分记录 * 上分记录
* @return array * @return array

2
app/validate/Agent.php

@ -17,6 +17,7 @@ class Agent extends Validate
'user_id|用户id' => 'require|number', 'user_id|用户id' => 'require|number',
'quota|额度' => 'require|number|egt:1', 'quota|额度' => 'require|number|egt:1',
'password|密码' => 'require|min:6|max:20', 'password|密码' => 'require|min:6|max:20',
'repassword|确认密码' => 'require|confirm:password',
'aid|代理id' => 'require|number', 'aid|代理id' => 'require|number',
'phone|手机号' => 'require|mobile', 'phone|手机号' => 'require|mobile',
]; ];
@ -34,5 +35,6 @@ class Agent extends Validate
'edit' => ['aid','password'], 'edit' => ['aid','password'],
'del' => ['aid'], 'del' => ['aid'],
'register' => ['phone','password'], 'register' => ['phone','password'],
'modifyPassword' => ['password','repassword'],
]; ];
} }

Loading…
Cancel
Save