From fcf19e80a4c343acc9ae6aea9268fafe58ad15b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=92=8A?= Date: Tue, 6 Jan 2026 14:41:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=92=E5=90=A7=E6=88=BF=EF=BC=9A->=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=8E=A5=E5=8F=A3=E6=8F=90=E4=BA=A4-bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/GiftNew.php | 4 +- application/api/model/GiftNew.php | 14 +-- application/api/model/Guild.php | 4 +- application/cron/controller/Test.php | 141 +++++++++++++++---------- 4 files changed, 99 insertions(+), 64 deletions(-) diff --git a/application/api/controller/GiftNew.php b/application/api/controller/GiftNew.php index 0edda5ee..8a278d1c 100644 --- a/application/api/controller/GiftNew.php +++ b/application/api/controller/GiftNew.php @@ -32,8 +32,8 @@ class GiftNew extends BaseCom */ public function set_custom_gift(){ $gift_id = input('gift_id', 0); - $new_gift_name = input('new_gift_name', ''); - $reslut = model('GiftNew')->set_custom_gift($this->uid, $gift_id, $new_gift_name); + $gift_remark_name = input('gift_remark_name', ''); + $reslut = model('GiftNew')->set_custom_gift($this->uid, $gift_id, $gift_remark_name); return V($reslut['code'], $reslut['msg'], $reslut['data']); } /* diff --git a/application/api/model/GiftNew.php b/application/api/model/GiftNew.php index 0c3a5aca..02201f4b 100644 --- a/application/api/model/GiftNew.php +++ b/application/api/model/GiftNew.php @@ -106,8 +106,8 @@ class GiftNew extends Model foreach ($list as $key =>&$v) { $v['is_lock'] = $is_lock; if($label==14){ //酒吧房自定义礼物 自定义 - $new_gift_name =db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$v['gift_id'],'delete_time'=>0])->value('new_gift_name'); - $v['new_gift_name'] = $new_gift_name ?? ''; + $gift_remark_name =db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$v['gift_id'],'delete_time'=>0])->value('gift_remark_name'); + $v['gift_remark_name'] = $gift_remark_name ?? ''; } } } @@ -120,19 +120,19 @@ class GiftNew extends Model } //自定义礼物设置 - public function set_custom_gift($user_id, $gift_id, $new_gift_name){ + public function set_custom_gift($user_id, $gift_id, $gift_remark_name){ $gift_info = db::name('vs_gift')->where(['gid' => $gift_id, 'delete_time' => 0, 'is_show' => 1])->find(); if(!$gift_info){ return ['code' => 0, 'msg' => '礼物不存在','data' =>null]; } $user_custom_gift = db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$gift_id])->find(); if($user_custom_gift){ - db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$gift_id])->update(['new_gift_name'=>$new_gift_name,'updatetime'=>time()]); + db::name('vs_user_custom_gift')->where(['user_id' => $user_id,'gift_id'=>$gift_id])->update(['gift_remark_name'=>$gift_remark_name,'updatetime'=>time()]); }else{ db::name('vs_user_custom_gift')->insert([ 'user_id' => $user_id, 'gift_id'=>$gift_id, - 'new_gift_name'=>$new_gift_name, + 'gift_remark_name'=>$gift_remark_name, 'createtime'=>time() ]); } @@ -143,8 +143,8 @@ class GiftNew extends Model $list = db::name('vs_user_custom_gift') ->alias('a') ->join('vs_gift b','a.gift_id = b.gid') - ->field('a.id,b.gid as gift_id,a.new_gift_name,b.gift_name,b.base_image,b.gift_price,b.icon') - ->where(['a.user_id' => $user_id,'a.delete_time'=>0,'a.new_gift_name'=>['<>','']]) + ->field('a.id,b.gid as gift_id,a.gift_remark_name,b.gift_name,b.base_image,b.gift_price,b.icon') + ->where(['a.user_id' => $user_id,'a.delete_time'=>0,'a.gift_remark_name'=>['<>','']]) ->order('a.sort desc ,a.updatetime desc') ->select(); return ['code' => 1, 'msg' => '获取成功','data' =>$list]; diff --git a/application/api/model/Guild.php b/application/api/model/Guild.php index 217f31a3..767036a0 100644 --- a/application/api/model/Guild.php +++ b/application/api/model/Guild.php @@ -166,7 +166,7 @@ class Guild extends Model } //是否有房间 $rid = 0; - $room_info = db::name('vs_room')->where('user_id', $user_id)->find(); + $room_info = db::name('vs_room')->where(['user_id'=>$user_id,'delete_time'=>0,'type_id'=>['<>',6]])->find(); if($room_info){ $rid = $room_info['id']; } @@ -1167,7 +1167,7 @@ class Guild extends Model } //是否有房间 $rid = 0; - $room_info = db::name('vs_room')->where('user_id', $user_id)->find(); + $room_info = db::name('vs_room')->where(['user_id'=>$user_id,'delete_time'=>0,'type_id'=>['<>',6]])->find(); if($room_info){ $rid = $room_info['id']; } diff --git a/application/cron/controller/Test.php b/application/cron/controller/Test.php index 383ca1bd..766282b2 100644 --- a/application/cron/controller/Test.php +++ b/application/cron/controller/Test.php @@ -28,8 +28,10 @@ class Test // $this->clean_guild_flow(); // $this->giftSend(); -// $this->createGuildSubsidyDataNewNew(); -// $this->task_coin_count(); + // $this->createGuildSubsidyDataNewNew(); + // $this->task_coin_count(); + $this->createGuildSubsidyDataNew(); + // $this->repair_guild_room_data(); } @@ -722,6 +724,7 @@ class Test $guild_user_data = db::name('vs_guild_user')->where('guild_id', $value['id'])->where(['apply_time'=>['>',0],'status'=>1,'room_id'=>['>',0]])->field('room_id,apply_time,quit_time')->select(); $transaction = 0; foreach ($guild_user_data as $k => $v) { + $week_start_time_seach = $week_start_time; $week_end_time_seach = $week_end_time; if($v['apply_time'] && $week_end_time_seach < $v['apply_time']){ @@ -745,9 +748,9 @@ class Test if($transaction > 0){ //判断是否已经生成过 - if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) { - continue; - } + // if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) { + // continue; + // } //获取补贴配置 $config = db::name('vs_guild_subsidy_config')->where(['status' => 1])->order('end_amount desc')->select(); //配置查询 if (!$config) { @@ -799,8 +802,8 @@ class Test // $week_start_time = strtotime('2025-12-08'); // $week_end_time = strtotime('2025-12-15'); - $week_start_time = strtotime('2025-12-22'); - $week_end_time = strtotime('2025-12-31'); + // $week_start_time = strtotime('2025-12-22'); + // $week_end_time = strtotime('2025-12-31'); //获取上周时间 $time_value = date('o-W', $week_start_time); @@ -927,42 +930,42 @@ class Test - $old_nobility_info = db::name('vs_nobility') - ->field('lid,name,pay_price,pay_coin') - ->where('delete_time', 0) - ->where('lid',7) - ->find(); - $nobility_info = db::name('vs_nobility') - ->field('lid,name,image,pay_price,renew_price,day,power_ids') - ->where('delete_time', 0) - ->where('lid', 8) - ->find(); - $old_end_time = 1774848342; - $pay_time = 1767278104; - $surplus_time = $old_end_time - $pay_time; + $old_nobility_info = db::name('vs_nobility') + ->field('lid,name,pay_price,pay_coin') + ->where('delete_time', 0) + ->where('lid',7) + ->find(); + $nobility_info = db::name('vs_nobility') + ->field('lid,name,image,pay_price,renew_price,day,power_ids') + ->where('delete_time', 0) + ->where('lid', 8) + ->find(); + $old_end_time = 1774848342; + $pay_time = 1767278104; + $surplus_time = $old_end_time - $pay_time; // echo $surplus_time; - if($surplus_time > 0){ - //小时 - $surplus_time_hour = floor($surplus_time / 3600); //向下取整 + if($surplus_time > 0){ + //小时 + $surplus_time_hour = floor($surplus_time / 3600); //向下取整 // echo $surplus_time_hour;die; // echo ($old_nobility_info['pay_price'] / $nobility_info['day']) / 24;die; - $price = $nobility_info['pay_price'] - bcmul($surplus_time_hour * (($old_nobility_info['pay_price'] / $nobility_info['day']) / 24),1,2); + $price = $nobility_info['pay_price'] - bcmul($surplus_time_hour * (($old_nobility_info['pay_price'] / $nobility_info['day']) / 24),1,2); - //使用时间 - $use_time = $old_nobility_info['1767072342'] - time(); - $price = $nobility_info['pay_price'] - $old_nobility_info['pay_price'] + ((($old_nobility_info['pay_price'] / $nobility_info['day']) / 24) * $use_time); - //价格= - //一小时的价格算 + //使用时间 + $use_time = $old_nobility_info['1767072342'] - time(); + $price = $nobility_info['pay_price'] - $old_nobility_info['pay_price'] + ((($old_nobility_info['pay_price'] / $nobility_info['day']) / 24) * $use_time); + //价格= + //一小时的价格算 - } + } // $end_time = time() + $nobility_info['day'] * 86400; - echo $price; + echo $price; // } - // $re = model('api/Decorate')->pay_decorate(20150,46,30,9); + // $re = model('api/Decorate')->pay_decorate(20150,46,30,9); // print_r($re);die; } @@ -971,10 +974,17 @@ class Test // $etime = "2025-12-29 10:30:00"; // $stime = "2025-12-29 00:00:00"; // $etime = "2025-12-30 04:00:00"; - $stime = "2025-12-29 00:00:00"; - $etime = "2026-01-05 00:00:00"; + // $stime = "2025-12-29 00:00:00"; + // $etime = "2026-01-05 00:00:00"; // $stime = "2025-12-22 00:00:00"; // $etime = "2025-12-29 00:00:00"; + + // $stime = "2025-12-29 00:00:00"; + // $etime = "2025-12-31 01:14:09"; + + $stime = "2025-12-31 01:14:09"; + $etime = "2026-01-05 00:00:00"; + //获取所有已领取的任务奖励礼包 $where = []; if(!empty($stime)){ @@ -986,25 +996,25 @@ class Test if(!empty($stime) && !empty($etime)){ $where['a.createtime'] = ['between', [strtotime($stime), strtotime($etime)]]; } - if(!empty($etime) && strtotime($etime)<="1767038400"){//2025-12-30 04:00:00 - $tasks_bag_details = db::name('vs_gift_bag_receive_log') - ->alias('a') - ->join('vs_gift_bag_detail b', 'a.parent_id=b.id') - ->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold') - ->where(['b.type'=>['in', [1,2]]]) - ->whereBetween('a.gift_bag_id', [18, 51]) - ->where($where) - ->select(); - }else{ - $tasks_bag_details = db::name('vs_gift_bag_receive_tasks_log') - ->alias('a') - ->join('vs_gift_bag_detail b', 'a.parent_id=b.id') - ->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold') - ->where(['b.type'=>['in', [1,2]]]) - ->whereBetween('a.gift_bag_id', [18, 51]) - ->where($where) - ->select(); - } + // if(!empty($etime) && strtotime($etime)<="1767038400"){//2025-12-30 04:00:00 + // $tasks_bag_details = db::name('vs_gift_bag_receive_log') + // ->alias('a') + // ->join('vs_gift_bag_detail b', 'a.parent_id=b.id') + // ->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold') + // ->where(['b.type'=>['in', [1,2]]]) + // ->whereBetween('a.gift_bag_id', [18, 51]) + // ->where($where) + // ->select(); + // }else{ + $tasks_bag_details = db::name('vs_gift_bag_receive_tasks_log') + ->alias('a') + ->join('vs_gift_bag_detail b', 'a.parent_id=b.id') + ->field('a.createtime,b.type,b.foreign_id,b.quantity,b.gold') + ->where(['b.type'=>['in', [1,2]]]) + ->whereBetween('a.gift_bag_id', [18, 51]) + ->where($where) + ->select(); + // } $total_reward_price = 0; foreach ($tasks_bag_details as $detail){ if($detail['type'] == 1){ @@ -1016,4 +1026,29 @@ class Test } echo $total_reward_price; } + + //修复公会房间数据 + public function repair_guild_room_data(){ + $guild_user_data = db::name('vs_guild_user')->where(['apply_time'=>['>',0],'status'=>1,'room_id'=>['>',0]])->field('id,user_id,room_id,guild_id,apply_time,quit_time')->select(); + $num = 0; + foreach ($guild_user_data as $k => $v) { + $room_info = db::name('vs_room')->where('id',$v['room_id'])->field('id,type_id')->find(); + if($room_info['type_id'] == 6){ + $troom_info = db::name('vs_room')->where(['user_id'=>$v['user_id'],'delete_time'=>0,'type_id'=>['<>',6]])->find(); + $rid =0; + if($troom_info){ + $rid = $troom_info['id']??0; + } + $guild_name = db::name('vs_guild')->where('id',$v['guild_id'])->value('guild_name'); + echo "公会名称:".$guild_name." 公会Id:".$v['guild_id']." 关系Id:".$v['id']."错误房间Id:".$v['room_id']."正确房间Id:".$rid."\n"; + + // $re = db::name('vs_guild_user')->where('id',$v['id'])->update(['room_id'=>$rid]); + // if($re){ + // $num++; + // } + } + + } + echo "修改完成 共:".$num; + } } \ No newline at end of file