diff --git a/application/adminapi/controller/GiveGift.php b/application/adminapi/controller/GiveGift.php index 02c1e90..200b6d6 100644 --- a/application/adminapi/controller/GiveGift.php +++ b/application/adminapi/controller/GiveGift.php @@ -1,7 +1,7 @@ =', strtotime($start_time)]; - } elseif(!empty($end_time)){ - $where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; + if (!empty($start_time) || !empty($end_time)) { + if (!empty($start_time) && !empty($end_time)) { + $where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]]; + } elseif (!empty($start_time)) { + $where['createtime'] = ['>=', strtotime($start_time)]; + } elseif (!empty($end_time)) { + $where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')]; + } } //礼物总数 $gift_num = db::name('vs_give_gift')->where($where)->sum('number'); @@ -73,24 +75,32 @@ class GiveGift extends adminApi $room_owner_earning = 0; // 获取所有送礼记录 - $list = db::name('vs_give_gift')->where($where)->order('id', 'desc')->select(); - $gift_ids = array_column($list, 'id'); - if (!empty($gift_ids)) { + $lists = db::name('vs_give_gift')->where($where)->order('id', 'desc')->page($page, $page_limit)->select(); + $count = db::name('vs_give_gift')->where($where)->count(); + $earning_list = []; + if(!empty($where)){ + $gift_ids = db::name('vs_give_gift')->where($where)->column('id'); + if (!empty($gift_ids)) { + // 批量获取所有收益记录 + $earning_list = db::name('vs_give_gift_ratio_log') + ->field('app_earning,gift_user_earning,room_owner_earning') + ->where('give_gift_id', 'in', $gift_ids) + ->order('id', 'desc') + ->select(); + } + }else{ // 批量获取所有收益记录 $earning_list = db::name('vs_give_gift_ratio_log') - ->where('give_gift_id', 'in', $gift_ids) + ->field('app_earning,gift_user_earning,room_owner_earning') ->order('id', 'desc') ->select(); - - // 计算总收益 - foreach ($earning_list as $earning) { - $app_earning += $earning['app_earning']; - $receive_earning += $earning['gift_user_earning']; - $room_owner_earning += $earning['room_owner_earning']; - } } - $count = count($list); - $lists = $this->array_pagination($list, $page, $page_limit); + // 计算总收益 + foreach ($earning_list as $earning) { + $app_earning += $earning['app_earning']; + $receive_earning += $earning['gift_user_earning']; + $room_owner_earning += $earning['room_owner_earning']; + } // 提取所有需要关联查询的ID $user_ids = array_merge( diff --git a/application/api/model/Banner.php b/application/api/model/Banner.php index 16adf4a..c3adf1e 100644 --- a/application/api/model/Banner.php +++ b/application/api/model/Banner.php @@ -9,11 +9,11 @@ class Banner extends Model { protected $table = 'fa_vs_banner'; public $ShowType = [ -// 1 => '引导页', -// 2 => '启动页', + 1 => '引导页', + 2 => '启动页', 3 => '首页轮播图', - 4 => '工会', - 5 => '帮助反馈' + 4 => '房间首页', + 5 => '工会列表页广告位' ]; //1纯展示 2文章 3房间 4个人主页 5外站' public $Type = [ diff --git a/application/api/model/BlindBoxTurntableGift.php b/application/api/model/BlindBoxTurntableGift.php index 095af11..06c2f3a 100644 --- a/application/api/model/BlindBoxTurntableGift.php +++ b/application/api/model/BlindBoxTurntableGift.php @@ -639,6 +639,8 @@ class BlindBoxTurntableGift extends Model } $room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name'); $FromUserInfo = Db::name('user')->where(['id'=>$blind_box_turntable['user_id']])->find(); + $FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($blind_box_turntable['user_id']);//财富图标 + $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($blind_box_turntable['user_id']);//魅力图标 $user_nickname = $FromUserInfo['nickname']; $textMessage = $user_nickname; $text_message = []; @@ -650,6 +652,7 @@ class BlindBoxTurntableGift extends Model $draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find(); $textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n"; $play_image[] = $draw_gift['play_image']; + $gift_names[] = $draw_gift['gift_name']; $text_message = $user_nickname . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n"; if($draw_gift['is_public_server'] == 1) { @@ -675,6 +678,7 @@ class BlindBoxTurntableGift extends Model 'ToUserInfos' => $ToUserInfos, 'GiftInfo' => [ 'play_image' => implode(',',$play_image), + 'gift_name' => implode(',',$gift_names), ], 'text' => $textMessage ]; diff --git a/application/api/model/BlindBoxTurntableGiftDraw.php b/application/api/model/BlindBoxTurntableGiftDraw.php index 7ee0d6d..815b7ec 100644 --- a/application/api/model/BlindBoxTurntableGiftDraw.php +++ b/application/api/model/BlindBoxTurntableGiftDraw.php @@ -886,11 +886,7 @@ class BlindBoxTurntableGiftDraw extends Model $cacheKey = 'xlh_config_13'; return Cache::remember($cacheKey, function() { $xlh_box = db::name('vs_gift_bag')->where('id', 13)->find(); - $return_data = $xlh_box ? json_decode($xlh_box['ext'], true) : []; - if($xlh_box){ - $return_data['gift_bag_name'] = $xlh_box['gift_bag_name']; - } - return $return_data; + return $xlh_box ? json_decode($xlh_box['ext'], true) : []; }, 3600); // 缓存1小时 } diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 2437c52..ad7c843 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -411,11 +411,15 @@ class GiveGift extends Model // 推送文字消息 (格式: 张三 送给 李四 趣味礼物 礼物名1 X2,礼物2 X4) $textMessage = $FromUserInfo['nickname'] . ' 送给 ' . $ToUserInfo['nickname'].' 趣味礼物 ' . implode(',', $giftTextList); + foreach ($gift_box as $gv) { + + } + $box_gift_info = $textData = [ 'FromUserInfo' => $FromUserInfo, - // 'ToUserInfo' => $ToUserInfo, - // 'GiftInfo' => $gift_info, - // 'GiftNum' => $num, + 'ToUserInfo' => $ToUserInfo, + 'GiftInfo' => $gift_box, + 'GiftNum' => $num, 'text' => $textMessage ]; // 聊天室推送文字消息 diff --git a/application/cron/controller/RoomPan.php b/application/cron/controller/RoomPan.php index be59e08..48c30f4 100644 --- a/application/cron/controller/RoomPan.php +++ b/application/cron/controller/RoomPan.php @@ -43,6 +43,8 @@ class RoomPan $room_id = $v['room_id']; $room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name'); $FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find(); + $FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标 + $FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标 $user_nickname = $FromUserInfo['nickname']; $textMessage = $user_nickname; $text_message = $user_nickname; @@ -54,6 +56,7 @@ class RoomPan $draw_gift = Db::name('vs_gift')->where(['gid'=>$value['gift_id']])->find(); $textMessage = $textMessage . ' 送给 ' . $ToUserInfo['nickname']. ' 盲盒转盘礼物 ' . $draw_gift['gift_name'].' x ' .$value['count']."\n"; $play_image[] = $draw_gift['play_image']; + $gift_names[] = $draw_gift['gift_name']; $text_message = $text_message . '在' . $room_name . '房间送给了' . $ToUserInfo['nickname'] . $draw_gift['gift_name'] . 'X' . $value['count']."\n"; if($draw_gift['is_public_server'] == 1) { @@ -78,6 +81,7 @@ class RoomPan 'ToUserInfos' => $ToUserInfos, 'GiftInfo' => [ 'play_image' => implode(',',$play_image), + 'gift_name' => implode(',',$gift_names), ], 'text' => $textMessage ];