Compare commits
10 Commits
8a62c2f1eb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c46038cf5b | |||
| 747c2747b1 | |||
| eee56fc7eb | |||
| ee25111a0a | |||
| 20a8c4e8bf | |||
| d6c92bc150 | |||
| ea9fa85d46 | |||
| 7a703e3cfd | |||
| 4edc124d15 | |||
| 92831bcd13 |
@@ -424,6 +424,7 @@ class Activities extends adminApi
|
||||
'money' => $ext['money'],
|
||||
'money_str' => $ext['money_str'],
|
||||
'diamond' => $ext['diamond'],
|
||||
'activity_end_time' => $ext['activity_end_time'],
|
||||
];
|
||||
return V(1,"成功",$data);
|
||||
}
|
||||
|
||||
@@ -810,6 +810,7 @@ class BlindBox extends adminApi
|
||||
$platform_profit_loss = $total_money - $total_gift_money;
|
||||
if($profit_loss==0 || $total_money==0){
|
||||
$profit_loss_ratio = 0;
|
||||
$platform_profit_loss_ratio = 0;
|
||||
}else{
|
||||
// 盈亏比
|
||||
$profit_loss_ratio = round(($profit_loss / $total_money),3);
|
||||
|
||||
@@ -396,15 +396,28 @@ class Guild extends adminApi
|
||||
}
|
||||
$count = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->count();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||
$list = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->page($page, $page_limit)->select();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->page($page, $page_limit)->select();
|
||||
if(!$list){
|
||||
return V(0,"暂无数据");
|
||||
}
|
||||
$rum_lists = [];
|
||||
foreach ($list as $k=>$v){
|
||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
||||
$search_stime = $search_stime;
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
||||
}
|
||||
if($v['quit_time']){
|
||||
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
||||
$search_etime = $search_etime;
|
||||
}else{
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}
|
||||
}
|
||||
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||
$rum_lists[$k]['id']=$v['id'];
|
||||
$rum_lists[$k]['room_id']=$v['room_id'];
|
||||
|
||||
@@ -425,6 +425,12 @@ class Room extends adminApi
|
||||
$search_room_id = input('search_room_id', '');
|
||||
$search_user_id = input('search_user_id', '');
|
||||
$search_status = input('search_status', '');
|
||||
$type_id = input('type_id', '');
|
||||
$label_id = input('label_id', '');
|
||||
$is_hot = input('is_hot', '');
|
||||
$is_top = input('is_top', '');
|
||||
$is_recommend = input('is_recommend', '');
|
||||
|
||||
$where=[];
|
||||
//房间号
|
||||
if($search_room_id!==''){
|
||||
@@ -437,6 +443,21 @@ class Room extends adminApi
|
||||
if($search_status!==''){
|
||||
$where['room_status'] = $search_status;
|
||||
}
|
||||
if($type_id!==''){
|
||||
$where['type_id'] = $type_id;
|
||||
}
|
||||
if($label_id!==''){
|
||||
$where['label_id'] = $label_id;
|
||||
}
|
||||
if($is_hot!==''){
|
||||
$where['is_hot'] = $is_hot;
|
||||
}
|
||||
if($is_top!==''){
|
||||
$where['is_top'] = $is_top;
|
||||
}
|
||||
if($is_recommend!==''){
|
||||
$where['is_recommend'] = $is_recommend;
|
||||
}
|
||||
//房间列表只展示 审核通过的房间
|
||||
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||
$where['type_id'] = ['<>',6];
|
||||
|
||||
@@ -88,8 +88,8 @@ class Activities extends BaseCom
|
||||
$uid = input('uid',$this->uid);
|
||||
$permission_status = 1;
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
$system = request()->header('system');
|
||||
$app_version = request()->header('App-Version');
|
||||
if(!$app_version){
|
||||
@@ -200,7 +200,7 @@ class Activities extends BaseCom
|
||||
public function drop_gift_send()
|
||||
{
|
||||
$uid = input('uid',$this->uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid,16);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
@@ -313,14 +313,15 @@ class Activities extends BaseCom
|
||||
$uid = input('uid',$this->uid);
|
||||
$first_charge_permission = 1;
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
if($is_first_charge > 0){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
if($permission){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
|
||||
//天降好礼
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
|
||||
$day_drop_permission = 0;
|
||||
@@ -332,11 +333,19 @@ class Activities extends BaseCom
|
||||
}
|
||||
//新人充值好礼
|
||||
$activities = DB::name('vs_activities')->where(['id'=>7,'status'=>1,'delete_time'=>0])->find();
|
||||
if($activities){
|
||||
$effective_time = $activities['effective_time'];
|
||||
}else{
|
||||
$effective_time = 0;
|
||||
}
|
||||
$bag_data = DB::name('vs_gift_bag')->where(['activities_id'=>7,'status'=>1,'delete_time'=>0])->select();
|
||||
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>['in',array_column($bag_data,'id')],'user_id'=>$uid])->select();
|
||||
$new_permission = 0;
|
||||
$user_info = DB::name('user')->where(['id'=>$uid])->find();
|
||||
if($user_info['createtime'] + $activities['effective_time'] >= time()){
|
||||
if($user_info['createtime']<"1760666400"){
|
||||
$user_info['createtime'] = 1760666400;
|
||||
}
|
||||
if($user_info['createtime'] + $effective_time >= time()){
|
||||
$new_permission = 1;
|
||||
}
|
||||
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
|
||||
|
||||
@@ -25,7 +25,7 @@ class Activities extends Model
|
||||
public static function first_charge_gift_send($user_id,$money=0)
|
||||
{
|
||||
//礼包
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['>=',$money]])->order('money desc')->find();
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['<=',$money]])->order('money desc')->find();
|
||||
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||
if (!$gift_bag_id) {
|
||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||
|
||||
@@ -37,9 +37,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0,$auction_id = 0)
|
||||
{
|
||||
// 最大重试次数
|
||||
// $maxRetries = 3;
|
||||
// for ($attempt = 0; $attempt < $maxRetries; $attempt++) {
|
||||
// try {
|
||||
$maxRetries = 3;
|
||||
for ($attempt = 0; $attempt < $maxRetries; $attempt++) {
|
||||
try {
|
||||
// 1. 验证参数并提前处理错误
|
||||
$validationResult = $this->validateDrawParameters($gift_bag_id, $user_id, $gift_user_ids);
|
||||
if ($validationResult !== true) {
|
||||
@@ -66,11 +66,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
return $precomputeResult;
|
||||
}
|
||||
$precomputedResults = $precomputeResult['data']['results'];
|
||||
foreach ($precomputedResults as $key => $result) {
|
||||
if ($result['gift'] == null) {
|
||||
Log::record('数据报错-3:'.json_encode($result),"info");
|
||||
}
|
||||
}
|
||||
$availableGiftss = $precomputeResult['data']['availableGifts'];
|
||||
$currentXlhPeriodsNum = $precomputeResult['data']['current_xlh_periods_num'];
|
||||
$addcurrentXlhPeriodsNum = $precomputeResult['data']['addcurrentXlhPeriodsNum'];
|
||||
@@ -112,29 +107,29 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
// 6. 构建并返回结果
|
||||
return $this->buildDrawResult($boxTurntableLog, $giftCounts);
|
||||
|
||||
// } catch (\Exception $e) {
|
||||
// $key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
|
||||
// $errorData = [
|
||||
// 'gift_bag_id' => $gift_bag_id,
|
||||
// 'user_id' => $user_id,
|
||||
// 'gift_user_ids' => $gift_user_ids,
|
||||
// 'num' => $num,
|
||||
// 'room_id' => $room_id,
|
||||
// 'heart_id' => $heart_id,
|
||||
// 'auction_id' => $auction_id,
|
||||
// ];
|
||||
// if ($this->redis) {
|
||||
// $this->redis->setex($key, 86400 * 7, $e->getMessage() . ' ' . json_encode($errorData));
|
||||
// }
|
||||
// // 如果是死锁且还有重试机会
|
||||
// if (strpos($e->getMessage(), 'Deadlock') !== false && $attempt < $maxRetries - 1) {
|
||||
// // 随机延迟后重试
|
||||
// usleep(rand(50000, 200000)); // 50-200ms
|
||||
// continue;
|
||||
// }
|
||||
// return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
|
||||
// }
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
$key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
|
||||
$errorData = [
|
||||
'gift_bag_id' => $gift_bag_id,
|
||||
'user_id' => $user_id,
|
||||
'gift_user_ids' => $gift_user_ids,
|
||||
'num' => $num,
|
||||
'room_id' => $room_id,
|
||||
'heart_id' => $heart_id,
|
||||
'auction_id' => $auction_id,
|
||||
];
|
||||
if ($this->redis) {
|
||||
$this->redis->setex($key, 86400 * 7, $e->getMessage() . ' ' . json_encode($errorData));
|
||||
}
|
||||
// 如果是死锁且还有重试机会
|
||||
if (strpos($e->getMessage(), 'Deadlock') !== false && $attempt < $maxRetries - 1) {
|
||||
// 随机延迟后重试
|
||||
usleep(rand(50000, 200000)); // 50-200ms
|
||||
continue;
|
||||
}
|
||||
return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 验证抽奖参数
|
||||
@@ -367,7 +362,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
for ($i = 0; $i < $userNewAllocation; $i++) {
|
||||
$selectedGift = $this->selectGiftWithAliasMethod($aliasTableForNew);
|
||||
if ($selectedGift) {
|
||||
$gift = $giftInfoMap[$selectedGift['foreign_id']] ?? null;
|
||||
$giftInfoMap = $this->preloadGiftInfo($availableGifts);
|
||||
$gift = $giftInfoMap[$selectedGift['foreign_id']];
|
||||
if($gift)
|
||||
$precomputedResults[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
@@ -498,9 +495,9 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
$bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num;
|
||||
|
||||
// 增加重试机制
|
||||
// $maxRetries = 3;
|
||||
// for ($retry = 0; $retry < $maxRetries; $retry++) {
|
||||
// try {
|
||||
$maxRetries = 3;
|
||||
for ($retry = 0; $retry < $maxRetries; $retry++) {
|
||||
try {
|
||||
db::startTrans();
|
||||
// 按照固定顺序处理事务步骤
|
||||
// 1. 扣除用户金币(优先处理)
|
||||
@@ -545,17 +542,17 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
'gift_counts' => $giftCounts
|
||||
]
|
||||
];
|
||||
// } catch (\Exception $e) {
|
||||
// db::rollback();
|
||||
// // 检查是否是死锁错误
|
||||
// if (strpos($e->getMessage(), 'Deadlock') !== false && $retry < $maxRetries - 1) {
|
||||
// // 等待随机时间后重试
|
||||
// usleep(rand(10000, 100000)); // 10-100ms
|
||||
// continue;
|
||||
// }
|
||||
// return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
|
||||
// }
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
db::rollback();
|
||||
// 检查是否是死锁错误
|
||||
if (strpos($e->getMessage(), 'Deadlock') !== false && $retry < $maxRetries - 1) {
|
||||
// 等待随机时间后重试
|
||||
usleep(rand(10000, 100000)); // 10-100ms
|
||||
continue;
|
||||
}
|
||||
return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
|
||||
}
|
||||
}
|
||||
return ['code' => 0, 'msg' => '操作超时,请重试', 'data' => null];
|
||||
}
|
||||
|
||||
@@ -590,6 +587,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
*/
|
||||
private function batchInsertGiftBagReceiveLog($user_id, $boxTurntableLog, $bag_data, $room_id, $precomputedResults)
|
||||
{
|
||||
|
||||
$batchInsertData = [];
|
||||
|
||||
foreach ($precomputedResults as $result) {
|
||||
|
||||
@@ -206,6 +206,9 @@ class Decorate extends Model
|
||||
if($decorate_price_info['price']<=0 && $user_decorate_data['end_time'] > $now_time + $change_time){
|
||||
return ['code' => 0, 'msg' => '您已购买过此装扮,请勿重复购买', 'data' => null];
|
||||
}
|
||||
if($user_decorate_data['end_time'] < $now_time){
|
||||
$user_decorate_data['end_time'] = 0;
|
||||
}
|
||||
$change_time = $day * 24 * 3600;
|
||||
$update['is_using'] = 2;
|
||||
$update['end_time'] = $user_decorate_data['end_time'] + $change_time;
|
||||
|
||||
@@ -364,21 +364,21 @@ class Login extends Model
|
||||
$openid = $userinfo['openid'];
|
||||
$user_info_data = model('UserData')->where(['wx_openid' => $openid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ali'){
|
||||
$ali_userid = $userinfo['open_id'];
|
||||
$user_info_data = model('UserData')->where(['ali_userid' => $ali_userid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ios'){
|
||||
$apple_id = $userinfo;
|
||||
$user_info_data = model('UserData')->where(['apple_id' => $userinfo,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ class UserGiftPack extends Model
|
||||
self::DRAW_GIFT,
|
||||
self::XLH_DRAW_GIFT_GET
|
||||
,self::HOUR_RANK_GET
|
||||
,self::NEW_CHARGE_GIFT
|
||||
];
|
||||
//获取背包日志列表
|
||||
$log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type)
|
||||
@@ -121,7 +122,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "X".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." X ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
@@ -148,7 +149,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "-".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." - ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
|
||||
@@ -1170,7 +1170,7 @@ function handelCharge($where,$data){
|
||||
return 0;
|
||||
}
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->count();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
//添加充值记录
|
||||
$res2 = db::name('vs_user_money_log')->insert([
|
||||
'user_id' => $orderModel['user_id'],
|
||||
@@ -1203,6 +1203,12 @@ function handelCharge($where,$data){
|
||||
if($is_first_charge == 0){
|
||||
model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
|
||||
}
|
||||
//活动
|
||||
if($orderModel['type_id'] == 6){
|
||||
$orderModel['type_params'] = 2;
|
||||
}elseif(in_array($orderModel['type_id'],[14,15,16])){
|
||||
$orderModel['type_params'] = 3;
|
||||
}
|
||||
switch ($orderModel['type_params']){
|
||||
case 2:
|
||||
//天降好礼
|
||||
|
||||
@@ -39,9 +39,9 @@ class PerformPerSecond
|
||||
// echo "房间火热值更新:\n";
|
||||
// $this->room_hot_update();
|
||||
// echo "\n";
|
||||
// echo "提现云账号订单状态查询:\n";
|
||||
// $this->withdraw_order_status();
|
||||
// echo "\n";
|
||||
echo "提现云账号订单状态查询:\n";
|
||||
$this->withdraw_order_status();
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user