배팅 리스트 롤링 수정

This commit is contained in:
Park Byung Eun 2022-09-02 06:09:40 +00:00
parent c555761b8c
commit 30fc6c3afa
13 changed files with 165 additions and 951 deletions

View File

@ -296,8 +296,8 @@ export const appRoutes: Route[] = [
{ {
path: 'evolution', path: 'evolution',
loadChildren: () => loadChildren: () =>
import('app/modules/admin/game/evolution/evolution.module').then( import('app/modules/admin/game/casino/casino.module').then(
(m: any) => m.EvolutionModule (m: any) => m.CasinoModule
), ),
}, },
{ {

View File

@ -10,7 +10,7 @@
<mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar> <mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
</div> </div>
<!-- Title --> <!-- Title -->
<div class="text-4xl font-extrabold tracking-tight">카지노배팅리스트</div> <div class="text-4xl font-extrabold tracking-tight">{{ title }}</div>
<!-- Actions --> <!-- Actions -->
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4"> <div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<button mat-icon-button (click)="__onClickSearch()"> <button mat-icon-button (click)="__onClickSearch()">
@ -154,11 +154,35 @@
class="casino-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5" class="casino-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5"
> >
<div>상부</div> <div>상부</div>
<div>유저</div> <div>
<div>게임</div> 게임코드ID
<hr style="margin: 7px 0px" />
사이트ID
<hr style="margin: 7px 0px" />
닉네임
</div>
<div>
게임사이름
<hr style="margin: 7px 0px" />
게임 이름
<hr style="margin: 7px 0px" />
배팅고유코드
</div>
<div>형식</div> <div>형식</div>
<div class="hidden sm:block">금액</div> <div class="hidden sm:block">
<div class="hidden md:block">배팅</div> 배팅
<hr style="margin: 7px 0px" />
당첨
<hr style="margin: 7px 0px" />
손익
</div>
<div class="hidden md:block">
배팅전
<hr style="margin: 7px 0px" />
배팅 후
<hr style="margin: 7px 0px" />
최종금액
</div>
<div class="hidden md:block">데이터</div> <div class="hidden md:block">데이터</div>
<div class="hidden md:block">콤프</div> <div class="hidden md:block">콤프</div>
<div class="hidden lg:block">롤링</div> <div class="hidden lg:block">롤링</div>
@ -178,11 +202,11 @@
> >
<div>{{ __getParentMemberByBettingHistory(info) }}</div> <div>{{ __getParentMemberByBettingHistory(info) }}</div>
<div> <div>
게임ID: {{ info.getSiteUsername() }} {{ info.getSiteUsername() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
사이트ID: {{ info.getSiteUsername() }} {{ info.getSiteUsername() }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
닉네임: {{ info.getMember()?.getNickname() }} {{ info.getMember()?.getNickname() }}
</div> </div>
<div> <div>
{{ info.getVendorName() }} {{ info.getVendorName() }}
@ -192,34 +216,33 @@
{{ info.getGameId() }} {{ info.getGameId() }}
</div> </div>
<div> <div>
{{ info.getBettingType() }} {{ info.getBettingType() ? "베팅" : "배팅" }}
</div> </div>
<div class="hidden sm:block"> <div class="hidden sm:block">
배팅: {{ info.getCash() | currency: "KRW":"symbol" }} {{ info.getCash() | currency: "KRW":"symbol" }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
당첨:
{{ {{
info.getAfterCash() - info.getBeforeCash() info.getAfterCash() - info.getBeforeCash()
| currency: "KRW":"symbol" | currency: "KRW":"symbol"
}} }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
손익:
{{ {{
info.getAfterCash() - info.getBeforeCash() info.getAfterCash() - info.getBeforeCash()
| currency: "KRW":"symbol" | currency: "KRW":"symbol"
}} }}
</div> </div>
<div class="hidden md:block"> <div class="hidden md:block">
배팅전:
{{ info.getBeforeCash() | currency: "KRW":"symbol" }} {{ info.getBeforeCash() | currency: "KRW":"symbol" }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
배팅후:
{{ {{
info.getAfterCash() - info.getBeforeCash() info.getAfterCash() - info.getBeforeCash()
| currency: "KRW":"symbol" | currency: "KRW":"symbol"
}} }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
최종금액:
{{ info.getAfterCash() | currency: "KRW":"symbol" }} {{ info.getAfterCash() | currency: "KRW":"symbol" }}
</div> </div>
<div class="hidden md:block"> <div class="hidden md:block">
@ -234,18 +257,20 @@
<div class="hidden md:block"> <div class="hidden md:block">
{{ __getCompType(info) }} {{ __getCompType(info) }}
</div> </div>
<div class="hidden lg:block"> <div
본사100P class="hidden lg:block"
*ngIf="info.getBettingType() !== 'turn_win'"
>
본사:
{{ __getCalculateRollingRate(info, MAIN_OFFICE_ID) }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
대본100P 대본: {{ __getCalculateRollingRate(info, BRANCH_ID) }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
부본100P 부본: {{ __getCalculateRollingRate(info, DIVISION_ID) }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
총판120P 총판: {{ __getCalculateRollingRate(info, OFFICE_ID) }}
<hr style="margin: 7px 0px" /> <hr style="margin: 7px 0px" />
매장100P 매장: {{ __getCalculateRollingRate(info, STORE_ID) }}
<hr style="margin: 7px 0px" />
회원100p
</div> </div>
<div class="hidden lg:block"> <div class="hidden lg:block">
{{ info.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }} {{ info.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}

View File

@ -33,10 +33,13 @@ import { FuseConfirmationService } from '@fuse/services/confirmation';
import { Casino } from '../models/casino'; import { Casino } from '../models/casino';
import { CasinoPagination } from '../models/casino-pagination'; import { CasinoPagination } from '../models/casino-pagination';
import { CasinoService } from '../services/casino.service'; import { CasinoService } from '../services/casino.service';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { ListBettingHistoryResponse } from 'app/modules/proto/c2se/api/betting_pb'; import { ListBettingHistoryResponse } from 'app/modules/proto/c2se/api/betting_pb';
import { BettingHistoryModel } from 'app/modules/proto/models/api/betting_pb'; import { BettingHistoryModel } from 'app/modules/proto/models/api/betting_pb';
import { MemberModel } from 'app/modules/proto/models/member_pb'; import {
MemberModel,
ParentMemberModel,
} from 'app/modules/proto/models/member_pb';
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb'; import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
import { environment } from 'environments/environment'; import { environment } from 'environments/environment';
@ -80,11 +83,13 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
listMember!: MemberModel[]; listMember!: MemberModel[];
mainOfficeId = environment.constants.classeIds.mainOffice; MAIN_OFFICE_ID = environment.constants.classeIds.mainOffice;
branchId = environment.constants.classeIds.branch; BRANCH_ID = environment.constants.classeIds.branch;
divisionId = environment.constants.classeIds.division; DIVISION_ID = environment.constants.classeIds.division;
officeId = environment.constants.classeIds.office; OFFICE_ID = environment.constants.classeIds.office;
storeId = environment.constants.classeIds.store; STORE_ID = environment.constants.classeIds.store;
title: string = '';
__isSearchOpened = false; __isSearchOpened = false;
isLoading = false; isLoading = false;
@ -100,6 +105,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
*/ */
constructor( constructor(
private _changeDetectorRef: ChangeDetectorRef, private _changeDetectorRef: ChangeDetectorRef,
private _router: Router,
private _activatedRoute: ActivatedRoute, private _activatedRoute: ActivatedRoute,
private _fuseConfirmationService: FuseConfirmationService, private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
@ -114,6 +120,22 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
* On init * On init
*/ */
ngOnInit(): void { ngOnInit(): void {
const url = this._router.url;
const startIdx = url.lastIndexOf('/');
const target = url.substring(startIdx + 1);
switch (target) {
case 'evolution':
this.title = '에볼루션배팅리스트';
break;
case 'casino':
this.title = '카지노배팅리스트';
break;
default:
break;
}
// Get the pagination // Get the pagination
this._casinoService.pagination$ this._casinoService.pagination$
.pipe(takeUntil(this._unsubscribeAll)) .pipe(takeUntil(this._unsubscribeAll))
@ -138,6 +160,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
const listBettingHistory = const listBettingHistory =
listBettingHistoryResult.getBettingHistoryList(); listBettingHistoryResult.getBettingHistoryList();
this.bettingHistorys$ = of(listBettingHistory); this.bettingHistorys$ = of(listBettingHistory);
this.__casinoTotalCount = listBettingHistoryResult.getTotalCount(); this.__casinoTotalCount = listBettingHistoryResult.getTotalCount();
@ -244,22 +267,94 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
return !!type ? 'Y' : 'N'; return !!type ? 'Y' : 'N';
} }
__getMemberSettlementByParentId( __getCalculateRollingRate(
parentId: string, info: BettingHistoryModel,
type: string classId: string
): MemberModel | undefined { ): string {
const parentMember = this.__getMemberByParentId(parentId); let result: string = '';
if (!!parentMember && parentMember.getMemberClass()?.getId() === type) {
return parentMember; if (info.getBettingType() === 'turn_win') {
} return result;
return this.__getMemberSettlementByParentId(parentId, type);
} }
__getMemberByParentId(parentId: string): MemberModel | undefined { const parentClassId = info
const findMember = this.listMember.find((v) => v.getId() === parentId); .getMember()
?.getParentMember()
?.getMemberClass()
?.getId();
const gameCategoryeType = info.getGameCategory();
const gameType = info.getGameType().toLocaleLowerCase();
const isBaccarat = gameType.includes('baccarat');
const isRoulette = gameType.includes('isRoulette');
return findMember; let targetMember: MemberModel | ParentMemberModel | undefined;
let rate = 0;
if (classId === parentClassId) {
targetMember = info.getMember()?.getParentMember();
} else {
targetMember = this.__getMemberByParentMemberAndClassId(
info.getMember()?.getParentMember(),
classId
);
} }
// casino & baccarat
// casino & craps
// casino & roulette
// casino & instantroulette
if (gameCategoryeType === 'casino') {
if (!!isBaccarat) {
rate =
targetMember?.getMemberSettlementSetting()?.getRateCasinoBacara() ||
0;
} else if (!!isRoulette) {
rate =
targetMember?.getMemberSettlementSetting()?.getRateCasinoRoulette() ||
0;
} else {
targetMember?.getMemberSettlementSetting()?.getRateCasino() || 0;
}
} else if (gameCategoryeType === 'slot') {
rate = targetMember?.getMemberSettlementSetting()?.getRateSlot() || 0;
} else {
rate = 0;
}
const betCash = info.getCash();
const point = betCash * (rate / 100);
result = `${targetMember?.getUsername()}(${rate}% ${point}P)`;
return result;
}
__getMemberByParentMemberAndClassId(
parentMember: ParentMemberModel | undefined,
classId: string
): ParentMemberModel | undefined {
if (!parentMember) {
return;
}
const pp = this.listMember.find((v) => v.getId() === parentMember.getId());
if (
!!pp &&
!!pp.getParentMember()?.getMemberClass() &&
pp.getParentMember()?.getMemberClass()?.getId() === classId
) {
return pp.getParentMember();
} else {
return this.__getMemberByParentMemberAndClassId(
pp?.getParentMember(),
classId
);
}
}
__getMemberByUsername(username: string): MemberModel | undefined { __getMemberByUsername(username: string): MemberModel | undefined {
const findMember = this.listMember.find( const findMember = this.listMember.find(
(v) => v.getUsername() === username (v) => v.getUsername() === username

View File

@ -86,8 +86,6 @@ export class CasinosResolver implements Resolve<any> {
pagination: CasinoPagination; pagination: CasinoPagination;
casinos: Casino[]; casinos: Casino[];
}> { }> {
console.log('state.children: ', state.url);
return this._casinoService.getCasinos(); return this._casinoService.getCasinos();
} }
} }
@ -130,17 +128,14 @@ export class ListCasinosResolver implements Resolve<any> {
switch (target) { switch (target) {
case 'evolution': case 'evolution':
route.data;
vendorIds = environment.constants.venderIds.evolutionCasino; vendorIds = environment.constants.venderIds.evolutionCasino;
break; break;
case 'casino': case 'casino':
vendorIds = environment.constants.venderIds.casinos; vendorIds = environment.constants.venderIds.casinos;
break; break;
case 'slot':
vendorIds = environment.constants.venderIds.slots;
break;
case 'powerball':
break;
default: default:
break; break;
} }

View File

@ -1,3 +0,0 @@
import { ListComponent } from './list.component';
export const COMPONENTS = [ListComponent];

View File

@ -1,334 +0,0 @@
<div
class="sm:absolute sm:inset-0 flex flex-col flex-auto min-w-0 sm:overflow-hidden bg-card dark:bg-transparent"
>
<!-- Header -->
<div
class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-8 px-6 md:px-8 border-b"
>
<!-- Loader -->
<div class="absolute inset-x-0 bottom-0" *ngIf="isLoading">
<mat-progress-bar [mode]="'indeterminate'"></mat-progress-bar>
</div>
<!-- Title -->
<div class="text-4xl font-extrabold tracking-tight">에볼루션베팅리스트</div>
<!-- 슬롯 게임 요약 정보 -->
<div
class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
></div>
<!-- Actions -->
<div class="flex shrink-0 items-center mt-6 sm:mt-0 sm:ml-4">
<!-- Search -->
<button mat-icon-button (click)="__onClickSearch()">
<mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
</button>
</div>
</div>
<div
class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
style="font-size: small"
>
<div class="flex items-center justify-center px-6 py-4 space-x-3">
<div class="grid grid-cols-2 gap-x-4 gap-y-1">
<div class="font-medium tracking-tight text-secondary">기간</div>
<div class="font-medium" style="color: blue">
2022-06-01 00:00 ~ 2022-06-21 23:59 까지
</div>
<div class="font-medium tracking-tight text-secondary">
총 유효배팅 | 배팅금액
</div>
<div class="font-medium" style="color: red">816,335원 | 816,335원</div>
<div class="font-medium tracking-tight text-secondary">
당첨 | 취소 | 배팅-당첨-취소
</div>
<div class="font-medium" style="color: red">717,335원 | 0원 98,847</div>
<div class="font-medium tracking-tight text-secondary">
본사롤링 | 대본롤링 | 부본롤링 | 총판 롤링 | 매장롤링 | 회원롤링
</div>
<div class="font-medium" style="color: red">
6,335원 | 1,663원 | 1,633원 | 2,304원 | 5,544원 | 6,119원
</div>
<div class="font-medium tracking-tight text-secondary">롤링합계</div>
<div class="font-medium">3,9041원</div>
</div>
</div>
</div>
<!-- Search -->
<div
*ngIf="__isSearchOpened"
class="relative flex flex-col sm:flex-row flex-0 sm:items-center sm:justify-between py-4 px-6 md:px-8 border-b"
>
<!-- Actions -->
<div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
<!-- SelectBox -->
<div fxLayout="row wrap" class="items-center mt-6 sm:mt-0 sm:ml-0">
<!-- SelectBox -->
<mat-form-field fxFlex class="bet-mat-form-field-wrapper-mb-0 mr-2">
<mat-select placeholder="전체">
<mat-option value="">전체</mat-option>
<mat-option value="">배팅100만미만</mat-option>
<mat-option value="">배팅100-300만</mat-option>
<mat-option value="">배팅300-500만</mat-option>
<mat-option value="">배팅500만이상</mat-option>
<mat-option value="">당첨1000만초과</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field
class="bet-mat-form-field-wrapper-mb-0 mr-2"
[floatLabel]="'always'"
>
<input
matInput
[matDatepicker]="picker1"
[placeholder]="'Choose a date'"
/>
<mat-datepicker-toggle
matSuffix
[for]="picker1"
></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field
class="bet-mat-form-field-wrapper-mb-0 mr-2"
[floatLabel]="'always'"
>
<input
matInput
[matDatepicker]="picker2"
[placeholder]="'Choose a date'"
/>
<mat-datepicker-toggle
matSuffix
[for]="picker2"
></mat-datepicker-toggle>
<mat-datepicker #picker2></mat-datepicker>
</mat-form-field>
<mat-form-field fxFlex class="bet-mat-form-field-wrapper-mb-0 mr-2">
<mat-select placeholder="검색항목">
<mat-option value="">아이디</mat-option>
<mat-option value="">게임아이디</mat-option>
<mat-option value="">닉네임</mat-option>
<mat-option value="">게임종류</mat-option>
</mat-select>
</mat-form-field>
<!-- Search -->
<mat-form-field
fxFlex
class="fuse-mat-rounded min-w-64 bet-mat-form-field-wrapper-mb-0 mr-2"
>
<mat-icon
class="icon-size-5"
matPrefix
[svgIcon]="'heroicons_solid:search'"
></mat-icon>
<input
matInput
[formControl]="searchInputControl"
[autocomplete]="'off'"
[placeholder]="'Search user'"
/>
</mat-form-field>
<!-- Add user button -->
<button
fxFlex
mat-flat-button
style="position: fixed; margin-top: 4px"
[color]="'primary'"
(click)="__createProduct()"
>
<mat-icon [svgIcon]="'heroicons_outline:search'"></mat-icon>
<span class="ml-2 mr-1">Search</span>
</button>
</div>
</div>
</div>
<!-- Main -->
<div class="flex flex-auto overflow-hidden">
<!-- Products list -->
<div
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto"
>
<ng-container *ngIf="evolutions$ | async as evolutions">
<ng-container *ngIf="evolutions.length > 0; else noUser">
<div class="grid">
<!-- Header -->
<div
class="evolution-grid z-10 sticky top-0 grid gap-4 py-4 px-6 md:px-8 shadow text-md font-semibold text-secondary bg-gray-50 dark:bg-black dark:bg-opacity-5"
>
<div class="hidden lg:block" style="font-size: x-small">상위</div>
<div class="hidden lg:block" style="font-size: x-small">
게임코드ID
<hr style="margin: 7px 0px" />
사이트ID
<hr style="margin: 7px 0px" />
닉네임
</div>
<div class="hidden lg:block" style="font-size: x-small">
게임사이름
<hr style="margin: 7px 0px" />
게임 이름
<hr style="margin: 7px 0px" />
배팅고유코드
</div>
<div class="hidden lg:block" style="font-size: x-small">
배팅
<hr style="margin: 7px 0px" />
당첨
<hr style="margin: 7px 0px" />
손익
</div>
<div class="hidden lg:block" style="font-size: x-small">
배팅 전
<hr style="margin: 7px 0px" />
배팅 후
<hr style="margin: 7px 0px" />
최종금액
</div>
<div class="hidden lg:block" style="font-size: x-small">베팅</div>
<div class="hidden lg:block" style="font-size: x-small">
데이터
<hr style="margin: 7px 0px" />
콤프
</div>
<div class="hidden lg:block" style="font-size: x-small">롤링</div>
<div class="hidden lg:block" style="font-size: x-small">
배팅시간
<hr style="margin: 7px 0px" />
등록시간
</div>
</div>
<!-- Rows -->
<ng-container *ngIf="evolutions$ | async as evolutions">
<ng-container
*ngFor="let info of evolutions; trackBy: __trackByFn"
>
<div
class="evolution-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
style="font-size: x-small"
>
<div class="hidden lg:block">
{{ info.highRank }}
</div>
<div class="hidden lg:block">
{{ info.gameId }}
<hr style="margin: 7px 0px" />
{{ info.signinId }}
<hr style="margin: 7px 0px" />
{{ info.nickname }}
</div>
<div class="hidden lg:block">
{{ info.vendorName }}
<hr style="margin: 7px 0px" />
{{ info.gameName }}
<hr style="margin: 7px 0px" />
{{ info.bettingId }}
</div>
<div class="hidden lg:block">
{{ info.betMoney }}
<hr style="margin: 7px 0px" />
{{ info.betWinMoney }}
<hr style="margin: 7px 0px" />
{{ info.betProfitLossMoney }}
</div>
<div class="hidden lg:block">
{{ info.betBeforeMoney }}
<hr style="margin: 7px 0px" />
{{ info.betAfterMoney }}
<hr style="margin: 7px 0px" />
{{ info.totalMoney }}
</div>
<div>
<div
*ngFor="let betHistory of info.betHistorys"
style="display: flex; flex-wrap: wrap; padding-left: 0"
>
<span style="flex: 0 0 33.33%">{{
betHistory.pickBetType
}}</span>
<span style="flex: 0 0 33.33%">{{
betHistory.betMoney
}}</span>
<span style="flex: 0 0 33.33%">{{
betHistory.betWinMoney
}}</span>
</div>
</div>
<div class="hidden lg:block" style="text-align: center">
<button
mat-flat-button
class="bet-mat-small-6"
[color]="'warn'"
>
<span class="ml-2 mr-1">데이터확인</span>
</button>
<hr style="margin: 7px 0px" />
{{ info.comp }}
</div>
<div class="hidden lg:block">
<span *ngIf="!!info.mainInfo">
본사: {{ info.mainInfo.name }}({{
info.mainInfo.commissionRate
}},{{ info.mainInfo.point }})</span
>
<hr *ngIf="!!info.mainInfo" style="margin: 7px 0px" />
<span *ngIf="!!info.branchInfo"
>대본: {{ info.branchInfo.name }}({{
info.branchInfo.commissionRate
}},{{ info.branchInfo.point }})</span
>
<hr *ngIf="!!info.branchInfo" style="margin: 7px 0px" />
<span *ngIf="!!info.divisionInfo"
>부본: {{ info.divisionInfo.name }}({{
info.divisionInfo.commissionRate
}},{{ info.divisionInfo.point }})</span
>
<hr *ngIf="!!info.divisionInfo" style="margin: 7px 0px" />
<span *ngIf="!!info.officeInfo"
>총판: {{ info.officeInfo.name }}({{
info.officeInfo.commissionRate
}},{{ info.officeInfo.point }})</span
>
<hr *ngIf="!!info.officeInfo" style="margin: 7px 0px" />
<span *ngIf="!!info.storeInfo"
>매장: {{ info.storeInfo.name }}({{
info.storeInfo.commissionRate
}},{{ info.storeInfo.point }})</span
>
</div>
<div class="hidden lg:block">
{{ info.bettingregistrationDate }}
<hr style="margin: 7px 0px" />
{{ info.registrationDate }}
</div>
</div>
</ng-container>
</ng-container>
</div>
<mat-paginator
class="sm:absolute sm:inset-x-0 sm:bottom-0 border-b sm:border-t sm:border-b-0 z-10 bg-gray-50 dark:bg-transparent"
[ngClass]="{ 'pointer-events-none': isLoading }"
[length]="pagination?.length"
[pageIndex]="pagination?.page"
[pageSize]="pagination?.size"
[pageSizeOptions]="[5, 10, 25, 100]"
[showFirstLastButtons]="true"
></mat-paginator>
</ng-container>
</ng-container>
<ng-template #noUser>
<div
class="p-8 sm:p-16 border-t text-4xl font-semibold tracking-tight text-center"
>
There are no data!
</div>
</ng-template>
</div>
</div>
</div>

View File

@ -1,202 +0,0 @@
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
OnDestroy,
OnInit,
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import {
FormBuilder,
FormControl,
FormGroup,
Validators,
} from '@angular/forms';
import { MatCheckboxChange } from '@angular/material/checkbox';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import {
debounceTime,
map,
merge,
Observable,
Subject,
switchMap,
takeUntil,
} from 'rxjs';
import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
import { Evolution } from '../models/evolution';
import { EvolutionPagination } from '../models/evolution-pagination';
import { EvolutionService } from '../services/evolution.service';
@Component({
selector: 'evolution-list',
templateUrl: './list.component.html',
styles: [
/* language=SCSS */
`
.evolution-grid {
/* 상부 유저 게임 금액 최종 */
grid-template-columns: 80px 100px 150px 80px 80px auto 100px 150px 120px;
@screen sm {
/* 상부 유저 게임 금액 최종 배팅 */
grid-template-columns: 80px 100px 150px 80px 80px auto 100px 150px 120px;
}
@screen md {
/* 상부 유저 게임 금액 최종 배팅 데이터 콤프 */
grid-template-columns: 80px 100px 150px 80px 80px auto 100px 150px 120px;
}
@screen lg {
/* 상부 유저 게임 금액 최종 배팅 데이터&콤프 롤링 배팅시간 */
grid-template-columns: 80px 100px 150px 60px 60px auto 80px 150px 120px;
}
}
`,
],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
animations: fuseAnimations,
})
export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
evolutions$!: Observable<Evolution[] | undefined>;
__isSearchOpened = false;
isLoading = false;
searchInputControl = new FormControl();
selectedEvolution?: Evolution;
pagination?: EvolutionPagination;
private _unsubscribeAll: Subject<any> = new Subject<any>();
/**
* Constructor
*/
constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _evolutionService: EvolutionService
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Get the pagination
this._evolutionService.pagination$
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((pagination: EvolutionPagination | undefined) => {
// Update the pagination
this.pagination = pagination;
// Mark for check
this._changeDetectorRef.markForCheck();
});
// Get the products
this.evolutions$ = this._evolutionService.evolutions$;
}
/**
* After view init
*/
ngAfterViewInit(): void {
if (this._sort && this._paginator) {
// Set the initial sort
this._sort.sort({
id: 'signinId',
start: 'asc',
disableClear: true,
});
// Mark for check
this._changeDetectorRef.markForCheck();
// If the evolution changes the sort order...
this._sort.sortChange
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(() => {
// Reset back to the first page
this._paginator.pageIndex = 0;
});
// Get products if sort or page changes
merge(this._sort.sortChange, this._paginator.page)
.pipe(
switchMap(() => {
this.isLoading = true;
return this._evolutionService.getEvolutions(
this._paginator.pageIndex,
this._paginator.pageSize,
this._sort.active,
this._sort.direction
);
}),
map(() => {
this.isLoading = false;
})
)
.subscribe();
}
}
/**
* On destroy
*/
ngOnDestroy(): void {
// Unsubscribe from all subscriptions
this._unsubscribeAll.next(null);
this._unsubscribeAll.complete();
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// @ Private methods
// -----------------------------------------------------------------------------------------------------
/**
* Create product
*/
__createProduct(): void {}
/**
* Toggle product details
*
* @param productId
*/
__toggleDetails(productId: string): void {}
/**
* toggle the search
* Used in 'bar'
*/
__onClickSearch(): void {
this.__isSearchOpened = !this.__isSearchOpened;
}
/**
* Track by function for ngFor loops
*
* @param index
* @param item
*/
__trackByFn(index: number, item: any): any {
return item.id || index;
}
}

View File

@ -1,42 +0,0 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { MatButtonModule } from '@angular/material/button';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatSelectModule } from '@angular/material/select';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatMomentDateModule } from '@angular/material-moment-adapter';
import { TranslocoModule } from '@ngneat/transloco';
import { SharedModule } from 'app/shared/shared.module';
import { COMPONENTS } from './components';
import { evolutionRoutes } from './evolution.routing';
@NgModule({
declarations: [COMPONENTS],
imports: [
TranslocoModule,
SharedModule,
RouterModule.forChild(evolutionRoutes),
MatButtonModule,
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatPaginatorModule,
MatProgressBarModule,
MatSortModule,
MatSelectModule,
MatDatepickerModule,
MatMomentDateModule,
],
})
export class EvolutionModule {}

View File

@ -1,15 +0,0 @@
import { Route } from '@angular/router';
import { ListComponent } from './components/list.component';
import { EvolutionsResolver } from './resolvers/evolution.resolver';
export const evolutionRoutes: Route[] = [
{
path: '',
component: ListComponent,
resolve: {
deposits: EvolutionsResolver,
},
},
];

View File

@ -1,8 +0,0 @@
export interface EvolutionPagination {
length: number;
size: number;
page: number;
lastPage: number;
startIndex: number;
endIndex: number;
}

View File

@ -1,52 +0,0 @@
export interface Evolution {
id: string;
signinId?: string;
highRank?: string;
gameId?: string;
nickname?: string;
vendorName?: string;
gameName?: string;
bettingId?: string;
betStatus?: string;
betMoney?: string;
betWinMoney?: string;
betBeforeMoney?: string;
betProfitLossMoney?: string;
betAfterMoney?: string;
totalMoney?: string;
comp?: string;
betHistorys?: [
{
pickBetType?: string;
betMoney?: string;
betWinMoney?: string;
}
];
mainInfo?: {
name?: string;
commissionRate?: string;
point?: string;
};
branchInfo?: {
name?: string;
commissionRate?: string;
point?: string;
};
divisionInfo?: {
name?: string;
commissionRate?: string;
point?: string;
};
officeInfo?: {
name?: string;
commissionRate?: string;
point?: string;
};
storeInfo?: {
name?: string;
commissionRate?: string;
point?: string;
};
bettingregistrationDate?: string;
registrationDate?: string;
}

View File

@ -1,89 +0,0 @@
import { Injectable } from '@angular/core';
import {
ActivatedRouteSnapshot,
Resolve,
Router,
RouterStateSnapshot,
} from '@angular/router';
import { catchError, Observable, throwError } from 'rxjs';
import { Evolution } from '../models/evolution';
import { EvolutionPagination } from '../models/evolution-pagination';
import { EvolutionService } from '../services/evolution.service';
@Injectable({
providedIn: 'root',
})
export class EvolutionResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(
private _evolutionService: EvolutionService,
private _router: Router
) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<Evolution | undefined> {
return this._evolutionService
.getEvolutionById(route.paramMap.get('id'))
.pipe(
// Error here means the requested product is not available
catchError((error) => {
// Log the error
console.error(error);
// Get the parent url
const parentUrl = state.url.split('/').slice(0, -1).join('/');
// Navigate to there
this._router.navigateByUrl(parentUrl);
// Throw an error
return throwError(error);
})
);
}
}
@Injectable({
providedIn: 'root',
})
export class EvolutionsResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _evolutionService: EvolutionService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<{
pagination: EvolutionPagination;
evolutions: Evolution[];
}> {
return this._evolutionService.getEvolutions();
}
}

View File

@ -1,156 +0,0 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {
BehaviorSubject,
filter,
map,
Observable,
of,
switchMap,
take,
tap,
throwError,
} from 'rxjs';
import { Evolution } from '../models/evolution';
import { EvolutionPagination } from '../models/evolution-pagination';
@Injectable({
providedIn: 'root',
})
export class EvolutionService {
// Private
private __pagination = new BehaviorSubject<EvolutionPagination | undefined>(
undefined
);
private __evolution = new BehaviorSubject<Evolution | undefined>(undefined);
private __evolutions = new BehaviorSubject<Evolution[] | undefined>(
undefined
);
/**
* Constructor
*/
constructor(private _httpClient: HttpClient) {}
// -----------------------------------------------------------------------------------------------------
// @ Accessors
// -----------------------------------------------------------------------------------------------------
/**
* Getter for pagination
*/
get pagination$(): Observable<EvolutionPagination | undefined> {
return this.__pagination.asObservable();
}
/**
* Getter for evolution
*/
get evolution$(): Observable<Evolution | undefined> {
return this.__evolution.asObservable();
}
/**
* Getter for evolutions
*/
get evolutions$(): Observable<Evolution[] | undefined> {
return this.__evolutions.asObservable();
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Get evolutions
*
*
* @param page
* @param size
* @param sort
* @param order
* @param search
*/
getEvolutions(
page: number = 0,
size: number = 10,
sort: string = 'nickname',
order: 'asc' | 'desc' | '' = 'asc',
search: string = ''
): Observable<{
pagination: EvolutionPagination;
evolutions: Evolution[];
}> {
return this._httpClient
.get<{ pagination: EvolutionPagination; evolutions: Evolution[] }>(
'api/apps/game/evolution/evolutions',
{
params: {
page: '' + page,
size: '' + size,
sort,
order,
search,
},
}
)
.pipe(
tap((response) => {
this.__pagination.next(response.pagination);
this.__evolutions.next(response.evolutions);
})
);
}
/**
* Get product by id
*/
getEvolutionById(id: string | null): Observable<Evolution> {
return this.__evolutions.pipe(
take(1),
map((evolutions) => {
// Find the product
const evolution =
evolutions?.find((item) => item.id === id) || undefined;
// Update the product
this.__evolution.next(evolution);
// Return the product
return evolution;
}),
switchMap((product) => {
if (!product) {
return throwError('Could not found product with id of ' + id + '!');
}
return of(product);
})
);
}
/**
* Create product
*/
createEvolution(): Observable<Evolution> {
return this.evolutions$.pipe(
take(1),
switchMap((evolutions) =>
this._httpClient
.post<Evolution>('api/apps/game/evolution/product', {})
.pipe(
map((newEvolution) => {
// Update the evolutions with the new product
if (!!evolutions) {
this.__evolutions.next([newEvolution, ...evolutions]);
}
// Return the new product
return newEvolution;
})
)
)
);
}
}