perf: 通过页面修改机器人资料

This commit is contained in:
kuaifan
2023-04-01 15:23:07 +08:00
parent d828ed83a5
commit 2fcb7fb59b
5 changed files with 245 additions and 40 deletions
+15
View File
@@ -149,6 +149,21 @@ class User extends AbstractModel
return implode(', ', $array);
}
/**
* 获取机器人所有者
* @return int|mixed
*/
public function getBotOwner()
{
if (!$this->bot) {
return 0;
}
$key = "BotOwner::" . $this->userid;
return Cache::remember($key, now()->addMonth(), function() {
return intval(UserBot::whereBotId($this->userid)->value('userid'));
});
}
/**
* 是否在线
* @return bool