@@ -1316,9 +1316,9 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
||||
private function selectGiftFromAvailable(array &$available_gifts, $user_id = 0)
|
||||
{
|
||||
// 添加针对特定用户和礼物的概率调整逻辑
|
||||
// $adjusted_gifts = $this->adjustGiftProbabilities($available_gifts, $user_id);
|
||||
$adjusted_gifts = $this->adjustGiftProbabilities($available_gifts, $user_id);
|
||||
|
||||
$remaining = array_sum(array_column($available_gifts, 'remaining_number'));
|
||||
$remaining = array_sum(array_column($adjusted_gifts, 'remaining_number'));
|
||||
if ($remaining <= 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -1330,7 +1330,7 @@ class BlindBoxTurntableGiftDrawWorldNew extends Model
|
||||
$rand_value = mt_rand(1, $remaining);
|
||||
$current_sum = 0;
|
||||
|
||||
foreach ($available_gifts as $gift) {
|
||||
foreach ($adjusted_gifts as $gift) {
|
||||
if ($gift['remaining_number'] <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class Gift extends Model
|
||||
// if($room_id){
|
||||
// $is_open_blind_box_turntable = Db::name('vs_room')->where(['id'=>$room_id])->value('is_open_blind_box_turntable');
|
||||
// }
|
||||
$list = $this->field('gid as gift_id,gift_name,base_image,gift_price,icon')->where($map)->where($where)->order('sort desc, gift_price asc')->select();
|
||||
$list = $this->field('gid as gift_id,gift_name,base_image,gift_price,icon')->where($map)->where($where)->order('sort asc, gift_price asc')->select();
|
||||
if($label==2){
|
||||
$list_data = [];
|
||||
foreach ($list as &$v) {
|
||||
@@ -104,9 +104,9 @@ class Gift extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
// usort($list_data, function($a, $b) {
|
||||
// return $a['gift_id'] <=> $b['gift_id'];
|
||||
// });
|
||||
usort($list_data, function($a, $b) {
|
||||
return $a['gift_id'] <=> $b['gift_id'];
|
||||
});
|
||||
$list = $list_data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user