fix: 국가 베팅장에서 '토너먼트'는 보여주지 않기로

This commit is contained in:
2022-04-25 02:04:31 +09:00
parent 7d62e94306
commit ddb7ee1ec2
4 changed files with 19 additions and 4 deletions
+12 -1
View File
@@ -7,6 +7,7 @@ use DateTimeInterface;
use sammo\DB;
use sammo\DTO\BettingInfo;
use sammo\KVStorage;
use sammo\Validator;
use function sammo\checkLimit;
use function sammo\increaseRefresh;
@@ -15,6 +16,11 @@ class GetBettingList extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('in', 'req', ['bettingNation', 'tournament']);
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
@@ -27,6 +33,8 @@ class GetBettingList extends \sammo\BaseAPI
{
$db = DB::db();
$reqType = $this->args['req'] ?? null;
increaseRefresh("베팅장", 1);
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -42,6 +50,9 @@ class GetBettingList extends \sammo\BaseAPI
$bettingList = [];
foreach ($bettingStor->getAll() as $_key => $rawItem) {
$item = new BettingInfo($rawItem);
if ($reqType !== null && $item->type != $reqType) {
continue;
}
unset($rawItem['candidates']);
$bettingList[$item->id] = $rawItem;
$bettingList[$item->id]['totalAmount'] = 0;
@@ -49,7 +60,7 @@ class GetBettingList extends \sammo\BaseAPI
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
if(!$bettingList){
if (!$bettingList) {
return [
'result' => true,
'bettingList' => $bettingList,
+3 -1
View File
@@ -55,7 +55,9 @@ function addToast(msg: ToastType) {
console.log("시작!");
onMounted(async () => {
try {
const result = await SammoAPI.Betting.GetBettingList();
const result = await SammoAPI.Betting.GetBettingList({
req: 'bettingNation'
});
year.value = result.year;
month.value = result.month;
yearMonth.value = joinYearMonth(result.year, result.month);
+3 -1
View File
@@ -25,7 +25,9 @@ const apiRealPath = {
GetBettingDetail: NumVar('betting_id',
GET as APICallT<undefined, BettingDetailResponse>
),
GetBettingList: GET as APICallT<undefined, BettingListResponse>,
GetBettingList: GET as APICallT<{
req?: 'bettingNation' | 'tournament'
}, BettingListResponse>,
},
Command: {
GetReservedCommand: GET as APICallT<undefined, ReservedCommandResponse>,
+1 -1
View File
@@ -26,7 +26,7 @@ export type BettingInfo = {
reqInheritancePoint: boolean;
openYearMonth: number;
closeYearMonth: number;
candidates: Record<number, SelectItem>;
candidates: Record<string, SelectItem>;
winner?: number[];
}