Skip to content

Commit

Permalink
[authme-integration] optimize SQL statement
Browse files Browse the repository at this point in the history
  • Loading branch information
g-plane committed Jan 30, 2021
1 parent ed9eefc commit 90161f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/authme-integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "authme-integration",
"version": "2.4.0",
"version": "2.4.1",
"title": "Authme 数据对接",
"description": "与 Authme 进行数据对接,让玩家可以使用皮肤站的账号密码登录游戏。",
"author": "printempw",
Expand Down
7 changes: 4 additions & 3 deletions plugins/authme-integration/src/Listener/SyncWithAuthme.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public function subscribe(Dispatcher $events)
{
// 初始化在 Authme 那边注册的用户
User::where('realname', '<>', '')
->join('players', 'users.uid', 'players.uid')
->groupBy('players.uid')
->havingRaw('COUNT(pid) <> 0')
->select('users.*')
->get()
->filter(function ($user) {
return $user->players->count() == 0;
})
->each(function ($user) {
$user->nickname = $user->realname;
$user->score = option('user_initial_score');
Expand Down

0 comments on commit 90161f1

Please sign in to comment.