酒吧房相关
This commit is contained in:
@@ -122,6 +122,9 @@ class Room extends BaseCom
|
||||
public function before_join_room_check()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$reslut = model('Room')->before_join_room_check($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -157,7 +160,6 @@ class Room extends BaseCom
|
||||
return V(0, '内侧房间,不可访问');
|
||||
}
|
||||
|
||||
|
||||
$reslut = model('Room')->join_room($this->uid, $room_id, $password);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -166,6 +168,9 @@ class Room extends BaseCom
|
||||
public function quit_room()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if(!$room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
$reslut = model('Room')->quit_room($this->uid, $room_id,$user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -231,6 +236,9 @@ class Room extends BaseCom
|
||||
public function room_online_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$page = input('page', 1);
|
||||
$limit = input('limit', 15);
|
||||
$reslut = model('Room')->room_online_list($room_id, $page, $limit);
|
||||
@@ -241,6 +249,9 @@ class Room extends BaseCom
|
||||
public function room_user_home()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
$reslut = model('Room')->room_user_home($this->uid,$room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -315,7 +326,7 @@ class Room extends BaseCom
|
||||
public function change_room_type()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$type = input('type', 1);//1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱,10-签约
|
||||
$type = input('type', 1);//1-交友,2-拍卖,7-互娱,8-交友(不要了),9-点唱,10-签约,11-酒吧房
|
||||
$reslut = model('Room')->change_room_type($this->uid, $room_id, $type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -341,6 +352,9 @@ class Room extends BaseCom
|
||||
public function room_info()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id){
|
||||
return V(0, '房间不存在');
|
||||
}
|
||||
$reslut = model('Room')->room_info($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -453,22 +467,7 @@ class Room extends BaseCom
|
||||
|
||||
|
||||
//用户重连
|
||||
public function user_reconnect()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$reslut = model('Room')->user_reconnect($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//用户在房间内切后台保留机制
|
||||
public function user_in_room_background()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$type = input('type', 1);//1-切后台,2-切前台
|
||||
$reslut = model('Room')->user_in_room_background($this->uid, $room_id,$type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//给用户发送房间内消息
|
||||
public function send_room_message()
|
||||
|
||||
@@ -7,33 +7,38 @@ use think\Db;
|
||||
|
||||
class RoomPit extends BaseCom
|
||||
{
|
||||
|
||||
//申请上麦
|
||||
public function apply_pit()
|
||||
{
|
||||
$key_name = "api:room:apply_pit:" . $this->uid;
|
||||
|
||||
$room_id = input('room_id', 0);
|
||||
$pit_number = input('pit_number', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$res = model('Room')->get_room_label($room_id);
|
||||
if($res['code'] != 1){
|
||||
$pit_number = input('pit_number', 0);
|
||||
|
||||
$key_name = "api:room:apply_pit:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
if($room_type == 0){
|
||||
return V(0, '房间不存在', null);
|
||||
}
|
||||
|
||||
$room_label = $res['data']['label_id'];
|
||||
$room_type = $res['data']['type_id'];
|
||||
redis_lock_exits($key_name);
|
||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7 || $room_type == 9 || $room_type == 10){
|
||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||
if($room_type == 2){
|
||||
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
|
||||
}elseif($room_type == 11){
|
||||
$gift_id = input('gift_id', 0);
|
||||
if($gift_id == 0){
|
||||
return V(0, '请选择礼物', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->apply_pit_bar($this->uid, $room_id,$gift_id,$pit_number);
|
||||
}else{
|
||||
redis_unlocks($key_name);
|
||||
return V(0, '房间不存在', null);
|
||||
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
|
||||
}
|
||||
redis_unlocks($key_name);
|
||||
|
||||
//用户操作记录
|
||||
//1-禁麦位,2-清空消息,3-清空魅力值,4-加入黑名单,5-踢出房间,6-关闭麦克风,7-申请上麦,8-同意上麦,9-拒绝上麦,10-点歌,11-开启PK',
|
||||
model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number);
|
||||
|
||||
@@ -44,6 +49,9 @@ class RoomPit extends BaseCom
|
||||
public function apply_pit_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->apply_pit_list($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -52,7 +60,13 @@ class RoomPit extends BaseCom
|
||||
public function help_apply_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择助力用户', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->help_apply_pit($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -61,7 +75,13 @@ class RoomPit extends BaseCom
|
||||
public function agree_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);//逗号分割
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择同意用户', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->agree_pit($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -70,6 +90,9 @@ class RoomPit extends BaseCom
|
||||
public function refuse_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$user_id = input('user_id', 0);//逗号分割
|
||||
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id, $user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -79,6 +102,9 @@ class RoomPit extends BaseCom
|
||||
public function clear_apply_pit_list()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->clear_apply_pit_list($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
@@ -87,7 +113,13 @@ class RoomPit extends BaseCom
|
||||
public function set_room_pit_apply_help_gift()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$gift_id = input('gift_id', 0);
|
||||
if($gift_id == 0){
|
||||
return V(0, '请选择礼物', null);
|
||||
}
|
||||
$gift_price = input('gift_price', 0);
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){
|
||||
@@ -101,26 +133,27 @@ class RoomPit extends BaseCom
|
||||
public function down_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
$pit_number = input('pit_number', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$res = model('Room')->get_room_label($room_id);
|
||||
if($res['code'] != 1){
|
||||
$pit_number = input('pit_number', 0);
|
||||
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
if($room_type == 0){
|
||||
return V(0, '房间不存在', null);
|
||||
}
|
||||
$room_label = $res['data']['label_id'];
|
||||
$room_type = $res['data']['type_id'];
|
||||
|
||||
if($room_type == 10){
|
||||
$upit = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $this->uid])->value('pit_number');
|
||||
if($upit == 2){
|
||||
return V(0, '师父麦,不能操作', null);
|
||||
}
|
||||
}
|
||||
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)) || $room_type == 2 || $room_type == 7 || $room_type == 9 || $room_type == 10){
|
||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
||||
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
|
||||
|
||||
if($room_type == 2){
|
||||
$reslut = model('RoomSong')->down_kpit($this->uid, $room_id);
|
||||
}else{
|
||||
$reslut = model('RoomPit')->DownPit($this->uid, $room_id,$pit_number);
|
||||
}
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -132,7 +165,10 @@ class RoomPit extends BaseCom
|
||||
$key_name = "api:room:change_room_up_pit_type:" . $this->uid;
|
||||
redis_lock_exit($key_name);
|
||||
$room_id = input('room_id', 0);
|
||||
// $user_id = input('user_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
|
||||
$reslut = model('RoomPit')->change_room_up_pit_type($this->uid, $room_id);
|
||||
redis_unlock($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -142,8 +178,14 @@ class RoomPit extends BaseCom
|
||||
public function host_user_pit()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$pit_number = input('pit_number', 0);
|
||||
$user_id = input('user_id', 0);//
|
||||
$user_id = input('user_id', 0);
|
||||
if($user_id == 0){
|
||||
return V(0, '请选择用户', null);
|
||||
}
|
||||
$type = input('type', 0);//1-抱麦 2-踢下去
|
||||
$reslut = model('RoomPit')->host_user_pit($this->uid, $room_id,$pit_number,$user_id,$type);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
@@ -154,6 +196,9 @@ class RoomPit extends BaseCom
|
||||
public function refuse_sign_room_host_invite()
|
||||
{
|
||||
$room_id = input('room_id', 0);
|
||||
if($room_id == 0){
|
||||
return V(0, '房间ID不能为空', null);
|
||||
}
|
||||
$reslut = model('RoomPit')->refuse_sign_room_host_invite($this->uid, $room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
56
application/api/controller/SendGift.php
Normal file
56
application/api/controller/SendGift.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class SendGift extends BaseCom
|
||||
{
|
||||
|
||||
/*
|
||||
* 送礼
|
||||
* @param int $gift_id
|
||||
*/
|
||||
public function send_gift()
|
||||
{
|
||||
$key_name = "api:send:gift:" . $this->uid;
|
||||
redis_lock_exits($key_name);
|
||||
$room_id = input('room_id', 0);//房间ID
|
||||
$gift_id = input('gift_id', 0);//礼物ID
|
||||
$gift_num = (int)input('gift_num', 1);//礼物数量
|
||||
$to_uid = input('to_uid', 0);//收礼人ID,逗号隔开的字符串
|
||||
$type = input('type', 1);//1金币购买 2送背包礼物
|
||||
$pit_number = input('pit_number', 0);
|
||||
$heart_id = input('heart_id', 0);//助力时的 ID
|
||||
|
||||
//获取幸运币
|
||||
$pool_gift_id = db::name('bb_lottery_config')->where(['key' => 'pool_gift_id'])->value('value');
|
||||
if($gift_id == $pool_gift_id){//送的是幸运币
|
||||
$reslut = model('Lottery')->gift($this->uid, $to_uid, $gift_id, $room_id,$gift_num);
|
||||
}else{
|
||||
//获取房间类型
|
||||
$room_type = model('Room')->get_room_type($room_id);
|
||||
if($room_type == 1){
|
||||
$reslut = model('GiveGift')->give_gift($this->uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
|
||||
}elseif ($room_type == 2){
|
||||
$reslut = model('GiveGift')->give_gift($this->uid, $to_uid, $gift_id, $gift_num,2,$type, $room_id,$pit_number,0,$give_gift_ext);
|
||||
if($reslut['code'] == 1){
|
||||
$room_pits = model('RoomSong')->get_charm_rank($room_id);
|
||||
if($room_pits['code'] == 1){
|
||||
$room_pit = $room_pits['data'];
|
||||
//推送给前端
|
||||
$text = [
|
||||
'userCharmList' => $room_pit,
|
||||
];
|
||||
model('Chat')->sendMsg(1019,$room_id,$text);//K歌房送礼后魅力变化 排序变化
|
||||
}
|
||||
}
|
||||
}
|
||||
$reslut = model('Room')->room_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $pit_number,$heart_id);
|
||||
}
|
||||
|
||||
redis_unlocks($key_name);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user