From dc239087d5e5c5b8244bdefbcee063cd6c985796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Tue, 18 Nov 2025 19:09:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Cp=E7=A4=BC=E7=89=A9=E9=80=81=E7=A4=BC?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/GiveGift.php | 12 +++++------ application/api/model/UserCp.php | 30 ++++++++++---------------- application/common/controller/Push.php | 4 ++-- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 38e5e83a..248061f5 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -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 = []) { 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 $return_pan; + return $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext); } //送的礼物信息 $gift_info = Db::name('vs_gift')->where(['gid'=>$gid]) @@ -135,6 +134,7 @@ class GiveGift extends Model $gift_total = 0; $give_gift = 0; $gift_user_data = []; + $cp_type = 0; foreach ($toarray as $k => $to_id){ $gift_user_data[]['user_id'] = $to_id; $gift_box1 = []; @@ -519,8 +519,8 @@ class GiveGift extends Model //直播间送礼物 每日任务 model('DailyTasks')->tasks_complete($uid,3); } - //cp检测 - model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id); + //cp检测且处理升级事宜 + $cp_type = model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id);//0-不处理,1-表明心意,2-组成Cp } //增加房间火热值hot_value @@ -546,7 +546,7 @@ class GiveGift extends Model } 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]]; } //送礼特效 diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index 27be9ef8..f6fabd47 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -14,24 +14,25 @@ class UserCp extends Model * @param $gift_id 礼物ID * @param $to_user_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) { - $cp_gift_id = explode(',', get_system_config_value('cp_gift_id')); - if(!in_array($gift_id, $cp_gift_id)){ - return false; - } - + //查询是否已经存在Cp空间 $rees = Db::name('user_cp_zone')->where(['user_id1' => $from_user_id,'user_id2' => $to_user_id,'status' => 1])->find(); if(!$rees){ $rees = Db::name('user_cp_zone')->where(['user_id1' => $to_user_id,'user_id2' => $from_user_id,'status' => 1])->find(); } if($rees){ $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(); if($res){ //创建推送信息1:回应送礼 并创建Cp空间, @@ -45,8 +46,8 @@ class UserCp extends Model Db::name('user_cp_find')->insert($data); //修改状态 Db::name('user_cp_find')->where(['id' => $res['id']])->update(['status' => 1]); - //创建Cp空间 + //创建Cp空间 $data = [ 'user_id1' => $from_user_id, 'user_id2' => $to_user_id, @@ -59,11 +60,7 @@ class UserCp extends Model Db::name('user_cp_zone')->insert($data); //给前端推送 - $text = [ - 'text' => '组建Cp' - ]; - //聊天室推送系统消息 - model('Chat')->sendMsg(1081,$room_id,$text); + return 2; }else{//创建推送信息2:表达心动信号 //查询是否有相应的Cp空间 $ress = Db::name('user_cp_find') @@ -94,13 +91,8 @@ class UserCp extends Model ]; Db::name('user_cp_find')->insert($data); //给前端推送 - $text = [ - 'text' => '有心动信号' - ]; - //聊天室推送系统消息 - model('Chat')->sendMsg(1080,$room_id,$text); + return 1; } - return true; } diff --git a/application/common/controller/Push.php b/application/common/controller/Push.php index 067a2004..b5cdfa23 100644 --- a/application/common/controller/Push.php +++ b/application/common/controller/Push.php @@ -277,7 +277,7 @@ class Push // ======================================================================================================= -// ========================================秘地使用开始===================================================================== +// ========================================项目使用开始===================================================================== //横幅礼物通知 public function giftBanner($gift_list) @@ -317,7 +317,7 @@ class Push -// =========================================秘地使用结束===================================================== +// =========================================项目使用结束===================================================== // ============================================================================================================= From 7490acac121de3321a9dfabb524b7dc2ca017708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 19 Nov 2025 10:16:35 +0800 Subject: [PATCH 2/4] =?UTF-8?q?Cp=E7=A4=BC=E7=89=A9=E9=80=81=E7=A4=BC?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/GiveGift.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 248061f5..bb97484a 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -135,6 +135,8 @@ class GiveGift extends Model $give_gift = 0; $gift_user_data = []; $cp_type = 0; + $text = ''; + $text1 = ''; foreach ($toarray as $k => $to_id){ $gift_user_data[]['user_id'] = $to_id; $gift_box1 = []; @@ -520,7 +522,15 @@ class GiveGift extends Model model('DailyTasks')->tasks_complete($uid,3); } //cp检测且处理升级事宜 - $cp_type = model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id);//0-不处理,1-表明心意,2-组成Cp + $cp_type = model('api/UserCp')->checkGift($uid, $gid, $to_id, $from_id);//0-不处理,1-表明心意,2-组成Cp + if($cp_type == 1){ + $text1 = "亲爱的用户,您好!\n".$FromUserInfo['nickname'] . ' 的 【' .$gift_info['gift_name'].' 】 已送达,这是他的心动信号。回赠一个,即可锁定这份缘分!'; + $text = ''; + }elseif ($cp_type == 2){ + //接受方弹起的 信息 + $text1 = "恭喜你!". $FromUserInfo['nickname'] ."也向您回赠了【" .$gift_info['gift_name']."】,并接受了你的心动信号。\n从现在起,你们正式成为彼此的专属CP,共同开启一段甜蜜的旅程。\n【心动空间】已为你们敞开大门!这里将记录你们在一起的点滴,见证所有心动与陪伴。快去心动空间,开启你们的CP升级之旅吧!"; + $text = '【心动空间】已为你们敞开大门!这里将记录你们在一起的点滴,见证所有心动与陪伴。快去心动空间,开启你们的CP升级之旅吧!';//发送方弹起的信息 + } } //增加房间火热值hot_value @@ -546,7 +556,7 @@ class GiveGift extends Model } Db::commit(); - return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => $cp_type]]; + return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => ['cp_type' => $cp_type,'text' => $text,'text1' => $text1]]]; } /* From 14f06862062969ded74946ecd869113f82b24c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 19 Nov 2025 10:39:20 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Cp=E7=A4=BC=E7=89=A9=E9=80=81=E7=A4=BC?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/GiveGift.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index bb97484a..9b92b7b1 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -556,7 +556,7 @@ class GiveGift extends Model } Db::commit(); - return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => ['cp_type' => $cp_type,'text' => $text,'text1' => $text1]]]; + return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => ['cp_type' => $cp_type,'text' => $text,'text1' => $text1,'gift_id' => $gid]]]; } /* @@ -835,7 +835,7 @@ class GiveGift extends Model } } - return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => 0]]; + return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data,'cp_type' => ['cp_type' => 0,'text' => '','text1' => '','gift_id' => $gid]]]; } //送礼特效 From d9a54d7ea01732d89f85b1fac3ce1ae2855db7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 19 Nov 2025 11:07:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?Cp=E7=A4=BC=E7=89=A9=E9=80=81=E7=A4=BC?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/UserCp.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/api/controller/UserCp.php b/application/api/controller/UserCp.php index 3a363a2a..4c717598 100644 --- a/application/api/controller/UserCp.php +++ b/application/api/controller/UserCp.php @@ -7,6 +7,15 @@ use think\Db; class UserCp extends BaseCom { + //用户CP礼物回赠 + public function cpGiveGift() + { + $user_id = input('user_id', 0); + $gift_id = input('gift_id', 0); + $reslut = model('GiveGift')->give_gift($this->uid, $user_id, $gift_id, 1,1,1); + return V($reslut['code'], $reslut['msg'], $reslut['data']); + } + //Cp 空间 public function cpZone()