酒吧房类型修改
This commit is contained in:
@@ -790,7 +790,10 @@ class GiveGift extends Model
|
||||
// 优化:基于剩余数量的加权随机选择
|
||||
$gift_bag_details = db::name("vs_gift_bag_detail")->where($where)->select();
|
||||
if (empty($gift_bag_details)) {
|
||||
return ['code' => 0, 'msg' => '当前盲盒无可用礼物', 'data' => []];
|
||||
db::name("vs_gift_bag")->where('id',$gift_bag_id)->setInc('periods');
|
||||
db::name("vs_gift_bag_detail")->where('gift_bag_id',$gift_bag_id)->update(['remaining_number'=>db::raw('quantity')]);
|
||||
$gift_bag_details = db::name("vs_gift_bag_detail")->where($where)->select();
|
||||
// return ['code' => 0, 'msg' => '当前盲盒无可用礼物', 'data' => []];
|
||||
}
|
||||
// 实现加权随机算法:剩余数量越多,被抽中的概率越大
|
||||
$total_remaining = 0;
|
||||
|
||||
Reference in New Issue
Block a user