コード例 #1
0
ファイル: NoticeApply.php プロジェクト: ttym7993/Linger
 /**
  * 登录限制
  * @param null $rt
  * @param User $user
  * @return null
  */
 public function message_login_restrictions($rt, $user)
 {
     try {
         if (!$this->notice($user->getId(), 'message', 'login_restrictions')) {
             return $rt;
         }
         $mt = new MailTemplate("message_notice/login_restrictions.md");
         $mt->setUserInfo($user->getInfo());
         c_lib()->load('input');
         $input = new Input();
         $mt->setValues(['login_ip' => $input->getRealIP(), 'login_ua' => $input->getUA(), 'login_count' => $user->getErrorLoginCount()]);
         $this->message->addNoticeMsg($mt->getTitle(), $mt->getContent(), $user->getId());
     } catch (\Exception $ex) {
         Log::write(_("NoticeApply message_login_restrictions create a Exception.") . "EX:[" . $ex->getCode() . "]:" . $ex->getMessage(), Log::NOTICE);
     }
     return $rt;
 }