victtech/lottery is a Laravel package.
It currently has 0 GitHub stars and 15 downloads on Packagist (latest version 1.0.8).
Install it with composer require victtech/lottery.
Discover more Laravel packages by victtech
or browse all Laravel packages to compare alternatives.
Last updated
[![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] [![Build Status][ico-travis]][link-travis] [![StyleCI][ico-styleci]][link-styleci]
Via Composer
$ composer require victtech/lottery
php artisan vendor:publish --tag=lottery.config
//配置中奖的概率以及每个奖项的数目
return [
'awards'=>[
//key 是奖项名称
'一等奖'=>[
'total'=>5, //奖项总数量
'probability'=>30 //中奖概率,百分率.所有奖项百分率之外就是不中奖概率
],
'二等奖'=>[
'total'=>10,
'probability'=>50
]
],
];
Lottery::getAward();
返回中的奖项名称,也就是配置中的key值
PersonLottery::getAward($dataSource,$count);
$dataSource //数据源所有参与抽奖的人员,数组格式,
$count //中奖人数
返回长度是$count的包含抽奖人员的数组,代表中奖人员
php artisan lottery:clearRecord //清除抽奖的奖项剩余信息
php artisan lottery:clearPersonRecord //清除已经中奖的人员信息