diff --git a/application/api/controller/Xxiaoshi.php b/application/api/controller/Xxiaoshi.php index 83daba40..22fbc804 100644 --- a/application/api/controller/Xxiaoshi.php +++ b/application/api/controller/Xxiaoshi.php @@ -50,68 +50,362 @@ class Xxiaoshi extends Controllers } -// //爆币金币补偿 -// public function coinCompensations() -// { -// // 原始数据(注意:原数组中重复的键会被直接覆盖,所以先把原始数据整理成二维数组形式) -// $originalData = [ -// ['27815', 16], -// ['22349', 67], -// ['30190', 72], -// ['22202', 1], -// ['27259', 62], -// ['28869', 94], -// ['28984', 10], -// ['25101', 14], -// ['27373', 81], -// ['27373', 85], -// ['30420', 20], -// ['23160', 13], -// ['30228', 92], -// ['24984', 33], -// ['28657', 15], -// ['28657', 62], -// ['28585', 21], -// ['27562', 94], -// ['29925', 80], -// ['22713', 41], -// ['21267', 87], -// ['30228', 1000], + public function queryUserRecharge() + { + // 1. 构建键值对数组(左侧为键,右侧为对应的值列表) +// $userTimeData = [ +// [21238, 1768437495], +// [21238, 1768438042], +// [21238, 1768537071], +// [21238, 1768537086], +// [21238, 1768537102], +// [21238, 1768537116], +// [21238, 1768537130], +// [21263, 1768538654], +// [21283, 1768538494], +// [21283, 1768538505], +// [21346, 1768620290], +// [21355, 1768562702], +// [21521, 1768480294], +// [21521, 1768535126], +// [21521, 1768559545], +// [21521, 1768559583], +// [21521, 1768561603], +// [21521, 1768561942], +// [21549, 1768472710], +// [21549, 1768473170], +// [22109, 1768576512], +// [22215, 1768448033], +// [22230, 1768453987], +// [22230, 1768494691], +// [22230, 1768606319], +// [22247, 1768568982], +// [22349, 1768463236], +// [22349, 1768463510], +// [22349, 1768498328], +// [22349, 1768534547], +// [22349, 1768575347], +// [22349, 1768575906], +// [22349, 1768576001], +// [22349, 1768576134], +// [22349, 1768576484], +// [22353, 1768493303], +// [22353, 1768493644], +// [22367, 1768450215], +// [22367, 1768450295], +// [22367, 1768450411], +// [22367, 1768556122], +// [22367, 1768557842], +// [22367, 1768560574], +// [22397, 1768489651], +// [22397, 1768489678], +// [22403, 1768615100], +// [22403, 1768615185], +// [22474, 1768610625], +// [22489, 1768539082], +// [22513, 1768469607], +// [22513, 1768622078], // 新增的时间戳 +// [22546, 1768467110], +// [22546, 1768480214], +// [22546, 1768480289], +// [22546, 1768617480], +// [22546, 1768619884], +// [22765, 1768555869], +// [22765, 1768613623], +// [22960, 1768478779], +// [22960, 1768562093], +// [22960, 1768562790], +// [23160, 1768495390], +// [23273, 1768546462], +// [23317, 1768445313], +// [23317, 1768499667], +// [23317, 1768500101], +// [23317, 1768500124], +// [23317, 1768500550], +// [23317, 1768502888], +// [23317, 1768580934], +// [23317, 1768580952], +// [23317, 1768582152], +// [23381, 1768484820], +// [23381, 1768558830], +// [23381, 1768562317], +// [23418, 1768546419], +// [23418, 1768556020], +// [23428, 1768615120], +// [23620, 1768438590], +// [23620, 1768446478], +// [23620, 1768446636], +// [23620, 1768446926], +// [23620, 1768446971], +// [23620, 1768446983], +// [23620, 1768446994], +// [23768, 1768500957], +// [23934, 1768487148], +// [23979, 1768483941], +// [23979, 1768484887], +// [23979, 1768485349], +// [23979, 1768488207], +// [23979, 1768606496], +// [23996, 1768537785], +// [23996, 1768583372], +// [24049, 1768480652], +// [24049, 1768574886], +// [24049, 1768575149], +// [24049, 1768575263], +// [24049, 1768575306], +// [24049, 1768576026], +// [24049, 1768576057], +// [24049, 1768576122], +// [24049, 1768576324], +// [24049, 1768576359], +// [24049, 1768576411], +// [24049, 1768576450], +// [24049, 1768576547], +// [24049, 1768576572], +// [24049, 1768576752], +// [24049, 1768576788], +// [24049, 1768610848], +// [24049, 1768610956], +// [24123, 1768476419], +// [24123, 1768563117], +// [24208, 1768480841], +// [24221, 1768621532], // 新增的user_id和时间戳 +// [24224, 1768434963], +// [24239, 1768575140], +// [24262, 1768474400], +// [24268, 1768562981], +// [24268, 1768563148], +// [24376, 1768495419], +// [24402, 1768573575], +// [24402, 1768573664], +// [24497, 1768611030], +// [24497, 1768611043], +// [24559, 1768573337], +// [24619, 1768444049], +// [24724, 1768436254], +// [24724, 1768436335], +// [24724, 1768436370], +// [24724, 1768436566], +// [24724, 1768463485], +// [24724, 1768463533], +// [24724, 1768485920], +// [24724, 1768486241], +// [24724, 1768559795], +// [24724, 1768575533], +// [24724, 1768575836], +// [24724, 1768575846], +// [24724, 1768576947], +// [24724, 1768577192], +// [24724, 1768584426], +// [24724, 1768591790], +// [24724, 1768592625], +// [24809, 1768574941], +// [24914, 1768469768], +// [24914, 1768478779], +// [24914, 1768529233], +// [24914, 1768547882], +// [24949, 1768446759], +// [24949, 1768468114], +// [24949, 1768471318], +// [24949, 1768489660], +// [24949, 1768489679], +// [24949, 1768489694], +// [24949, 1768489908], +// [24949, 1768489995], +// [24949, 1768491042], +// [24949, 1768491189], +// [24949, 1768495030], +// [24949, 1768495287], +// [24949, 1768528803], +// [24949, 1768621300], // 新增的时间戳 +// [25102, 1768486444], +// [25102, 1768492650], +// [25264, 1768469925], +// [25297, 1768482093], +// [25297, 1768523171], +// [25297, 1768524115], +// [25356, 1768453712], +// [25356, 1768564162], +// [25436, 1768567177], +// [25504, 1768445533], +// [25504, 1768474538], +// [25504, 1768474550], +// [25504, 1768549836], +// [25504, 1768550533], +// [25504, 1768551277], +// [25504, 1768611155], +// [25614, 1768463575], +// [25614, 1768493369], +// [25668, 1768550315], +// [25668, 1768550900], +// [25668, 1768551157], +// [25689, 1768534840], +// [25689, 1768534859], +// [25689, 1768535523], +// [25689, 1768606149], +// [25689, 1768606164], +// [25782, 1768440770], +// [25868, 1768441940], +// [25884, 1768446752], +// [25884, 1768453213], +// [25884, 1768478849], +// [25909, 1768451888], +// [25909, 1768452147], +// [25909, 1768452512], +// [25909, 1768452685], +// [25909, 1768453007], +// [25977, 1768465353], +// [25977, 1768466422], +// [25977, 1768466948], +// [25977, 1768495780], +// [26002, 1768474369], +// [26010, 1768563140], +// [26260, 1768595503], +// [26333, 1768480346], +// [26471, 1768463341], +// [26471, 1768535162], +// [26685, 1768544823], +// [26846, 1768467107], +// [26865, 1768526248], +// [26910, 1768495212], +// [26910, 1768495674], +// [26932, 1768451859], +// [26932, 1768452304], +// [26932, 1768467016], +// [26932, 1768467086], +// [26961, 1768551610], +// [26961, 1768551630], +// [26961, 1768551741], +// [26961, 1768617367], +// [27063, 1768595933], +// [27152, 1768544596], +// [27172, 1768453726], +// [27306, 1768467885], +// [27306, 1768480720], +// [27619, 1768480089], +// [27619, 1768547882], +// [27619, 1768547902], +// [27619, 1768564945], +// [27848, 1768445845], +// [27848, 1768446640], +// [27980, 1768485183], +// [28015, 1768463456], +// [28015, 1768464122], +// [28226, 1768539447], +// [28226, 1768539558], +// [28226, 1768539674], +// [28226, 1768539800], +// [28226, 1768539899], +// [28226, 1768539972], +// [28226, 1768540093], +// [28226, 1768540167], +// [28226, 1768540273], +// [28304, 1768454349], +// [28357, 1768441100], +// [28443, 1768471092], +// [28443, 1768538447], +// [28443, 1768540270], +// [28443, 1768547826], +// [28443, 1768556907], +// [28443, 1768557771], +// [28443, 1768564068], +// [28443, 1768564085], +// [28551, 1768481077], +// [28551, 1768481222], +// [28551, 1768548678], +// [28551, 1768580500], +// [28551, 1768580517], +// [28561, 1768449441], +// [28769, 1768553650], +// [28769, 1768553902], +// [28855, 1768568390], +// [28924, 1768472667], +// [28924, 1768490582], +// [28924, 1768490656], +// [28924, 1768490721], +// [28924, 1768490844], +// [28924, 1768490949], +// [28924, 1768491079], +// [28924, 1768491176], +// [28924, 1768491285], +// [28924, 1768569855], +// [28924, 1768570809], +// [28993, 1768444688], +// [29420, 1768491595], +// [30113, 1768544251], +// [30190, 1768457671], +// [30190, 1768457788], +// [30190, 1768457926], +// [30190, 1768458180], +// [30190, 1768458568], +// [30190, 1768458786], +// [30190, 1768458886], +// [30190, 1768459131], +// [30190, 1768459373], +// [30442, 1768529725], +// [30551, 1768580619] // ]; -// -// // 第一步:重组数组,将相同键名的值存入数组中 -// $res = []; -// foreach ($originalData as $item) { -// $k = $item[0]; -// $v = $item[1]; -// // 如果键已存在,就追加值;不存在则初始化数组 -// if (isset($res[$k])) { -// $res[$k][] = $v; -// } else { -// $res[$k] = [$v]; -// } -// } -// echo time(). '
'; -// // 第二步:遍历输出所有键值对 -// foreach ($res as $k => $values) { -// // 遍历同一个键名下的所有值 -// foreach ($values as $v) { -// echo $k . ':' . $v . '
'; -// //开启事务 -// db::startTrans(); -// $wallet_update = model('api/UserWallet')->change_user_cion_log($k,$v,0,58,'参与幸运币活动获得'.$v.'倍'); -// if(!$wallet_update){ -// db::rollback(); -// Log::error('抽奖处理失败:' .$k . '<:>' . $v ); -// return ['code' => 0, 'msg' => '流水记录失败', 'data' => null]; -// } -// db::commit(); -// sleep(1); -// } -// } -// echo time(). '
'; -// } + if(isset($userTimeData)){ + $userTimeData = []; + } + $dtae = []; + // 2. 循环数组,遍历每个键对应的所有值 + foreach ($userTimeData as $item) { + $userId = $item[0]; // 获取用户ID + $timestamp = $item[1]; // 获取时间戳 + // 批量查询(推荐,减少数据库连接次数) + $rechargeData = Db::name('vs_user_recharge') + ->field('updatetime, pay_status, user_id, money') + ->where(['updatetime' => $timestamp,'pay_status' => 2 ]) + ->select(); // 转为普通数组方便处理 + + if($rechargeData){ + foreach ($rechargeData as $recharge){ + $dtae[] = [ + 'p_user' => $userId, + 'user_id' => $recharge['user_id'], + 'createtime' => $recharge['updatetime'], + 'money' => $recharge['money'], + ]; + } + } + } + +// var_dump($dtae); + echo "\n"; + echo "========="; + var_dump(count($dtae)); + echo "\n"; + $invite = []; + $invited_draw_conf = get_system_config_value('invited_draw');//分成比例 + if($dtae){ + foreach ($dtae as $item){ + $invit = db::name('vs_user_invited')->where(['user_id' => $item['p_user'],'sub_user_id' => $item['user_id']])->find(); + if($invit){ + $invited_draw = $invited_draw_conf / 100; + $invited_draw_money = $item['money'] * $invited_draw; + //增加余额并记录日志 +// $wallet_update = model('api/UserWallet')->change_user_earnings_log($item['p_user'],$invited_draw_money,0,6,'邀请用户充值返利'.$item['createtime']); +// if(!$wallet_update){ +// Log::record("邀请用户充值返利(补发)失败:".$item['p_user'],"info"); +// echo "邀请用户充值返利失败".$item['p_user']; +// } + sleep(1); + $invite[] = [ + 'p_user' => $item['p_user'], + 'user_id' => $item['user_id'], + 'createtime' => $item['createtime'], + 'money' => $item['money'], + 'invited_draw_money' => $invited_draw_money, + ]; + } + } + } + echo "========="; + echo "\n"; +// var_dump($invite); + + } - } \ No newline at end of file diff --git a/application/api/model/BlindBoxTurntableGiftDrawWorldNew.php b/application/api/model/BlindBoxTurntableGiftDrawWorldNew.php index be9e0c86..606d6d9c 100644 --- a/application/api/model/BlindBoxTurntableGiftDrawWorldNew.php +++ b/application/api/model/BlindBoxTurntableGiftDrawWorldNew.php @@ -868,7 +868,7 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model if($userGift['count'] > 9){ //防止礼物超发,礼物超10个则不发送 continue; } - $res = model("api/SendGift")->single_send_gift_pan($user_id,$userGift['gift_user_id'],$userGift['gift_id'],$userGift['count'],1,$room_id,$bag_data['gift_bag_id'], $heart_id); + $res = model("api/SendGift")->single_send_gift_pan($user_id,$userGift['gift_user_id'],$userGift['gift_id'],$userGift['count'],1,$room_id,$bag_data['gift_bag_id'], $heart_id,$auction_id); if (isset($res) && $res['code'] != 1) { Log::record('发送礼物失败: ' . $res['msg'] . $userGift['gift_user_id'], "info"); return ['code' => 0, 'msg' => $res['msg'], 'data' => null]; diff --git a/application/api/model/SendGift.php b/application/api/model/SendGift.php index e785ca93..c4a945e9 100644 --- a/application/api/model/SendGift.php +++ b/application/api/model/SendGift.php @@ -274,6 +274,16 @@ class SendGift extends Model //查询礼物是否是盲盒 if($gift_info['label'] == 2){//趣味礼物(盲盒) + //前端没传参数补偿 + if(!$gift_bag_id){ + if($gid == 302){ + $gift_bag_id = 7; + }elseif ($gid == 303){ + $gift_bag_id = 8; + }elseif ($gid == 304){ + $gift_bag_id = 9; + } + } for($i = 0; $i < $num; $i++){ //开盲盒 $gift_box1[$i] = $this -> open_box($gid,$uid,$to_uid,$room_id,$gift_bag_id); @@ -825,6 +835,16 @@ class SendGift extends Model //查询礼物是否是盲盒 if($gift_info['label'] == 2){//趣味礼物(盲盒) + //前端没传参数补偿 + if(!$gift_bag_id){ + if($gid == 302){ + $gift_bag_id = 7; + }elseif ($gid == 303){ + $gift_bag_id = 8; + }elseif ($gid == 304){ + $gift_bag_id = 9; + } + } $gift_box_map = []; for($i = 0; $i < $num; $i++){ //开盲盒 @@ -1190,7 +1210,7 @@ class SendGift extends Model } //送一个人的礼物-盘(天空之境) - public function single_send_gift_pan($uid,$to_uid,$gid,$num,$type,$room_id,$gift_bag_id,$heart_id) + public function single_send_gift_pan($uid,$to_uid,$gid,$num,$type,$room_id,$gift_bag_id,$heart_id,$auction_id) { //送的礼物信息 $gift_info = Db::name('vs_gift')->where(['gid'=>$gid]) @@ -1387,6 +1407,33 @@ class SendGift extends Model ]; model('api/Friend')->room_give_gift($uid, $to_uid,$room_id,$reslut,$heart_id); } + if($auction_id && ($room_type == 3 || $room_type == 4)){ + $auction = db::name('vs_room_auction')->where('auction_id',$auction_id)->field('room_id,gift_price,user_id,status')->find(); + if($auction['status'] == 2){//1未开启 2进行中 3已结束 + //数据写入数据库 + $resa = db::name('vs_room_auction_bid_log')->insert([ + 'auction_id' => $auction_id, + 'user_id' => $uid, + 'gift_id' => $gid, + 'gift_price' => $receive_gift_total, + 'createtime' => time() + ]); + if(!$resa){ + return ['code' => 0, 'msg' => '操作失败,','data' => null]; + } + + //整理数据 排序 + $list = model('api/RoomAuction')->room_auction_list_on($auction_id); + //推送消息 + $text_a = [ + 'FromUserInfo' => null, + 'auction_user' => null , + 'auction_list' => $list, + 'text' => '参与竞拍' + ]; + model('api/Chat')->sendMsg(1024,$auction['room_id'],$text_a); + } + } return ['code' => 1, 'msg' => '送礼成功', 'data' => null]; }