注销 和创建房间

This commit is contained in:
2025-12-08 10:42:58 +08:00
parent e4c3f572e5
commit c10f055585
3 changed files with 58 additions and 17 deletions

View File

@@ -7,12 +7,26 @@ use think\Db;
class Room extends BaseCom
{
//创建房间前的检测
public function check_create_room()
{
//检测用户的签约徒弟
$signCount = db::name('vs_user_sign')->where(['parent_user_id' => $this->uid ,'end_time' => ['>', time()]] )->count();
if($signCount < 10){
$need_sign_num = 10 - $signCount;
return V(0, '还需签约'.$need_sign_num.'人,才能创建房间!');
}
return V(1, '可以创建房间');
}
//创建房间
public function create_room()
{
$room_name = input('room_name', '');
$room_cover = input('room_cover', '');
$room_intro = input('room_intro', '');
$key_name = "api:room:user_create_room:" . $this->uid;
redis_lock_exits($key_name);
$reslut = model('Room')->user_create_room($this->uid, $room_name, $room_cover, $room_intro);