protected function buildUser($userData)
 {
     $user = new User();
     $user->setId($userData['id']);
     $user->setName($userData['name']);
     $user->setPassword($userData['password']);
     $user->setEmail($userData['email']);
     $user->setStatus($userData['status']);
     $user->setJoinTime($userData['joinTime']);
     $user->setRegisterIp($userData['registerIp']);
     $user->setLastLoginTime($userData['lastLoginTime']);
     $user->setIsVip($userData['isVip']);
     $user->setIntegration($userData['integration']);
     $user->setShareKey($userData['shareKey']);
     $user->setSharedKey($userData['sharedKey']);
     $user->setShareKeyUseNum($userData['shareKeyUseNum']);
     $user->setVipStartTime($userData['vipStartTime']);
     $user->setVipEndTime($userData['vipEndTime']);
     $user->setPurchasedGoodsId($userData['purchasedGoodsId']);
     $user->setLastSignInTime($userData['lastSignInTime']);
     $user->setLastLoginIp($userData['lastLoginTime']);
     return $user;
 }
 public function accountActiveAction(Request $request, Application $app)
 {
     //        $userId = $app['session']->get('userId');
     $sharedKey = $request->query->get('key');
     $userId = $request->query->get('userId');
     $user = new User();
     $user->setShareKey($sharedKey);
     $resultFindByShareKey = $app['repository.user']->findByShareKey($user);
     $user = new User();
     $user->setSharedKey($sharedKey);
     $user->setId($userId);
     $resultFindBySharedKeyAndId = $app['repository.user']->findBySharedKeyAndId($user);
     $user->setId($resultFindBySharedKeyAndId->getId());
     $user->setStatus(1);
     $user = $app['repository.user']->changeStatus($user);
     if (!$user) {
         CommonFunc::alertBack('激活失败,或已经激活,请尝试直接登录,或直接联系管理员');
         return;
     } else {
         CommonFunc::alert('激活成功');
     }
     if ($resultFindByShareKey->getId()) {
         //给有上线加积分
         $user = new User();
         $user->setIntegration($resultFindByShareKey->getIntegration() + $app['shareIntegration']);
         $user->setId($resultFindByShareKey->getId());
         $app['repository.user']->changeIntegration($user);
         $app['repository.user']->addShareKeyUseNum($user);
     }
     $redirect = $app['url_generator']->generate('userIndex');
     return $app->redirect($redirect);
 }