Cp礼物送礼处理
This commit is contained in:
@@ -41,8 +41,7 @@ class GiveGift extends Model
|
|||||||
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
||||||
{
|
{
|
||||||
if(isset($ext['is_draw_gift']) && $ext['is_draw_gift'] == 1) {
|
if(isset($ext['is_draw_gift']) && $ext['is_draw_gift'] == 1) {
|
||||||
$return_pan = $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext);
|
return $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext);
|
||||||
return $return_pan;
|
|
||||||
}
|
}
|
||||||
//送的礼物信息
|
//送的礼物信息
|
||||||
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
||||||
@@ -135,6 +134,7 @@ class GiveGift extends Model
|
|||||||
$gift_total = 0;
|
$gift_total = 0;
|
||||||
$give_gift = 0;
|
$give_gift = 0;
|
||||||
$gift_user_data = [];
|
$gift_user_data = [];
|
||||||
|
$cp_type = 0;
|
||||||
foreach ($toarray as $k => $to_id){
|
foreach ($toarray as $k => $to_id){
|
||||||
$gift_user_data[]['user_id'] = $to_id;
|
$gift_user_data[]['user_id'] = $to_id;
|
||||||
$gift_box1 = [];
|
$gift_box1 = [];
|
||||||
@@ -519,8 +519,8 @@ class GiveGift extends Model
|
|||||||
//直播间送礼物 每日任务
|
//直播间送礼物 每日任务
|
||||||
model('DailyTasks')->tasks_complete($uid,3);
|
model('DailyTasks')->tasks_complete($uid,3);
|
||||||
}
|
}
|
||||||
//cp检测
|
//cp检测且处理升级事宜
|
||||||
model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id);
|
$cp_type = model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id);//0-不处理,1-表明心意,2-组成Cp
|
||||||
}
|
}
|
||||||
|
|
||||||
//增加房间火热值hot_value
|
//增加房间火热值hot_value
|
||||||
@@ -546,7 +546,7 @@ class GiveGift extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => $cp_type]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -825,7 +825,7 @@ class GiveGift extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => 0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
//送礼特效
|
//送礼特效
|
||||||
|
|||||||
@@ -14,24 +14,25 @@ class UserCp extends Model
|
|||||||
* @param $gift_id 礼物ID
|
* @param $gift_id 礼物ID
|
||||||
* @param $to_user_id 接收用户ID
|
* @param $to_user_id 接收用户ID
|
||||||
* @param $room_id 房间ID
|
* @param $room_id 房间ID
|
||||||
|
* @return int 0-无,1-等待回应,2-已建立Cp空间
|
||||||
*/
|
*/
|
||||||
public function checkGift($from_user_id, $gift_id, $to_user_id, $room_id)
|
public function checkGift($from_user_id, $gift_id, $to_user_id, $room_id)
|
||||||
{
|
{
|
||||||
$cp_gift_id = explode(',', get_system_config_value('cp_gift_id'));
|
//查询是否已经存在Cp空间
|
||||||
if(!in_array($gift_id, $cp_gift_id)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rees = Db::name('user_cp_zone')->where(['user_id1' => $from_user_id,'user_id2' => $to_user_id,'status' => 1])->find();
|
$rees = Db::name('user_cp_zone')->where(['user_id1' => $from_user_id,'user_id2' => $to_user_id,'status' => 1])->find();
|
||||||
if(!$rees){
|
if(!$rees){
|
||||||
$rees = Db::name('user_cp_zone')->where(['user_id1' => $to_user_id,'user_id2' => $from_user_id,'status' => 1])->find();
|
$rees = Db::name('user_cp_zone')->where(['user_id1' => $to_user_id,'user_id2' => $from_user_id,'status' => 1])->find();
|
||||||
}
|
}
|
||||||
if($rees){
|
if($rees){
|
||||||
$this->addCpLevel($from_user_id, $to_user_id, $room_id, $gift_id, $rees['id']);
|
$this->addCpLevel($from_user_id, $to_user_id, $room_id, $gift_id, $rees['id']);
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询收礼人有没有给送礼人送过cp礼物
|
$cp_gift_id = explode(',', get_system_config_value('cp_gift_id'));
|
||||||
|
if(!in_array($gift_id, $cp_gift_id)){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
//查询收礼人有没有给送礼人送过cp礼物 status:0-待回应,1-建交成功,2-已取消
|
||||||
$res = Db::name('user_cp_find')->where(['from_user_id' => $to_user_id, 'to_user_id' => $from_user_id,'status' => 0])->find();
|
$res = Db::name('user_cp_find')->where(['from_user_id' => $to_user_id, 'to_user_id' => $from_user_id,'status' => 0])->find();
|
||||||
if($res){
|
if($res){
|
||||||
//创建推送信息1:回应送礼 并创建Cp空间,
|
//创建推送信息1:回应送礼 并创建Cp空间,
|
||||||
@@ -45,8 +46,8 @@ class UserCp extends Model
|
|||||||
Db::name('user_cp_find')->insert($data);
|
Db::name('user_cp_find')->insert($data);
|
||||||
//修改状态
|
//修改状态
|
||||||
Db::name('user_cp_find')->where(['id' => $res['id']])->update(['status' => 1]);
|
Db::name('user_cp_find')->where(['id' => $res['id']])->update(['status' => 1]);
|
||||||
//创建Cp空间
|
|
||||||
|
|
||||||
|
//创建Cp空间
|
||||||
$data = [
|
$data = [
|
||||||
'user_id1' => $from_user_id,
|
'user_id1' => $from_user_id,
|
||||||
'user_id2' => $to_user_id,
|
'user_id2' => $to_user_id,
|
||||||
@@ -59,11 +60,7 @@ class UserCp extends Model
|
|||||||
Db::name('user_cp_zone')->insert($data);
|
Db::name('user_cp_zone')->insert($data);
|
||||||
|
|
||||||
//给前端推送
|
//给前端推送
|
||||||
$text = [
|
return 2;
|
||||||
'text' => '组建Cp'
|
|
||||||
];
|
|
||||||
//聊天室推送系统消息
|
|
||||||
model('Chat')->sendMsg(1081,$room_id,$text);
|
|
||||||
}else{//创建推送信息2:表达心动信号
|
}else{//创建推送信息2:表达心动信号
|
||||||
//查询是否有相应的Cp空间
|
//查询是否有相应的Cp空间
|
||||||
$ress = Db::name('user_cp_find')
|
$ress = Db::name('user_cp_find')
|
||||||
@@ -94,13 +91,8 @@ class UserCp extends Model
|
|||||||
];
|
];
|
||||||
Db::name('user_cp_find')->insert($data);
|
Db::name('user_cp_find')->insert($data);
|
||||||
//给前端推送
|
//给前端推送
|
||||||
$text = [
|
return 1;
|
||||||
'text' => '有心动信号'
|
|
||||||
];
|
|
||||||
//聊天室推送系统消息
|
|
||||||
model('Chat')->sendMsg(1080,$room_id,$text);
|
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class Push
|
|||||||
|
|
||||||
|
|
||||||
// =======================================================================================================
|
// =======================================================================================================
|
||||||
// ========================================秘地使用开始=====================================================================
|
// ========================================项目使用开始=====================================================================
|
||||||
|
|
||||||
//横幅礼物通知
|
//横幅礼物通知
|
||||||
public function giftBanner($gift_list)
|
public function giftBanner($gift_list)
|
||||||
@@ -317,7 +317,7 @@ class Push
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// =========================================秘地使用结束=====================================================
|
// =========================================项目使用结束=====================================================
|
||||||
// =============================================================================================================
|
// =============================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user