From cfadaf43267e95cbdbbeef1ed84c203ab4b7c16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Thu, 18 Dec 2025 18:15:31 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=99=8D=E8=BA=AB?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Cron.php | 1 + application/cron/controller/DaySeconds.php | 78 ++++++++++++++++++- .../cron/controller/PerformPerSecond.php | 69 ---------------- 3 files changed, 78 insertions(+), 70 deletions(-) diff --git a/application/api/controller/Cron.php b/application/api/controller/Cron.php index 9f0a7712..278c5820 100644 --- a/application/api/controller/Cron.php +++ b/application/api/controller/Cron.php @@ -52,6 +52,7 @@ class Cron /* * 清除房间热度值 * 清除房间离线超24小时的用户 + * 系统降身价 */ public function DaySeconds() { diff --git a/application/cron/controller/DaySeconds.php b/application/cron/controller/DaySeconds.php index 083bae33..c67c01cd 100644 --- a/application/cron/controller/DaySeconds.php +++ b/application/cron/controller/DaySeconds.php @@ -16,12 +16,16 @@ class DaySeconds function index() { echo "清除房间热度值:\n"; - $this->clear_room_today_hot_value();//0点以后房间热度值清零 +// $this->clear_room_today_hot_value();//0点以后房间热度值清零 echo "\n"; echo "清除房间离线超24小时的用户:\n"; $this->clear_room_offline_user();//0点以后清除房间离线超24小时用户 echo "\n"; + + echo "系统降身价:\n"; + $this->system_downgrade(); + echo "\n"; } @@ -62,4 +66,76 @@ class DaySeconds echo date('Y-m-d H:i:s').' 完成'."\n"; } + + //系统降身价 + public function system_downgrade(){ + //获取系统信息 + $down_market_value = explode(',',get_system_config_value('down_market_value')); + if($down_market_value){ + $day = $down_market_value[0]; + $market_value = $down_market_value[1]; + }else{ + $day = 0; + $market_value = 0; + } + + $num = 0; + if($day && $market_value){ + //查询每个用户的身价 + $user_market_value = db::name('user')->field('id,market_value')->select(); + if($user_market_value){ + foreach ($user_market_value as $value){ + if($value['market_value'] > 1){ + //获取他的降级时间 + $down_time = db::name('vs_user_market_value_log')->where(['user_id' => $value['id'],'type' =>1]) + ->order('id desc')->value('createtime'); + + //如果没有降级记录,则使用当前时间作为起始时间 + if(empty($down_time)){ + $down_time = time(); + } + + //检查是否到了降级时间 + if(time() - $down_time >= $day*86400){ + //开始降身价 + db::startTrans(); + try { + $market_values = max($value['market_value'] - $market_value, 1); + $update_result = db::name('user')->where('id', $value['id'])->update(['market_value' => $market_values]); + + if($update_result) { + $data = [ + 'user_id' => $value['id'], + 'before' => $value['market_value'], + 'change_value' => $market_value, + 'afterwards' => $market_values, + 'type' => 1, + 'createtime' => time() + ]; + $res = db::name('vs_user_market_value_log')->insert($data); + + if($res){ + $num += 1; + db::commit(); + }else{ + db::rollback(); + \think\Log::error("系统降身价失败: 插入日志失败 user_id={$value['id']}"); + } + } else { + db::rollback(); + \think\Log::error("系统降身价失败: 更新用户身价失败 user_id={$value['id']}"); + } + } catch (\Exception $e) { + db::rollback(); + \think\Log::error("系统降身价异常: " . $e->getMessage() . " user_id={$value['id']}"); + } + } + } + } + } + } + echo "系统降身价完成:".$num."\n"; + } + + } \ No newline at end of file diff --git a/application/cron/controller/PerformPerSecond.php b/application/cron/controller/PerformPerSecond.php index 4ec7988d..cfbd1c9a 100644 --- a/application/cron/controller/PerformPerSecond.php +++ b/application/cron/controller/PerformPerSecond.php @@ -51,10 +51,6 @@ class PerformPerSecond $this->sign_room_time_end(); echo "\n"; - echo "系统降身价:\n"; - $this->system_downgrade(); - echo "\n"; - echo "公会会员结算比例申请过期处理:\n"; $this->user_ratio_up_apply_timeout(); echo "\n"; @@ -374,72 +370,7 @@ class PerformPerSecond } } - //系统降身价 - public function system_downgrade(){ - //获取系统信息 - $down_market_value = explode(',',get_system_config_value('down_market_value')); - if($down_market_value){ - $day = $down_market_value[0]; - $market_value = $down_market_value[1]; - }else{ - $day = 0; - $market_value = 0; - } - if($day && $market_value){ - //查询每个用户的身价 - $user_market_value = db::name('user')->field('id,market_value')->select(); - if($user_market_value){ - foreach ($user_market_value as $value){ - if($value['market_value'] > 1){ - //获取他的降级时间 - $down_time = db::name('vs_user_market_value_log')->where(['user_id' => $value['id'],'type' =>1]) - ->order('id desc')->value('createtime'); - - //如果没有降级记录,则使用当前时间作为起始时间 - if(empty($down_time)){ - $down_time = time(); - } - - //检查是否到了降级时间 - if(time() - $down_time >= $day*86400){ - //开始降身价 - db::startTrans(); - try { - $market_values = max($value['market_value'] - $market_value, 1); - $update_result = db::name('user')->where('id', $value['id'])->update(['market_value' => $market_values]); - - if($update_result) { - $data = [ - 'user_id' => $value['id'], - 'before' => $value['market_value'], - 'change_value' => $market_value, - 'afterwards' => $market_values, - 'type' => 1, - 'createtime' => time() - ]; - $res = db::name('vs_user_market_value_log')->insert($data); - - if($res){ - db::commit(); - }else{ - db::rollback(); - \think\Log::error("系统降身价失败: 插入日志失败 user_id={$value['id']}"); - } - } else { - db::rollback(); - \think\Log::error("系统降身价失败: 更新用户身价失败 user_id={$value['id']}"); - } - } catch (\Exception $e) { - db::rollback(); - \think\Log::error("系统降身价异常: " . $e->getMessage() . " user_id={$value['id']}"); - } - } - } - } - } - } - } //公会会员结算比例申请过期处理 public function user_ratio_up_apply_timeout(){ //超过24小时的数据 From f2dc3489940eda97b3dfd1d94345f0b604d28194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Thu, 18 Dec 2025 18:17:00 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=99=8D=E8=BA=AB?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cron/controller/DaySeconds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/cron/controller/DaySeconds.php b/application/cron/controller/DaySeconds.php index c67c01cd..bd6027c3 100644 --- a/application/cron/controller/DaySeconds.php +++ b/application/cron/controller/DaySeconds.php @@ -92,7 +92,7 @@ class DaySeconds //如果没有降级记录,则使用当前时间作为起始时间 if(empty($down_time)){ - $down_time = time(); + $down_time = 0; } //检查是否到了降级时间 From f1e9b8247160ec2e1fded790a26056b429a0124e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Thu, 18 Dec 2025 18:21:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=99=8D=E8=BA=AB?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Cron.php | 1 - application/cron/controller/DaySeconds.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/application/api/controller/Cron.php b/application/api/controller/Cron.php index 278c5820..83b187cc 100644 --- a/application/api/controller/Cron.php +++ b/application/api/controller/Cron.php @@ -14,7 +14,6 @@ class Cron * pk发起10秒后无应答拒绝 * 提现云账号订单状态查询 * 签约房时间结束处理 - * 系统降身价 * 签约到期处理 */ public function PerformPerSecond() diff --git a/application/cron/controller/DaySeconds.php b/application/cron/controller/DaySeconds.php index bd6027c3..baf1dfca 100644 --- a/application/cron/controller/DaySeconds.php +++ b/application/cron/controller/DaySeconds.php @@ -16,7 +16,7 @@ class DaySeconds function index() { echo "清除房间热度值:\n"; -// $this->clear_room_today_hot_value();//0点以后房间热度值清零 + $this->clear_room_today_hot_value();//0点以后房间热度值清零 echo "\n"; echo "清除房间离线超24小时的用户:\n"; From 7323ed202871ec844755eeca126ceacf193b9b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Thu, 18 Dec 2025 18:52:41 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=BB=83=E6=AD=8C=E6=88=BF=E6=8A=B1?= =?UTF-8?q?=E9=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/RoomPit.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/application/api/model/RoomPit.php b/application/api/model/RoomPit.php index ba8041d8..8b0e100c 100644 --- a/application/api/model/RoomPit.php +++ b/application/api/model/RoomPit.php @@ -624,7 +624,7 @@ class RoomPit extends Model } //同意上麦 - public function agree_pit($user_id,$room_id,$apply_id) + public function agree_pit($user_id,$room_id,$apply_id,$tpe = 0) { if(!$room_id){ return ['code' => 0, 'msg' => '请选择房间', 'data' => null]; @@ -712,11 +712,14 @@ class RoomPit extends Model //结束循环 break; } - //删除他的申请上麦 - $reslut = db::name('vs_room_pit_apply')->where(['user_id' => $value, 'room_id' => $room_id, 'status' => 0])->delete(); - if (!$reslut) { - continue; + if($tpe == 0){ + //删除他的申请上麦 + $reslut = db::name('vs_room_pit_apply')->where(['user_id' => $value, 'room_id' => $room_id, 'status' => 0])->delete(); + if (!$reslut) { + continue; + } } + $ompit = db::name('vs_room_pit_simulate')->insert( [ 'room_id' => $room_id, @@ -1048,6 +1051,14 @@ class RoomPit extends Model if($room_type == 7 && ($pit_number == 7 || $pit_number == 8)){ return ['code' => 0, 'msg' => '互娱房 不能上7、8号麦位', 'data' => null]; } + $room_label = db::name('vs_room')->where(['id' => $room_id])->value('label_id'); + if($room_type == 1 && $room_label == 2){ + $res = model('RoomPit')->agree_pit($user_id, $room_id, $accept_user_id,1); + if($res['code'] == 0){ + return ['code' => 0, 'msg' => $res['msg'], 'data' => null]; + } + return ['code' => 1, 'msg' => '操作成功', 'data' => null]; + } if($room_type == 10){ if($pit_number == 1){ //查询主持邀请列表是否是有数据 From b6e669ac9d4f57568d0dcb89593679ae4a198e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Thu, 18 Dec 2025 19:00:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=BB=83=E6=AD=8C=E6=88=BF=E6=8A=B1?= =?UTF-8?q?=E9=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/RoomPit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/api/model/RoomPit.php b/application/api/model/RoomPit.php index 8b0e100c..21c4655d 100644 --- a/application/api/model/RoomPit.php +++ b/application/api/model/RoomPit.php @@ -1052,7 +1052,7 @@ class RoomPit extends Model return ['code' => 0, 'msg' => '互娱房 不能上7、8号麦位', 'data' => null]; } $room_label = db::name('vs_room')->where(['id' => $room_id])->value('label_id'); - if($room_type == 1 && $room_label == 2){ + if($room_type == 1 && $room_label == 2 && !$pit_number){ $res = model('RoomPit')->agree_pit($user_id, $room_id, $accept_user_id,1); if($res['code'] == 0){ return ['code' => 0, 'msg' => $res['msg'], 'data' => null];