public function click_reward()
{
    // 获取所有的抽奖列表
    $reward_list = $this -> reward_list();

    // 将概率取出来并组成新数组
    $reward_list_arr = array_column($reward_list, 'prop');

    // 调取抽奖概率
    $reward = $this -> get_rand($reward_list_arr);

    // 得到返回值的对应的奖品信息
    $reward_gift = $reward_list[$reward];

    return $reward_gift;
}

/**
 * 抽奖概率
 */
public function get_rand($proArr)
{
    $result = '';
    //概率数组的总概率精度
    $proSum = array_sum($proArr);
    //概率数组循环
    foreach ($proArr as $key => $proCur) {
        $randNum = mt_rand(1, $proSum);
        if ($randNum <= $proCur) {
            $result = $key;
            break;
        } else {
            $proSum -= $proCur;
        }
    }
    unset ($proArr);
    return $result;
}
10-17 16:28