成品案例源码搭建对接主站
protected function execute(Input $input, Output $output)
{
if(!in_array(DycService::$killer_type,[1,2])) {
$this->debugInfo('The game type is error.Must in [1,2].');
return;
}
if(DycService::$killer_type == 1 && (DycService::$killer_number < 1 || DycService::$killer_number > 12)) {
$this->debugInfo('Solid type need game killer number is in [1,12].');
return;
}
if(DycService::$killer_type == 2 && (DycService::$killer_range[0] < 1 || DycService::$killer_range[1] > 12)) {
$this->debugInfo('Random type need game killer number is range [1,12].');
return;
}
while (true) {
sleep(1);
$game = $this->getLastGame();
if ($game->end_time > time()) {
$this->debugInfo('wait' . ($game->end_time - time()));
continue;
}
$this->debugInfo(sprintf('【%s】calc start', $game->id));
//封盘
$this->lock();
//结算
$result = $this->calc($game);