mirror of
https://github.com/v2board/v2board.git
synced 2025-06-14 13:47:49 +08:00
update telegram
This commit is contained in:
@ -76,7 +76,7 @@ class UserService
|
||||
return true;
|
||||
}
|
||||
|
||||
public function trafficFetch(int $u, int $d, int $userId)
|
||||
public function trafficFetch(int $u, int $d, int $userId):bool
|
||||
{
|
||||
$user = User::find($userId);
|
||||
if (!$user) {
|
||||
@ -90,4 +90,30 @@ class UserService
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setTelegramId(int $userId, int $telegramId):bool
|
||||
{
|
||||
$user = User::find($userId);
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
$user->telegram_id = $telegramId;
|
||||
if (!$user->save()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function delTelegramId(int $userId):bool
|
||||
{
|
||||
$user = User::find($userId);
|
||||
if (!$user) {
|
||||
return false;
|
||||
}
|
||||
$user->telegram_id = NULL;
|
||||
if (!$user->save()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user