$em->persist($user_info); $em->flush($user_info); $app->response->headers->set('Content-Type', 'application/json'); echo Util::resPonseJson($app, 200, "", array()); exit; } catch (Exception $e) { $app->response->headers->set('Content-Type', 'application/json'); echo Util::resPonseJson($app, 500, "System error.", array()); exit; } exit; }); $app->get('/userinfo/:user_id', $check_auth($em), function ($user_id) use($app, $em) { $user = $em->getRepository('App\\Model\\User')->find($user_id); if (!$user) { $app->response->headers->set('Content-Type', 'application/json'); echo Util::resPonseJson($app, 4004, "User not exists.", array()); exit; } $userInfo = $em->getRepository('App\\Model\\UserInfo')->find($user_id); if (!$userInfo) { $userInfo = new UserInfo(); } $allInfo = array_merge($user->toArray(), $userInfo->toArray()); unset($allInfo['password_hash']); unset($allInfo['payment_password']); unset($allInfo['user_id']); $app->response->headers->set('Content-Type', 'application/json'); echo Util::resPonseJson($app, 200, "", array("user" => $allInfo)); exit; });