class="php" name="code">        //修改此处请修改getPrize 中默认数据
        $con = [
            ['typeId' => 1, 'price' => 50],
            ['typeId' => 1, 'price' => 120],
            ['typeId' => 4, 'price' => 1],
            ['typeId' => 4, 'price' => 2],
            ['typeId' => 4, 'price' => 5],
            ['typeId' => 2, 'price' => 199],
        ];
        $lotteryChance = [100, 0, 0, 0, 0, 100];
        $total = array_sum($lotteryChance) / (1 - 0.2);
        $rand = rand(0, $total - 1);
        $start = 0;
        for ($i = 0; $i < count($lotteryChance); $i++) {
            $end = $start + $lotteryChance[$i];
            try{
                if ($rand >= $start && $rand < $end) {
                    return $con[$i];
                }
            }catch(\Exception $e){
                return null;
            }
            $start += $lotteryChance[$i];
        }
?