From a1f0578c29415a3e96a3f758a161808fb74d81ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 10:35:12 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E7=82=B9=E5=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/SingerSong.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/adminapi/controller/SingerSong.php b/application/adminapi/controller/SingerSong.php index f76bf50..622a4f3 100644 --- a/application/adminapi/controller/SingerSong.php +++ b/application/adminapi/controller/SingerSong.php @@ -179,15 +179,15 @@ class SingerSong extends adminApi return V(0, '请填写房间ID'); } if($type==1){ - $where['createtime'] = ['between', [strtotime(date('Y-m-d')), strtotime(date('Y-m-d', strtotime('+1 day')))]]; + $where['o.createtime'] = ['between', [strtotime(date('Y-m-d')), strtotime(date('Y-m-d', strtotime('+1 day')))]]; }elseif($type==2){ - $where['createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-7 day'))), strtotime(date('Y-m-d'))]]; + $where['o.createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-7 day'))), strtotime(date('Y-m-d'))]]; }elseif($type==3){ - $where['createtime'] = ['between', [strtotime(date('Y-m-01')), strtotime(date('Y-m-t', strtotime(date('Y-m-01'))))]]; + $where['o.createtime'] = ['between', [strtotime(date('Y-m-01')), strtotime(date('Y-m-t', strtotime(date('Y-m-01'))))]]; }elseif($type==4){ - $where['createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-1 day'))), strtotime(date('Y-m-d'))]]; + $where['o.createtime'] = ['between', [strtotime(date('Y-m-d', strtotime('-1 day'))), strtotime(date('Y-m-d'))]]; } - $count = db::name('vs_song_log')->where($where)->count(); + $count = db::name('vs_song_log')->alias('o')->where($where)->count(); $list = db::name('vs_song_log') ->alias('o') ->join('user u', 'o.user_id=u.id') From 5f167b4557a78101f64826ab02b1023c0235d994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 10:43:38 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E7=82=B9=E5=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/SingerSong.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/adminapi/controller/SingerSong.php b/application/adminapi/controller/SingerSong.php index 622a4f3..667747d 100644 --- a/application/adminapi/controller/SingerSong.php +++ b/application/adminapi/controller/SingerSong.php @@ -190,10 +190,10 @@ class SingerSong extends adminApi $count = db::name('vs_song_log')->alias('o')->where($where)->count(); $list = db::name('vs_song_log') ->alias('o') - ->join('user u', 'o.user_id=u.id') - ->join('vs_singer_song r', 'o.singer_song_id=r.id') - ->join('user uu', 'r.user_id=u.id') - ->join('vs_gift g', 'r.gift_id=g.gid') + ->join('user u', 'o.user_id=u.id', 'left') + ->join('vs_singer_song r', 'o.singer_song_id=r.id', 'left') + ->join('user uu', 'r.user_id=u.id', 'left') + ->join('vs_gift g', 'r.gift_id=g.gid', 'left') ->field('o.*,u.nickname boss_nickname,u.user_code boss_user_code,r.song_name,r.gift_num,uu.nickname singer_nickname,uu.user_code singer_user_code,g.gift_name,g.gift_price') ->where($where) ->page($page, $page_limit) From 2094ee35f25e0f3fd579404ea781013ac1ed4c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 10:46:10 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E7=82=B9=E5=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/SingerSong.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/adminapi/controller/SingerSong.php b/application/adminapi/controller/SingerSong.php index 667747d..36a6a0d 100644 --- a/application/adminapi/controller/SingerSong.php +++ b/application/adminapi/controller/SingerSong.php @@ -90,8 +90,8 @@ class SingerSong extends adminApi $count = db::name('vs_singer_song')->where($where)->count(); $list = db::name('vs_singer_song') ->alias('o') - ->join('user u', 'o.user_id=u.id') - ->join('vs_gift g', 'o.gift_id=g.gid') + ->join('user u', 'o.user_id=u.id', 'left') + ->join('vs_gift g', 'o.gift_id=g.gid', 'left') ->field('o.*,u.nickname,u.user_code,g.gift_name,g.gift_price') ->where($where) ->page($page, $page_limit) From cb9c901b35bbaf80efcdf84b14a1013e48a0448f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 14:49:38 +0800 Subject: [PATCH 04/14] =?UTF-8?q?CP=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/UserCp.php | 16 +++ application/api/model/GiveGift.php | 4 + application/api/model/SingerSong.php | 7 +- application/api/model/UserCp.php | 137 +++++++++++++++++++++++++- 4 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 application/api/controller/UserCp.php diff --git a/application/api/controller/UserCp.php b/application/api/controller/UserCp.php new file mode 100644 index 0000000..f82e153 --- /dev/null +++ b/application/api/controller/UserCp.php @@ -0,0 +1,16 @@ +tasks_complete($uid,3); } + //cp检测 + model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id); } //增加房间火热值hot_value @@ -859,6 +861,8 @@ class GiveGift extends Model //直播间送礼物 每日任务 model('DailyTasks')->tasks_complete($uid,3); } + //cp检测 + model('api/UserCp')->checkGift($uid, $give_gift, $to_id, $from_id); } //增加房间火热值hot_value diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index 3ff2ba1..0977386 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -69,6 +69,11 @@ class SingerSong extends Model */ public function singerAddSong($user_id, $song_name, $gift_id, $gift_num) { + //查询是否是认证歌手 + $res = db::name('vs_singer')->where(['user_id' => $user_id])->find(); + if (!$res || $res['status'] != 1) { + return ['code' => 0, 'msg' => '请先认证歌手', 'data' => null]; + } //查询是否提交过歌曲 $res = db::name('vs_singer_song')->where(['user_id' => $user_id, 'song_name' => $song_name])->find(); if ($res) { @@ -233,7 +238,7 @@ class SingerSong extends Model $exp_coin = round($coin / get_system_config_value('singer_coin_exp'), 2); $exps = $exp + $exp_coin; //查询等级 - $level = db::name('vs_singer_level')->where(['exp' => ['<=', $exps]])->order('exp desc')->find(); + $level = db::name('vs_singer_level')->where(['change_value' => ['<=', $exps]])->order('exp desc')->find(); if ($level) { db::name('vs_singer')->where(['id' => $is_singer['id']])->update(['exp' => $exps,'level' => $level['level']]); } diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index 8c17bf7..cf189f3 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -2,13 +2,144 @@ namespace app\api\model; +use think\Db; use think\Model; class UserCp extends Model { - //用户关系卡(亲密拍)、关系位(真爱拍 ->有电影房) - public function user_cp_list($uid,$user_id) - { + /* + * 检测是否赠送的Cp礼物 + * @param $from_user_id 送礼用户ID + * @param $gift_id 礼物ID + * @param $to_user_id 接收用户ID + * @param $room_id 房间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')); + 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(); + 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; + } + + //查询收礼人有没有给送礼人送过cp礼物 + $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空间, + $data = [ + 'from_user_id' => $from_user_id, + 'to_user_id' => $to_user_id, + 'gift_id' => $gift_id, + 'createtime' => time(), + 'status' => 1 + ]; + Db::name('user_cp_find')->insert($data); + //修改状态 + Db::name('user_cp_find')->where(['id' => $res['id']])->update(['status' => 1]); + //创建Cp空间 + + $data = [ + 'user_id1' => $from_user_id, + 'user_id2' => $to_user_id, + 'createtime' => time(), + 'status' => 1,//1-已建立Cp空间,2-已取消 + 'level' => 1, + //经验值 + 'exp' => 0, + ]; + Db::name('user_cp_zone')->insert($data); + + //给前端推送 + $text = [ + 'text' => '组建Cp' + ]; + //聊天室推送系统消息 + model('Chat')->sendMsg(1081,$room_id,$text); + }else{//创建推送信息2:表达心动信号 + //查询是否有相应的Cp空间 + $ress = Db::name('user_cp_find') + ->where(['status' => ['in',[0,1]]]) + ->whereOr(['from_user_id' => $from_user_id]) + ->whereOr(['to_user_id' => $from_user_id]) + ->select(); + if($ress){ + //把状态改为2 status:0-待回应,1-建交成功,2-已取消, + foreach ($ress as $v){ + Db::name('user_cp_find')->where(['id' => $v['id']])->update(['status' => 2]); + } + } + $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){ + //修改状态 + Db::name('user_cp_zone')->where(['id' => $rees['id']])->update(['status' => 2]); + } + + $data = [ + 'from_user_id' => $from_user_id, + 'to_user_id' => $to_user_id, + 'gift_id' => $gift_id, + 'createtime' => time(), + ]; + Db::name('user_cp_find')->insert($data); + //给前端推送 + $text = [ + 'text' => '有心动信号' + ]; + //聊天室推送系统消息 + model('Chat')->sendMsg(1080,$room_id,$text); + } + return true; + } + + + /* + * 送Cp礼物 增加Cp 经验 判断是否升级 + * @param $from_user_id 送礼用户ID + * @param $to_user_id 接收用户ID + * @param $gift_id 礼物ID + * @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) + { + $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); + $yuan_exp = Db::name('user_cp_zone')->where(['id' => $cp_zone_id])->value('exp'); + + //添加一个记录 + $datas = [ + 'room_id' => $room_id, + 'from_user_id' => $from_user_id, + 'to_user_id' => $to_user_id, + 'gift_id' => $gift_id, + 'cp_zone_id' => $cp_zone_id, + 'exp' => $exp, + 'exp_total' => $yuan_exp + $exp, + 'createtime' => time(), + ]; + Db::name('user_cp_gift_log')->insert($datas); + //判断是否升级 + $level = Db::name('user_cp_level')->where(['exp' => ['<=', $yuan_exp + $exp]])->order('exp desc')->value('level'); + if($level){ + //修改Cp空间等级 + $data['level'] = $level; + } + $data['exp'] = $yuan_exp + $exp; + Db::name('user_cp_zone')->where(['id' => $cp_zone_id])->update($data); + return true; } } \ No newline at end of file From 2fd11dcab76c8dac6e900ed664d170a382631f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 15:26:04 +0800 Subject: [PATCH 05/14] =?UTF-8?q?CP=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/UserCp.php | 6 ++++-- application/api/model/Chat.php | 6 ++++++ application/api/model/UserCp.php | 30 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/application/api/controller/UserCp.php b/application/api/controller/UserCp.php index f82e153..3a363a2 100644 --- a/application/api/controller/UserCp.php +++ b/application/api/controller/UserCp.php @@ -8,9 +8,11 @@ use think\Db; class UserCp extends BaseCom { - //检测是否送了一个cp礼物 - public function checkCp() + //Cp 空间 + public function cpZone() { + $reslut = model('UserCp')->cpZone($this->uid); + return V($reslut['code'], $reslut['msg'], $reslut['data']); } } \ No newline at end of file diff --git a/application/api/model/Chat.php b/application/api/model/Chat.php index 3f4f2d8..d231040 100644 --- a/application/api/model/Chat.php +++ b/application/api/model/Chat.php @@ -128,6 +128,12 @@ class Chat extends Model //歌曲发生变化 // SongChange = 1070, + //CP房间推送信息 + // CP房间表达心动信号 + // CPRoomExpression = 1080, + // CP组建成功 + // CPRoomBuildSuccess = 1081, + diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index cf189f3..95aa59c 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -142,4 +142,34 @@ class UserCp extends Model Db::name('user_cp_zone')->where(['id' => $cp_zone_id])->update($data); return true; } + + + /* + * Cp空间 + * @param $user_id 用户ID + */ + public function cpZone($user_id) + { + $res = Db::name('user_cp_zone')->where(['user_id1' => $user_id,'status' => 1])->select(); + if(!$res){ + $res = Db::name('user_cp_zone')->where(['user_id2' => $user_id,'status' => 1])->select(); + } + if($res){ + $res['user_info1'] = Db::name('user')->where(['id' => $res['user_id1']])->field('id user_id,nickname,avatar')->find(); + $res['user_info2'] = Db::name('user')->where(['id' => $res['user_id2']])->field('id user_id,nickname,avatar')->find(); + //升下一级所需经验值 + $next_level_exp = Db::name('user_cp_level')->where(['level' => ['>',$res['level']]])->order('level asc')->value('exp'); + $res['next_level_exp'] = $next_level_exp - $res['exp']; + //送礼记录 + $res['gift_log'] = Db::name('user_cp_gift_log')->where(['cp_zone_id' => $res['id']])->select(); + foreach ($res['gift_log'] as &$v){ + $v['gift_name'] = Db::name('vs_gift')->where(['gid' => $v['gift_id']])->value('gift_name'); + $v['from_user_info'] = Db::name('user')->where(['id' => $v['from_user_id']])->field('id user_id,nickname,avatar')->find(); + $v['to_user_info'] = Db::name('user')->where(['id' => $v['to_user_id']])->field('id user_id,nickname,avatar')->find(); + } + return ['code' => 1, 'msg' => '成功', 'data' => $res ]; + }else{ + return ['code' => 0, 'msg' => '暂无Cp空间', 'data' => null]; + } + } } \ No newline at end of file From ce9895d43d8f14f7241dd9feb2ecc5a6be327599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 15:33:23 +0800 Subject: [PATCH 06/14] =?UTF-8?q?CP=20=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/UserCp.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/application/api/model/UserCp.php b/application/api/model/UserCp.php index 95aa59c..27be9ef 100644 --- a/application/api/model/UserCp.php +++ b/application/api/model/UserCp.php @@ -172,4 +172,24 @@ class UserCp extends Model return ['code' => 0, 'msg' => '暂无Cp空间', 'data' => null]; } } + + + /* + * 用户的Cp空间 + * @param $user_id 用户ID + */ + public function userCpZone($user_id) + { + $res = Db::name('user_cp_zone')->where(['user_id1' => $user_id,'status' => 1])->select(); + if(!$res){ + $res = Db::name('user_cp_zone')->where(['user_id2' => $user_id,'status' => 1])->select(); + } + if($res){ + $res['user_info1'] = Db::name('user')->where(['id' => $res['user_id1']])->field('id user_id,nickname,avatar')->find(); + $res['user_info2'] = Db::name('user')->where(['id' => $res['user_id2']])->field('id user_id,nickname,avatar')->find(); + return ['code' => 1, 'msg' => '成功', 'data' => $res ]; + }else{ + return ['code' => 0, 'msg' => '暂无Cp空间', 'data' => null]; + } + } } \ No newline at end of file From 2e7f0e84afd0941eaba3dae71eb5afdf8ebbf7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 16:03:51 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E6=AD=8C=E6=9B=B2=E5=88=97=E8=A1=A8=20?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=9C=89=E8=87=AA=E5=B7=B1=20=20=E4=B9=9F?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=82=B9=E8=87=AA=E5=B7=B1=E7=9A=84=E6=AD=8C?= =?UTF-8?q?=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/SingerSong.php | 3 ++- application/api/model/SingerSong.php | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/application/api/controller/SingerSong.php b/application/api/controller/SingerSong.php index d33f66b..71067bb 100644 --- a/application/api/controller/SingerSong.php +++ b/application/api/controller/SingerSong.php @@ -96,7 +96,8 @@ class SingerSong extends BaseCom if (!$room_id && !$user_id) { return V(0, '请选择房间或歌手'); } - $reslut = model('SingerSong')->getSong($user_id, $room_id, $page, $page_limit); + + $reslut = model('SingerSong')->getSong($this->uid, $user_id, $room_id, $page, $page_limit); return V($reslut['code'], $reslut['msg'], $reslut['data']); } diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index 0977386..dd1e2c0 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -100,7 +100,7 @@ class SingerSong extends Model * @param room_id 房间id * @param user_id 用户id */ - public function getSong($user_id, $room_id, $page, $page_limit) + public function getSong($uid, $user_id, $room_id, $page, $page_limit) { if($user_id > 0){ $count = db::name('vs_singer_song')->where(['user_id' => $user_id])->count(); @@ -109,6 +109,8 @@ class SingerSong extends Model //查询当前房间内麦位上的歌手 $room_singer = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => ['<',9]])->column('user_id'); if ($room_singer) { + //$uid 是当前自己,有自己就去除自己 + $room_singer = array_diff($room_singer, [$uid]); $count = db::name('vs_singer_song')->where(['user_id' => ['in', $room_singer]])->count(); $res = db::name('vs_singer_song')->where(['user_id' => ['in', $room_singer]])->page($page, $page_limit)->select(); }else{ @@ -143,6 +145,10 @@ class SingerSong extends Model if (!$song) { return ['code' => 0, 'msg' => '歌曲不存在', 'data' => null]; } + //查询歌曲是否是自己的 + if ($song['user_id'] != $user_id) { + return ['code' => 0, 'msg' => '不能点自己歌曲', 'data' => null]; + } //查询用户余额 $user_money = db::name('user_wallet')->where(['user_id' => $user_id])->value('coin'); $gift_price = db::name('vs_gift')->where(['gid' => $song['gift_id']])->value('gift_price'); From 21999cc62d27812fcabcba5336b21fffe585dd8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:05:21 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E7=82=B9=E4=B8=AA=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/SingerSong.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index dd1e2c0..16fc4f0 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -215,6 +215,7 @@ class SingerSong extends Model break; } $res = db::name('vs_song_log')->where($where)->order('sort desc')->page($page,$page_limit)->select(); + $count = db::name('vs_song_log')->where($where)->count(); if ($res) { foreach ($res as $k => $v) { $res[$k]['boss_nickname'] = db::name('user')->where(['id' => $v['user_id']])->value('nickname'); @@ -226,7 +227,7 @@ class SingerSong extends Model $res[$k]['nickname'] = db::name('user')->where(['id' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('user_id')])->value('nickname'); } } - return ['code' => 1, 'msg' => '获取成功', 'data' => $res]; + return ['code' => 1, 'msg' => '获取成功', 'data' => ['count' => $count, 'lists' =>$res]]; } From d19202765be048b7f6d6f78812e958895378d65b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:12:53 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=AD=8C=E6=89=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/SingerSong.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/application/adminapi/controller/SingerSong.php b/application/adminapi/controller/SingerSong.php index 36a6a0d..4ace46c 100644 --- a/application/adminapi/controller/SingerSong.php +++ b/application/adminapi/controller/SingerSong.php @@ -30,12 +30,9 @@ class SingerSong extends adminApi $where['ss.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]]; $wheres['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]]; } - if(isset($status)){ + if($status){ $where['ss.status'] = $status; $wheres['status'] = $status; - }else{ - $where['ss.status'] = 0; - $wheres['status'] = 0; } $count = db::name('vs_singer')->where($wheres)->count(); From 9aac2ff737ecf3d54eb8fa7d1222d5cabcc91092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:15:29 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E8=AE=A4=E8=AF=81=E6=AD=8C=E6=89=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/adminapi/controller/SingerSong.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/adminapi/controller/SingerSong.php b/application/adminapi/controller/SingerSong.php index 4ace46c..66d460c 100644 --- a/application/adminapi/controller/SingerSong.php +++ b/application/adminapi/controller/SingerSong.php @@ -33,6 +33,9 @@ class SingerSong extends adminApi if($status){ $where['ss.status'] = $status; $wheres['status'] = $status; + }else{ + $where = []; + $wheres = []; } $count = db::name('vs_singer')->where($wheres)->count(); From 6db7935df2547d57b2bf8420a2b0632b4370f5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:21:52 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=82=B9=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84=E6=AD=8C=E6=9B=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/SingerSong.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index 16fc4f0..fdf780d 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -146,7 +146,7 @@ class SingerSong extends Model return ['code' => 0, 'msg' => '歌曲不存在', 'data' => null]; } //查询歌曲是否是自己的 - if ($song['user_id'] != $user_id) { + if ($song['user_id'] == $user_id) { return ['code' => 0, 'msg' => '不能点自己歌曲', 'data' => null]; } //查询用户余额 From bd91f7c65c41712146091754d04f4011169a9273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:36:20 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=82=B9?= =?UTF-8?q?=E6=AD=8C=20=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/SingerSong.php | 12 ++++++++++++ application/api/model/SingerSong.php | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/application/api/controller/SingerSong.php b/application/api/controller/SingerSong.php index 71067bb..58fcf79 100644 --- a/application/api/controller/SingerSong.php +++ b/application/api/controller/SingerSong.php @@ -133,6 +133,18 @@ class SingerSong extends BaseCom } + //点歌各类型各个总数 + public function singerSongCount() + { + $room_id = input('room_id', 0); + if (!$room_id) { + return V(0, '请选择房间'); + } + $reslut = model('SingerSong')->singerSongCount($room_id); + return V($reslut['code'], $reslut['msg'], $reslut['data']); + } + + //歌曲置顶 public function singerSongTop() { diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index fdf780d..c84aaba 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -231,6 +231,27 @@ class SingerSong extends Model } + /* + * 点歌各类型各个总数 + * @param type 类型 1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表 + * @param room_id 房间id + */ + public function singerSongCount($room_id) + { + $where = [ + 'room_id' => $room_id + ]; + $res = [ + 'total' => db::name('vs_song_log')->where($where)->count(), + 'today' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d')), time()])->count(), + 'yesterday' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d', strtotime("-1 day"))), strtotime(date('Y-m-d'))])->count(), + 'week' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d', strtotime("-1 week"))), time()])->count(), + 'month' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-01')), strtotime(date('Y-m-t'))])->count() + ]; + return $res; + } + + /* * 歌手等级收礼升级 * @param user_id 用户id From a9cc4c392207b2d836cd985b71cc177d5cf3b090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:46:06 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=82=B9?= =?UTF-8?q?=E6=AD=8C=20=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/SingerSong.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index c84aaba..a1e4c24 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -242,6 +242,7 @@ class SingerSong extends Model 'room_id' => $room_id ]; $res = [ + 'already' => db::name('vs_song_log')->where($where)->where(['status' => ['in','1,0']])->count(), 'total' => db::name('vs_song_log')->where($where)->count(), 'today' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d')), time()])->count(), 'yesterday' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d', strtotime("-1 day"))), strtotime(date('Y-m-d'))])->count(), From 106602d625eefbde7740049abc4cc2604f77a166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:55:10 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E7=82=B9=E6=AD=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/SingerSong.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index a1e4c24..c64329e 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -267,7 +267,7 @@ class SingerSong extends Model $exp_coin = round($coin / get_system_config_value('singer_coin_exp'), 2); $exps = $exp + $exp_coin; //查询等级 - $level = db::name('vs_singer_level')->where(['change_value' => ['<=', $exps]])->order('exp desc')->find(); + $level = db::name('vs_singer_level')->where(['change_value' => ['<=', $exps]])->order('change_value desc')->find(); if ($level) { db::name('vs_singer')->where(['id' => $is_singer['id']])->update(['exp' => $exps,'level' => $level['level']]); }