@@ -42,7 +42,7 @@ |
||
42 | 42 | { |
43 | 43 | /** @var ActiveRecord $class */ |
44 | 44 | $class = $this->modelClass; |
45 | - $class::create($this->attributes,$this->runValidation); |
|
45 | + $class::create($this->attributes, $this->runValidation); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if ($app->hasModule('user') && ($module = $app->getModule('user')) instanceof Module) { |
31 | 31 | //监听用户活动时间 |
32 | 32 | /** @var \yii\web\UserEvent $event */ |
33 | - $app->on(Application::EVENT_AFTER_REQUEST, function ($event) use ($app) { |
|
33 | + $app->on(Application::EVENT_AFTER_REQUEST, function($event) use ($app) { |
|
34 | 34 | if (!$app->user->isGuest && Yii::$app->has('queue')) { |
35 | 35 | $user = UserExtra::findOne(['user_id' => $app->user->id]); |
36 | 36 | $user->updateAttributesAsync(['last_visit' => time()]); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | //监听用户登录事件 |
41 | 41 | /** @var \yii\web\UserEvent $event */ |
42 | - $app->user->on(User::EVENT_AFTER_LOGIN, function ($event) use ($app) { |
|
42 | + $app->user->on(User::EVENT_AFTER_LOGIN, function($event) use ($app) { |
|
43 | 43 | //记录最后登录时间记录最后登录IP记录登录次数 |
44 | 44 | $user = UserExtra::findOne(['user_id' => $app->user->id]); |
45 | 45 | $user->updateAttributesAsync(['login_at' => time(), 'login_ip' => Yii::$app->request->userIP]); |