1
0
Fork 0

user_socialte

master
panliang 2023-10-16 15:46:45 +08:00
parent b1d15f9324
commit 0cf776decd
3 changed files with 10 additions and 5 deletions

View File

@ -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,
]);
}

View File

@ -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');
}

View File

@ -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,
]);
}
}