兔兔红包插件对php8.0环境的不支持。
LYQBING 8月前

升到php8.0时发现的问题,排查后发现是红包插件的问题。

注释34-35

function red_packet_random($red_packet){

    $half = $red_packet['total']>=20? 10 : ($red_packet['total']%2==1) ? (($red_packet['total']+1)/2): ($red_packet['total']/2);

    $min=1;

    if($red_packet['rest']>=$half) {

        $max = (int)($red_packet['rest_money']/$red_packet['rest'] *1.2);

        $min = (int)($red_packet['rest_money']/$red_packet['rest'] *0.1);

        if($max>$red_packet['rest_money']) $max=$red_packet['rest_money'];

        if($min>$red_packet['rest_money']) $min=$red_packet['rest_money'];

    }

    else $max = $red_packet['rest_money'] - $red_packet['rest'] + 1;

    return $max == 1 ? 1 : mt_rand($min, $max);

}

实际排查后发现是:

$half = $red_packet['total']>=20? 10 : ($red_packet['total']%2==1) ? (($red_packet['total']+1)/2): ($red_packet['total']/2);

这行代码有问题,坐等dalao修复?笑

 

关闭拼手气红包:

注释第63行 :case '2':return '拼手气红包';break;

最新回复 (2)
全部楼主
  • yunxi0723
    1月前 2
    0
    好厉害
  • a961223
    1月前 3
    0

     

     

    修改后

    function red_packet_random($red_packet){
    
        $half = ($red_packet['total'] >= 20) ? 10 : (($red_packet['total'] % 2 == 1) ? (($red_packet['total']+1)/2) : ($red_packet['total']/2));
    
        $min = 1;
    
        if($red_packet['rest'] >= $half) {
    
            $max = (int)($red_packet['rest_money'] / $red_packet['rest'] * 1.2);
    
            $min = (int)($red_packet['rest_money'] / $red_packet['rest'] * 0.1);
    
            if($max > $red_packet['rest_money']) $max = $red_packet['rest_money'];
    
            if($min > $red_packet['rest_money']) $min = $red_packet['rest_money'];
    
        }
    
        else $max = $red_packet['rest_money'] - $red_packet['rest'] + 1;
    
        return $max == 1 ? 1 : mt_rand($min, $max);
    
    }
返回