betting-history 진행중
This commit is contained in:
parent
9b16bf5b34
commit
609b8eb81e
|
@ -1,8 +1,12 @@
|
||||||
import { Route } from '@angular/router';
|
import { Route } from '@angular/router';
|
||||||
|
import { ListAllMemberResolver } from 'app/shared/resolvers/member.resolver';
|
||||||
|
|
||||||
import { ListComponent } from './components/list.component';
|
import { ListComponent } from './components/list.component';
|
||||||
|
|
||||||
import { CasinosResolver } from './resolvers/casino.resolver';
|
import {
|
||||||
|
CasinosResolver,
|
||||||
|
ListCasinosResolver,
|
||||||
|
} from './resolvers/casino.resolver';
|
||||||
|
|
||||||
export const casinoRoutes: Route[] = [
|
export const casinoRoutes: Route[] = [
|
||||||
{
|
{
|
||||||
|
@ -10,6 +14,8 @@ export const casinoRoutes: Route[] = [
|
||||||
component: ListComponent,
|
component: ListComponent,
|
||||||
resolve: {
|
resolve: {
|
||||||
deposits: CasinosResolver,
|
deposits: CasinosResolver,
|
||||||
|
listBettingHistory: ListCasinosResolver,
|
||||||
|
listMember: ListAllMemberResolver,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -146,8 +146,8 @@
|
||||||
<div
|
<div
|
||||||
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto"
|
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto"
|
||||||
>
|
>
|
||||||
<ng-container *ngIf="casinos$ | async as casinos">
|
<ng-container *ngIf="bettingHistorys$ | async as bettingHistorys">
|
||||||
<ng-container *ngIf="casinos.length > 0; else noCasino">
|
<ng-container *ngIf="bettingHistorys.length > 0; else noCasino">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div
|
<div
|
||||||
|
@ -169,46 +169,44 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Rows -->
|
<!-- Rows -->
|
||||||
<ng-container *ngIf="casinos$ | async as casinos">
|
<ng-container *ngIf="bettingHistorys$ | async as bettingHistorys">
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngFor="let casino of casinos; trackBy: __trackByFn"
|
*ngFor="let info of bettingHistorys; trackBy: __trackByFn"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="casino-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
|
class="casino-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
|
||||||
>
|
>
|
||||||
<div>{{ casino.highRank }}</div>
|
<div>{{ __getParentMemberByBettingHistory(info) }}</div>
|
||||||
<div>
|
<div>
|
||||||
게임ID{{ casino.gameId }}
|
게임ID: {{ info.getSiteUsername() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
사이트ID{{ casino.signinId }}
|
사이트ID{{ info.getSiteUsername() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
닉네임{{ casino.nickname }}
|
닉네임{{ info.getMember()?.getNickname() }}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ casino.gameName }}
|
{{ info.getVendorName() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ casino.gameInfo1 }}
|
{{ info.getGameName() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ casino.gameInfo2 }}
|
{{ info.getGameId() }}
|
||||||
<hr style="margin: 7px 0px" />
|
|
||||||
{{ casino.gameInfo3 }}
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{ casino.gameType }}
|
{{ info.getBettingType() }}
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden sm:block">
|
<div class="hidden sm:block">
|
||||||
당첨전{{ casino.beforeWinning }}
|
배팅: {{ info.getCash() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
당첨{{ casino.winning }}
|
당첨: {{ info.getAfterCash() - info.getBeforeCash() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
당첨후{{ casino.afterWinning }}
|
손익: {{ info.getAfterCash() - info.getBeforeCash() }}
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
{{ casino.bettingInfo1 }}
|
배팅전: {{ info.getBeforeCash() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ casino.bettingInfo2 }}
|
배팅후: {{ info.getAfterCash() - info.getBeforeCash() }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ casino.bettingInfo3 }}
|
최종금액: {{ info.getAfterCash() }}
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
<button
|
<button
|
||||||
|
@ -220,37 +218,25 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden md:block">
|
<div class="hidden md:block">
|
||||||
{{ casino.comp }}
|
{{ __getCompType(info) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
본사{{ casino.mainofficeName }}({{
|
본사100P
|
||||||
casino.mainofficePercent
|
|
||||||
}}% : {{ casino.mainofficePoint }}P)
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
대본{{ casino.branchName }}({{
|
대본100P
|
||||||
casino.branchPercent
|
|
||||||
}}% : {{ casino.branchPoint }}P)
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
부본{{ casino.divisionName }}({{
|
부본100P
|
||||||
casino.divisionPercent
|
|
||||||
}}% : {{ casino.divisionPoint }}P)
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
총판{{ casino.officeName }}({{
|
총판120P
|
||||||
casino.officePercent
|
|
||||||
}}% : {{ casino.officePoint }}P)
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
매장{{ casino.storeName }}({{
|
매장100P
|
||||||
casino.storePercent
|
|
||||||
}}% : {{ casino.storePoint }}P)
|
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
회원{{ casino.memberName }}({{
|
회원100p
|
||||||
casino.memberPercent
|
|
||||||
}}% : {{ casino.memberPoint }}P)
|
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden lg:block">
|
<div class="hidden lg:block">
|
||||||
{{ casino.bettingTime }}
|
{{ info.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}
|
||||||
<hr style="margin: 7px 0px" />
|
<hr style="margin: 7px 0px" />
|
||||||
{{ casino.registrationDate }}
|
{{ info.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
|
@ -22,6 +22,7 @@ import {
|
||||||
map,
|
map,
|
||||||
merge,
|
merge,
|
||||||
Observable,
|
Observable,
|
||||||
|
of,
|
||||||
Subject,
|
Subject,
|
||||||
switchMap,
|
switchMap,
|
||||||
takeUntil,
|
takeUntil,
|
||||||
|
@ -32,6 +33,12 @@ 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 { ListBettingHistoryResponse } from 'app/modules/proto/c2se/api/betting_pb';
|
||||||
|
import { BettingHistoryModel } from 'app/modules/proto/models/api/betting_pb';
|
||||||
|
import { MemberModel } from 'app/modules/proto/models/member_pb';
|
||||||
|
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
|
||||||
|
import { environment } from 'environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'casino-list',
|
selector: 'casino-list',
|
||||||
|
@ -69,6 +76,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
@ViewChild(MatSort) private _sort!: MatSort;
|
@ViewChild(MatSort) private _sort!: MatSort;
|
||||||
|
|
||||||
casinos$!: Observable<Casino[] | undefined>;
|
casinos$!: Observable<Casino[] | undefined>;
|
||||||
|
bettingHistorys$!: Observable<BettingHistoryModel[]>;
|
||||||
|
|
||||||
|
listMember!: MemberModel[];
|
||||||
|
|
||||||
|
mainOfficeId = environment.constants.classeIds.mainOffice;
|
||||||
|
branchId = environment.constants.classeIds.branch;
|
||||||
|
divisionId = environment.constants.classeIds.division;
|
||||||
|
officeId = environment.constants.classeIds.office;
|
||||||
|
storeId = environment.constants.classeIds.store;
|
||||||
|
|
||||||
__isSearchOpened = false;
|
__isSearchOpened = false;
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
@ -83,6 +99,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _changeDetectorRef: ChangeDetectorRef,
|
private _changeDetectorRef: ChangeDetectorRef,
|
||||||
|
private _activatedRoute: ActivatedRoute,
|
||||||
private _fuseConfirmationService: FuseConfirmationService,
|
private _fuseConfirmationService: FuseConfirmationService,
|
||||||
private _formBuilder: FormBuilder,
|
private _formBuilder: FormBuilder,
|
||||||
private _casinoService: CasinoService
|
private _casinoService: CasinoService
|
||||||
|
@ -109,6 +126,22 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
// Get the products
|
// Get the products
|
||||||
this.casinos$ = this._casinoService.casinos$;
|
this.casinos$ = this._casinoService.casinos$;
|
||||||
|
|
||||||
|
// Get the products
|
||||||
|
this._activatedRoute.data.subscribe((data) => {
|
||||||
|
let listBettingHistoryResult: ListBettingHistoryResponse.Result =
|
||||||
|
data['listBettingHistory'];
|
||||||
|
let listMemberResult: ListMembersResponse.Result = data['listMember'];
|
||||||
|
|
||||||
|
this.listMember = listMemberResult.getMembersList();
|
||||||
|
|
||||||
|
const listBettingHistory =
|
||||||
|
listBettingHistoryResult.getBettingHistoryList();
|
||||||
|
this.bettingHistorys$ = of(listBettingHistory);
|
||||||
|
|
||||||
|
// Mark for check
|
||||||
|
this._changeDetectorRef.markForCheck();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,4 +233,48 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
__trackByFn(index: number, item: any): any {
|
__trackByFn(index: number, item: any): any {
|
||||||
return item.id || index;
|
return item.id || index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__getCompType(info: BettingHistoryModel): string {
|
||||||
|
const member = this.__getMemberByUsername(info.getSiteUsername());
|
||||||
|
|
||||||
|
const type = member?.getMemberSettlementSetting()?.getCanPerChargeComp();
|
||||||
|
|
||||||
|
return !!type ? 'Y' : 'N';
|
||||||
|
}
|
||||||
|
|
||||||
|
__getMemberSettlementByParentId(
|
||||||
|
parentId: string,
|
||||||
|
type: string
|
||||||
|
): MemberModel | undefined {
|
||||||
|
const parentMember = this.__getMemberByParentId(parentId);
|
||||||
|
if (!!parentMember && parentMember.getMemberClass()?.getId() === type) {
|
||||||
|
return parentMember;
|
||||||
|
}
|
||||||
|
return this.__getMemberSettlementByParentId(parentId, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
__getMemberByParentId(parentId: string): MemberModel | undefined {
|
||||||
|
const findMember = this.listMember.find((v) => v.getId() === parentId);
|
||||||
|
|
||||||
|
return findMember;
|
||||||
|
}
|
||||||
|
__getMemberByUsername(username: string): MemberModel | undefined {
|
||||||
|
const findMember = this.listMember.find(
|
||||||
|
(v) => v.getUsername() === username
|
||||||
|
);
|
||||||
|
|
||||||
|
return findMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
__getParentMemberByBettingHistory(info: BettingHistoryModel): string {
|
||||||
|
const parentId = info.getMember()?.getParentMemberId();
|
||||||
|
|
||||||
|
const pararent = this.listMember.find((v) => v.getId() === parentId);
|
||||||
|
|
||||||
|
const result = `[${pararent
|
||||||
|
?.getMemberClass()
|
||||||
|
?.getName()}]${pararent?.getUsername()}`;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,13 @@ import {
|
||||||
Router,
|
Router,
|
||||||
RouterStateSnapshot,
|
RouterStateSnapshot,
|
||||||
} from '@angular/router';
|
} from '@angular/router';
|
||||||
|
import { BettingService } from 'app/modules/polyglot/api/services/betting.service';
|
||||||
|
import {
|
||||||
|
ListBettingHistoryRequest,
|
||||||
|
ListBettingHistoryResponse,
|
||||||
|
} from 'app/modules/proto/c2se/api/betting_pb';
|
||||||
|
import { Pagination } from 'app/modules/proto/protobuf/pagination_pb';
|
||||||
|
import { environment } from 'environments/environment.prod';
|
||||||
import { catchError, Observable, throwError } from 'rxjs';
|
import { catchError, Observable, throwError } from 'rxjs';
|
||||||
|
|
||||||
import { Casino } from '../models/casino';
|
import { Casino } from '../models/casino';
|
||||||
|
@ -79,6 +86,72 @@ 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ListCasinosResolver implements Resolve<any> {
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(private _bettingService: BettingService) {}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolver
|
||||||
|
*
|
||||||
|
* @param route
|
||||||
|
* @param state
|
||||||
|
*/
|
||||||
|
resolve(
|
||||||
|
route: ActivatedRouteSnapshot,
|
||||||
|
state: RouterStateSnapshot
|
||||||
|
):
|
||||||
|
| Observable<ListBettingHistoryResponse.Result>
|
||||||
|
| Promise<ListBettingHistoryResponse.Result>
|
||||||
|
| ListBettingHistoryResponse.Result {
|
||||||
|
const url = state.url;
|
||||||
|
const startIdx = url.lastIndexOf('/');
|
||||||
|
const target = url.substring(startIdx + 1);
|
||||||
|
|
||||||
|
const req = new ListBettingHistoryRequest();
|
||||||
|
const search = new ListBettingHistoryRequest.Search();
|
||||||
|
const pagination = new Pagination();
|
||||||
|
|
||||||
|
let vendorIds: number[] = [];
|
||||||
|
|
||||||
|
switch (target) {
|
||||||
|
case 'evolution':
|
||||||
|
vendorIds = environment.constants.venderIds.evolutionCasino;
|
||||||
|
break;
|
||||||
|
case 'casino':
|
||||||
|
vendorIds = environment.constants.venderIds.casinos;
|
||||||
|
break;
|
||||||
|
case 'slot':
|
||||||
|
vendorIds = environment.constants.venderIds.slots;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'powerball':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
search.setVendorIdsList(vendorIds);
|
||||||
|
pagination.setPage(1);
|
||||||
|
pagination.setPageSize(10);
|
||||||
|
|
||||||
|
req.setSearch(search);
|
||||||
|
req.setPagination(pagination);
|
||||||
|
|
||||||
|
return this._bettingService.listVendors(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,13 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
constants: {
|
constants: {
|
||||||
|
venderIds: {
|
||||||
|
evolutionCasino: [1],
|
||||||
|
casinos: [2, 26, 60, 68],
|
||||||
|
slots: [3, 6, 24, 28, 47, 49, 50, 52, 54, 57, 58, 59, 61, 67],
|
||||||
|
arcades: [25],
|
||||||
|
fishs: [27],
|
||||||
|
},
|
||||||
classeIds: {
|
classeIds: {
|
||||||
mainOffice: '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
mainOffice: '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
||||||
branch: 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb',
|
branch: 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb',
|
||||||
|
|
|
@ -16,6 +16,13 @@ export const environment: Environment = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
constants: {
|
constants: {
|
||||||
|
venderIds: {
|
||||||
|
evolutionCasino: [1],
|
||||||
|
casinos: [2, 26, 60, 68],
|
||||||
|
slots: [3, 6, 24, 28, 47, 49, 50, 52, 54, 57, 58, 59, 61, 67],
|
||||||
|
arcades: [25],
|
||||||
|
fishs: [27],
|
||||||
|
},
|
||||||
classeIds: {
|
classeIds: {
|
||||||
mainOffice: '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
mainOffice: '4b014ef5-3bab-4413-aaf9-b0040a70ec77',
|
||||||
branch: 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb',
|
branch: 'ae9b874e-5d0e-4c4d-8432-f45f02691ceb',
|
||||||
|
|
|
@ -6,6 +6,13 @@ export interface Environment {
|
||||||
connectionOptions: nats.ConnectionOptions;
|
connectionOptions: nats.ConnectionOptions;
|
||||||
};
|
};
|
||||||
constants: {
|
constants: {
|
||||||
|
venderIds: {
|
||||||
|
evolutionCasino: number[];
|
||||||
|
casinos: number[];
|
||||||
|
slots: number[];
|
||||||
|
arcades: number[];
|
||||||
|
fishs: number[];
|
||||||
|
};
|
||||||
classeIds: {
|
classeIds: {
|
||||||
mainOffice: string;
|
mainOffice: string;
|
||||||
branch: string;
|
branch: string;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user