巡乐会抽奖接口提交.-联调-抽奖逻辑调整
This commit is contained in:
@@ -207,9 +207,10 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'a.quantity' => ['>',0],
|
'a.quantity' => ['>',0],
|
||||||
'b.remaining_number' => ['>',0],
|
'b.remaining_number' => ['>',0],
|
||||||
'b.room_id' => $room_id,
|
'b.room_id' => $room_id,
|
||||||
|
'a.weight' => ['<=', $total_draw_times],
|
||||||
];
|
];
|
||||||
// 使用闭包条件来处理复杂的 weight 逻辑
|
// 使用闭包条件来处理复杂的 weight 逻辑
|
||||||
$where['a.weight'] = ['exp', Db::raw('= 0 OR a.weight < '.$total_draw_times)];
|
// $where['a.weight'] = ['exp', Db::raw('= 0 OR a.weight < '.$total_draw_times)];
|
||||||
// 优化:基于剩余数量的加权随机选择
|
// 优化:基于剩余数量的加权随机选择
|
||||||
$gift_bag_details = db::name("vs_gift_bag_detail")
|
$gift_bag_details = db::name("vs_gift_bag_detail")
|
||||||
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
|
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
|
||||||
@@ -508,9 +509,10 @@ class BlindBoxTurntableGift extends Model
|
|||||||
'a.quantity' => ['>',0],
|
'a.quantity' => ['>',0],
|
||||||
'b.remaining_number' => ['>',0],
|
'b.remaining_number' => ['>',0],
|
||||||
'b.room_id' => $room_id,
|
'b.room_id' => $room_id,
|
||||||
|
'a.weight' => ['<=', $total_draw_times],
|
||||||
];
|
];
|
||||||
// 使用闭包条件来处理复杂的 weight 逻辑
|
// 使用闭包条件来处理复杂的 weight 逻辑
|
||||||
$where['a.weight'] = ['exp', Db::raw('= 0 OR a.weight < '.$total_draw_times)];
|
// $where['a.weight'] = ['exp', Db::raw('= 0 OR a.weight < '.$total_draw_times)];
|
||||||
// 优化:基于剩余数量的加权随机选择
|
// 优化:基于剩余数量的加权随机选择
|
||||||
$gift_bag_details = db::name("vs_gift_bag_detail")
|
$gift_bag_details = db::name("vs_gift_bag_detail")
|
||||||
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
|
->field('a.id,a.quantity,b.remaining_number,a.weight,a.foreign_id')
|
||||||
|
|||||||
Reference in New Issue
Block a user