Exemplo n.º 1
0
 public function loginAdminUser($username)
 {
     if (!$username) {
         return false;
     }
     $model = (new AdminUser())->findOne(['username' => $username]);
     if (!$model) {
         return false;
     }
     $model->loginIp = Tool::getIp();
     $model->loginTime = date('Y-m-d H:i:s', time());
     $model->save();
     Yii::$app->session->set(Variable::$session_userId_str, $model->id);
     //设置session
 }