字段错误修复

This commit is contained in:
2024-12-05 18:21:05 +08:00
parent c5e10e97ce
commit 6c563e6f19

View File

@@ -150,22 +150,25 @@ class BaseAdminController extends Controller
}
// 判断是否30分钟以上未操作
$uid = Yii::$app->user->identity->id;
$redis = Yii::$app->redis;
$opKey = 'op_user_'. $uid;
// ds(date('Y-m-d H:i:s', time() + $redis->ttl($opKey)));
if (!$redis->exists($opKey)) {
$adminAccessToken = new AdminAccessToken();
$olds = $adminAccessToken::find()->where(['admin_id' => $uid, 'status' => 1])->all();
if (isset(Yii::$app->user->identity->id)) {
foreach ($olds as $old) {
$old->status = -1;
$old->updated_at = time();
$old->save();
$uid = Yii::$app->user->identity->id;
$redis = Yii::$app->redis;
$opKey = 'op_user_'. $uid;
// ds(date('Y-m-d H:i:s', time() + $redis->ttl($opKey)));
if (!$redis->exists($opKey)) {
$adminAccessToken = new AdminAccessToken();
$olds = $adminAccessToken::find()->where(['admin_id' => $uid, 'status' => 1])->all();
foreach ($olds as $old) {
$old->status = -1;
$old->updated_at = time();
$old->save();
}
throw new UnauthorizedHttpException('您太久未操作,请重新登陆。');
} else {
$redis->expire($opKey, 3600);
}
throw new UnauthorizedHttpException('您太久未操作,请重新登陆。');
} else {
$redis->expire($opKey, 3600);
}
return $ret;
}