From 0cf776decdf60beb9ab5e4bf4bacb4153a38b8d7 Mon Sep 17 00:00:00 2001 From: panliang <1163816051@qq.com> Date: Mon, 16 Oct 2023 15:46:45 +0800 Subject: [PATCH] user_socialte --- app/Admin/Controllers/AuthController.php | 4 ++-- app/Console/Kernel.php | 2 +- app/Http/Controllers/Client/AuthController.php | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Admin/Controllers/AuthController.php b/app/Admin/Controllers/AuthController.php index 2c51481..412362a 100644 --- a/app/Admin/Controllers/AuthController.php +++ b/app/Admin/Controllers/AuthController.php @@ -52,9 +52,9 @@ class AuthController extends AdminAuthController UserSocialite::updateOrCreate([ 'type' => SocialiteType::from($open_type), 'user_type' => $user->getMorphClass(), - 'user_id' => $user->id, - ], [ 'openid' => $openid, + ], [ + 'user_id' => $user->id, ]); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a9508f7..0e771c4 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel { // $schedule->command('inspire')->hourly(); // $schedule->call(fn () => logger('schedule running'))->everyMinute(); - $schedule->command('patient-record:notify')->daily(); + $schedule->command('patient-record:notify')->dailyAt('7:00'); $schedule->command('user:birthday-notify')->dailyAt('8:00'); } diff --git a/app/Http/Controllers/Client/AuthController.php b/app/Http/Controllers/Client/AuthController.php index 6a818fc..7ac2d12 100644 --- a/app/Http/Controllers/Client/AuthController.php +++ b/app/Http/Controllers/Client/AuthController.php @@ -64,12 +64,17 @@ class AuthController extends Controller protected function updateUserSocialite($user, $openid, $type) { + // 清空以前绑定的 + UserSocialite::where([ + 'type' => $type, + 'user_type' => $user->getMorphClass(), + ])->update(['user_id' => null]); UserSocialite::updateOrCreate([ 'type' => $type, 'user_type' => $user->getMorphClass(), - 'user_id' => $user->id, - ], [ 'openid' => $openid, + ], [ + 'user_id' => $user->id, ]); } }