user->getInfoByUserName($userName); if (!$userInfo['result']) return $userInfo; if (!password_verify($pwd, $userInfo['data']['pass_word'])) return show(false, '用户名或密码错误'); $tokenData = [ 'id' => $userInfo['data']['id'], 'name' => $userInfo['data']['nickname'], 'email' => $userInfo['data']['email'] ]; $token = \Tinywan\Jwt\JwtToken::generateToken($tokenData); unset($userInfo['data']['pass_word']); $data = [ 'token' => $token, 'userInfo' => $userInfo['data'] ]; return show(true, '登录成功', $data); } /** * User: 高军 * Date: 2024/5/8 * QQ: 2926804347 * @param array $param * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * Notes: */ public function getList(array $param):array { return $this->user->getList($param); } }