feat(WIP): 베팅 개시 타입 변경

-candidate를 미리 추가.
-이를 통해 betting을 중립적으로 운용 가능
This commit is contained in:
2022-02-05 07:43:27 +00:00
committed by Gitea
parent d4c1c05b3c
commit a0c9168791
7 changed files with 101 additions and 35 deletions
@@ -5,7 +5,7 @@ namespace sammo\Event\Action;
use \sammo\GameConst;
use \sammo\Util;
use \sammo\DB;
use sammo\DTO\NationBettingInfo;
use sammo\DTO\BettingInfo;
use sammo\Json;
use sammo\KVStorage;
@@ -20,14 +20,17 @@ class FinishNationBetting extends \sammo\Event\Action
$db = DB::db();
[$year, $month] = [$env['year'], $env['month']];
$nationBettingStor = KVStorage::getStorage($db, 'nation_betting');
$bettingInfoRaw = $nationBettingStor->getValue("id_{$this->bettingID}");
$bettingStor = KVStorage::getStorage($db, 'betting');
$bettingInfoRaw = $bettingStor->getValue("id_{$this->bettingID}");
if($bettingInfoRaw === null){
return [__CLASS__, true];
}
$bettingInfo = new NationBettingInfo($bettingInfoRaw);
$bettingInfo = new BettingInfo($bettingInfoRaw);
if($bettingInfo->type != 'nationBetting'){
return [__CLASS__, false, 'invalid type', $bettingInfo->type];
}
$bettingInfo->finished = true;
$nationBettingStor->setValue("id_{$this->bettingID}", $bettingInfo->toArray());
$bettingStor->setValue("id_{$this->bettingID}", $bettingInfo->toArray());
//TODO: 포인트를 배분해주어야 함
//TODO: 이후 토너먼트 베팅 결과도 같이 처리할 것이므로, 별도의 함수나 모듈을 생성하여 처리!