cp 相互送礼 等级处理

This commit is contained in:
2025-11-20 10:37:08 +08:00
parent aaff62d46c
commit 4a67312897
2 changed files with 6 additions and 6 deletions

View File

@@ -522,7 +522,7 @@ class GiveGift extends Model
model('DailyTasks')->tasks_complete($uid,3);
}
//cp检测且处理升级事宜
$cp_type = model('api/UserCp')->checkGift($uid, $gid, $to_id, $from_id);//0-不处理1-表明心意2-组成Cp
$cp_type = model('api/UserCp')->checkGift($uid, $gid, $to_id, $from_id, $num);//0-不处理1-表明心意2-组成Cp
if($cp_type == 1){
$textt1 = "亲爱的用户,您好!\n".$FromUserInfo['nickname'] . ' 的 【' .$gift_info['gift_name'].' 】 已送达,这是他的心动信号。回赠一个,即可锁定这份缘分!';
$textt = '';

View File

@@ -16,7 +16,7 @@ class UserCp extends Model
* @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, $num)
{
//查询是否已经存在Cp空间
$rees = Db::name('user_cp_zone')->where(['user_id1' => $from_user_id,'user_id2' => $to_user_id,'status' => 1])->find();
@@ -24,7 +24,7 @@ class UserCp extends Model
$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']);
$this->addCpLevel($from_user_id, $to_user_id, $room_id, $gift_id, $rees['id'], $num);
return 0;
}
@@ -105,12 +105,12 @@ class UserCp extends Model
* @param $room_id 房间ID
* @param $cp_zone_id Cp空间ID
*/
public function addCpLevel($from_user_id, $to_user_id, $room_id, $gift_id, $cp_zone_id)
public function addCpLevel($from_user_id, $to_user_id, $room_id, $gift_id, $cp_zone_id, $num)
{
$jinbi_arr = explode(',', get_system_config_value('cp_exp_rate'));
$jinbi = $jinbi_arr[0];
$jinyan = $jinbi_arr[1];
$exp = round(db::name('vs_gift')->where(['gid' => $gift_id])->value('gift_price') / $jinbi * $jinyan, 2);
$exp = round(db::name('vs_gift')->where(['gid' => $gift_id])->value('gift_price') * $num / $jinbi * $jinyan, 2);
$yuan_exp = Db::name('user_cp_zone')->where(['id' => $cp_zone_id])->value('exp');
//添加一个记录
@@ -126,7 +126,7 @@ class UserCp extends Model
];
Db::name('user_cp_gift_log')->insert($datas);
//判断是否升级
$level = Db::name('user_cp_level')->where(['change_value' => ['<=', $yuan_exp + $exp]])->order('change_value desc')->value('level');
$level = Db::name('user_cp_level')->where(['change_value' => ['<=', $yuan_exp + $exp],'deletetime' => 0])->order('change_value desc')->value('level');
if($level){
//修改Cp空间等级
$data['level'] = $level;