酒吧房:->相关接口提交-撩TA接口
This commit is contained in:
@@ -42,4 +42,26 @@ class BarRoom extends BaseCom
|
||||
$reslut = model('BarRoom')->get_gift_info_ta($room_id, $to_user_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//撩TA所需金币查询
|
||||
public function get_liao_ta_coin(){
|
||||
$type = input('type', 0);
|
||||
$room_id = input('room_id', 0);
|
||||
$reslut = model('BarRoom')->get_liao_ta_coin($type,$room_id);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
//撩TA
|
||||
public function liao_ta(){
|
||||
$room_id = input('room_id', 0);
|
||||
$to_user_id =input('to_user_id', 0);
|
||||
$user_id = $this->uid;
|
||||
$type = input('type', 0);
|
||||
if($type == 1){
|
||||
$reslut = model('BarRoom')->liao_ta($room_id,$user_id,$to_user_id);
|
||||
}else{
|
||||
$reslut = model('BarRoom')->one_key_liao_ta($room_id,$user_id);
|
||||
}
|
||||
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -104,4 +104,84 @@ class BarRoom extends Model
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $return_data];
|
||||
}
|
||||
//撩TA
|
||||
public function liao_ta($room_id,$user_id,$to_user_id){
|
||||
//查询撩TA礼物
|
||||
$liao_ta_gif = $this->get_liao_ta_gift();
|
||||
$liao_ta_gif_id = $liao_ta_gif['gid']??0;
|
||||
//调用送礼接口
|
||||
|
||||
//推送撩TA消息
|
||||
$FromUserInfo = db::name('vs_user')->where(['id' => $user_id])->find();
|
||||
|
||||
// $effectData = [
|
||||
// 'FromUserInfo' => $FromUserInfo,
|
||||
// 'ToUserInfo' => $userInfo,
|
||||
// 'GiftInfo' => $gift_inf,
|
||||
// 'gift_num' => $count,
|
||||
// 'text' => null
|
||||
// ];
|
||||
// // 聊天室推送礼物特效消息
|
||||
// model('api/Chat')->sendMsg(1005,$room_id,$effectData);
|
||||
}
|
||||
//一键全撩
|
||||
public function one_key_liao_ta($room_id,$user_id){
|
||||
//查询撩TA礼物
|
||||
$liao_ta_gif = $this->get_liao_ta_gift();
|
||||
$liao_ta_gif_id = $liao_ta_gif['gid']??0;
|
||||
|
||||
//查询麦上用户
|
||||
$room_pit_Users = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id'=>['>',0],'status' => 1])->value('user_id');
|
||||
if($room_pit_Users){
|
||||
foreach ($room_pit_Users as $key => $value) {
|
||||
//调用送礼接口
|
||||
|
||||
}
|
||||
}
|
||||
//推送一键全撩
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
//撩TA所需金币查询
|
||||
public function get_liao_ta_coin($type,$room_id){
|
||||
$liao_ta_gif = $this->get_liao_ta_gift();
|
||||
$liao_ta_coin = $liao_ta_gif['gift_price']??0;
|
||||
$user_num = 1;
|
||||
if($type != 1){
|
||||
//查询麦上用户
|
||||
$room_pit_Users = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',7],'user_id'=>['>',0],'status' => 1])->value('user_id');
|
||||
if(empty($room_pit_Users)){
|
||||
return ['code' => 0, 'msg' => '没有麦上用户', 'data' => null];
|
||||
}
|
||||
$user_num = count($room_pit_Users);
|
||||
}
|
||||
$liao_ta_coin = $liao_ta_coin * $user_num;
|
||||
$return_data = [
|
||||
'coin' => $liao_ta_coin,
|
||||
];
|
||||
return ['code' => 1, 'msg' => '获取成功', 'data' => $return_data];
|
||||
}
|
||||
|
||||
//获取撩TA礼物
|
||||
public function get_liao_ta_gift(){
|
||||
$cache_key = 'gift_list_17';
|
||||
//2,缓存获取
|
||||
$gift_data = json_decode(Cache::get($cache_key), true);
|
||||
//获取到就返回
|
||||
if($gift_data){
|
||||
return $gift_data;
|
||||
}
|
||||
//查询撩TA礼物
|
||||
$where = [];
|
||||
$where['type'] = 4;
|
||||
$where['label'] = 17;
|
||||
$where['is_show'] = 1;
|
||||
$where['is_can_buy'] = 1;
|
||||
$where['delete_time'] = 0;
|
||||
$gift_data = db::name('vs_gift')->where($where)->order('gid desc')->find();
|
||||
//设置缓存
|
||||
Cache::set($cache_key, json_encode($gift_data), 3600*24);
|
||||
return $gift_data;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user