fix: 국가 베팅장에서 '토너먼트'는 보여주지 않기로
This commit is contained in:
@@ -7,6 +7,7 @@ use DateTimeInterface;
|
|||||||
use sammo\DB;
|
use sammo\DB;
|
||||||
use sammo\DTO\BettingInfo;
|
use sammo\DTO\BettingInfo;
|
||||||
use sammo\KVStorage;
|
use sammo\KVStorage;
|
||||||
|
use sammo\Validator;
|
||||||
|
|
||||||
use function sammo\checkLimit;
|
use function sammo\checkLimit;
|
||||||
use function sammo\increaseRefresh;
|
use function sammo\increaseRefresh;
|
||||||
@@ -15,6 +16,11 @@ class GetBettingList extends \sammo\BaseAPI
|
|||||||
{
|
{
|
||||||
public function validateArgs(): ?string
|
public function validateArgs(): ?string
|
||||||
{
|
{
|
||||||
|
$v = new Validator($this->args);
|
||||||
|
$v->rule('in', 'req', ['bettingNation', 'tournament']);
|
||||||
|
if (!$v->validate()) {
|
||||||
|
return $v->errorStr();
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,6 +33,8 @@ class GetBettingList extends \sammo\BaseAPI
|
|||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
|
|
||||||
|
$reqType = $this->args['req'] ?? null;
|
||||||
|
|
||||||
increaseRefresh("베팅장", 1);
|
increaseRefresh("베팅장", 1);
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
@@ -42,6 +50,9 @@ class GetBettingList extends \sammo\BaseAPI
|
|||||||
$bettingList = [];
|
$bettingList = [];
|
||||||
foreach ($bettingStor->getAll() as $_key => $rawItem) {
|
foreach ($bettingStor->getAll() as $_key => $rawItem) {
|
||||||
$item = new BettingInfo($rawItem);
|
$item = new BettingInfo($rawItem);
|
||||||
|
if ($reqType !== null && $item->type != $reqType) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
unset($rawItem['candidates']);
|
unset($rawItem['candidates']);
|
||||||
$bettingList[$item->id] = $rawItem;
|
$bettingList[$item->id] = $rawItem;
|
||||||
$bettingList[$item->id]['totalAmount'] = 0;
|
$bettingList[$item->id]['totalAmount'] = 0;
|
||||||
@@ -49,7 +60,7 @@ class GetBettingList extends \sammo\BaseAPI
|
|||||||
|
|
||||||
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
|
||||||
|
|
||||||
if(!$bettingList){
|
if (!$bettingList) {
|
||||||
return [
|
return [
|
||||||
'result' => true,
|
'result' => true,
|
||||||
'bettingList' => $bettingList,
|
'bettingList' => $bettingList,
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ function addToast(msg: ToastType) {
|
|||||||
console.log("시작!");
|
console.log("시작!");
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const result = await SammoAPI.Betting.GetBettingList();
|
const result = await SammoAPI.Betting.GetBettingList({
|
||||||
|
req: 'bettingNation'
|
||||||
|
});
|
||||||
year.value = result.year;
|
year.value = result.year;
|
||||||
month.value = result.month;
|
month.value = result.month;
|
||||||
yearMonth.value = joinYearMonth(result.year, result.month);
|
yearMonth.value = joinYearMonth(result.year, result.month);
|
||||||
|
|||||||
+3
-1
@@ -25,7 +25,9 @@ const apiRealPath = {
|
|||||||
GetBettingDetail: NumVar('betting_id',
|
GetBettingDetail: NumVar('betting_id',
|
||||||
GET as APICallT<undefined, BettingDetailResponse>
|
GET as APICallT<undefined, BettingDetailResponse>
|
||||||
),
|
),
|
||||||
GetBettingList: GET as APICallT<undefined, BettingListResponse>,
|
GetBettingList: GET as APICallT<{
|
||||||
|
req?: 'bettingNation' | 'tournament'
|
||||||
|
}, BettingListResponse>,
|
||||||
},
|
},
|
||||||
Command: {
|
Command: {
|
||||||
GetReservedCommand: GET as APICallT<undefined, ReservedCommandResponse>,
|
GetReservedCommand: GET as APICallT<undefined, ReservedCommandResponse>,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export type BettingInfo = {
|
|||||||
reqInheritancePoint: boolean;
|
reqInheritancePoint: boolean;
|
||||||
openYearMonth: number;
|
openYearMonth: number;
|
||||||
closeYearMonth: number;
|
closeYearMonth: number;
|
||||||
candidates: Record<number, SelectItem>;
|
candidates: Record<string, SelectItem>;
|
||||||
winner?: number[];
|
winner?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user