game model modify
This commit is contained in:
parent
de2ec9e203
commit
fc63ed127a
|
@ -5,63 +5,73 @@ import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { CollectionViewer } from '@angular/cdk/collections';
|
import { CollectionViewer } from '@angular/cdk/collections';
|
||||||
|
|
||||||
import { BetHistory } from 'src/modules/game/model/bet-history.model';
|
import { BettingHistory } from 'src/modules/game/model/betting-history.model';
|
||||||
import { BetHistoryService } from 'src/modules/game/service/bet-historyservice';
|
import { BettingHistoryService } from 'src/modules/game/service/betting-history.service';
|
||||||
|
|
||||||
import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms';
|
import { FormControl, FormGroup, Validators, FormArray } from '@angular/forms';
|
||||||
|
import { BettingResultName } from 'src/modules/game/type/betting-result.type';
|
||||||
|
|
||||||
const ELEMENT_DATA: BetHistory[] = [
|
const ELEMENT_DATA: BettingHistory[] = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
thumbNail: '/images/thumbname/1.jpg',
|
league: 1,
|
||||||
title: '오픈기념 이벤트',
|
sportsEvents: null,
|
||||||
imageWidth: 200,
|
user: 1,
|
||||||
imageHeight: 200,
|
moneyLog: 20000,
|
||||||
imageX: 100,
|
bettingMoney: 10000,
|
||||||
imageY: 100,
|
predictMoney: 100,
|
||||||
openStatus: true,
|
realMoney: 11111,
|
||||||
|
bettingResult: BettingResultName.FAILURE,
|
||||||
|
createdBy: 1,
|
||||||
|
updatedBy: 1,
|
||||||
updatedAt: null,
|
updatedAt: null,
|
||||||
createdAt: null
|
createdAt: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
thumbNail: '/images/thumbname/2.jpg',
|
league: 1,
|
||||||
title: '첫충전 이벤트',
|
sportsEvents: null,
|
||||||
imageWidth: 200,
|
user: 1,
|
||||||
imageHeight: 200,
|
moneyLog: 20000,
|
||||||
imageX: 100,
|
bettingMoney: 10000,
|
||||||
imageY: 100,
|
predictMoney: 100,
|
||||||
openStatus: true,
|
realMoney: 11111,
|
||||||
|
bettingResult: BettingResultName.FAILURE,
|
||||||
|
createdBy: 1,
|
||||||
|
updatedBy: 1,
|
||||||
updatedAt: null,
|
updatedAt: null,
|
||||||
createdAt: null
|
createdAt: null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
thumbNail: '/images/thumbname/3.jpg',
|
league: 1,
|
||||||
title: '친구초대 이벤트',
|
sportsEvents: null,
|
||||||
imageWidth: 200,
|
user: 1,
|
||||||
imageHeight: 200,
|
moneyLog: 20000,
|
||||||
imageX: 100,
|
bettingMoney: 10000,
|
||||||
imageY: 100,
|
predictMoney: 100,
|
||||||
openStatus: true,
|
realMoney: 11111,
|
||||||
|
bettingResult: BettingResultName.FAILURE,
|
||||||
|
createdBy: 1,
|
||||||
|
updatedBy: 1,
|
||||||
updatedAt: null,
|
updatedAt: null,
|
||||||
createdAt: null
|
createdAt: null
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export class BetHistoryDataSource extends DataSource<BetHistory> {
|
export class BetHistoryDataSource extends DataSource<BettingHistory> {
|
||||||
private _objectStore: BetHistory[] = [];
|
private _objectStore: BettingHistory[] = [];
|
||||||
private _ObjectsSubject$ = new BehaviorSubject<BetHistory[]>([]);
|
private _ObjectsSubject$ = new BehaviorSubject<BettingHistory[]>([]);
|
||||||
private _loadingSubject$ = new BehaviorSubject<boolean>(false);
|
private _loadingSubject$ = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
public loading$ = this._loadingSubject$.asObservable();
|
public loading$ = this._loadingSubject$.asObservable();
|
||||||
public formg: FormGroup;
|
public formg: FormGroup;
|
||||||
|
|
||||||
constructor(private betHistoryService: BetHistoryService) {
|
constructor(private betHistoryService: BettingHistoryService) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(collectionViewer: CollectionViewer): Observable<BetHistory[]> {
|
connect(collectionViewer: CollectionViewer): Observable<BettingHistory[]> {
|
||||||
// return this.fixBonusService.getAll().pipe(
|
// return this.fixBonusService.getAll().pipe(
|
||||||
// map(res => {
|
// map(res => {
|
||||||
// res.forEach(m => this._objectStore.push(m as FixBonus));
|
// res.forEach(m => this._objectStore.push(m as FixBonus));
|
||||||
|
@ -73,7 +83,7 @@ export class BetHistoryDataSource extends DataSource<BetHistory> {
|
||||||
// );
|
// );
|
||||||
return of(ELEMENT_DATA).pipe(
|
return of(ELEMENT_DATA).pipe(
|
||||||
map(res => {
|
map(res => {
|
||||||
res.forEach(m => this._objectStore.push(m as BetHistory));
|
res.forEach(m => this._objectStore.push(m as BettingHistory));
|
||||||
this._ObjectsSubject$.next(this._objectStore);
|
this._ObjectsSubject$.next(this._objectStore);
|
||||||
let fa = <FormArray>this.formg.get('formarray');
|
let fa = <FormArray>this.formg.get('formarray');
|
||||||
res.forEach(r => fa.push(this.createRowFormGroup(r)));
|
res.forEach(r => fa.push(this.createRowFormGroup(r)));
|
||||||
|
@ -92,7 +102,7 @@ export class BetHistoryDataSource extends DataSource<BetHistory> {
|
||||||
// openStatus: true,
|
// openStatus: true,
|
||||||
// updatedAt: null,
|
// updatedAt: null,
|
||||||
// createdAt: null
|
// createdAt: null
|
||||||
createRowFormGroup(r: BetHistory): FormGroup {
|
createRowFormGroup(r: BettingHistory): FormGroup {
|
||||||
let f = new FormGroup({
|
let f = new FormGroup({
|
||||||
title: this.createNewFormContorl(r, 'title'),
|
title: this.createNewFormContorl(r, 'title'),
|
||||||
imageWidth: this.createNewFormContorl(r, 'imageWidth'),
|
imageWidth: this.createNewFormContorl(r, 'imageWidth'),
|
||||||
|
@ -104,7 +114,7 @@ export class BetHistoryDataSource extends DataSource<BetHistory> {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewFormContorl(r: BetHistory, propName: string): FormControl {
|
createNewFormContorl(r: BettingHistory, propName: string): FormControl {
|
||||||
let m = new FormControl(r[propName], Validators.required);
|
let m = new FormControl(r[propName], Validators.required);
|
||||||
m.valueChanges.subscribe(val => {
|
m.valueChanges.subscribe(val => {
|
||||||
r[propName] = val;
|
r[propName] = val;
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
import { DateAudit } from 'src/modules/common/data/model/audit';
|
|
||||||
|
|
||||||
export interface BetHistory extends DateAudit {
|
|
||||||
id?: number;
|
|
||||||
thumbNail?: string;
|
|
||||||
title?: string;
|
|
||||||
imageWidth?: number;
|
|
||||||
imageHeight?: number;
|
|
||||||
imageX?: number;
|
|
||||||
imageY?: number;
|
|
||||||
openStatus?: boolean;
|
|
||||||
popupEffect?: number;
|
|
||||||
}
|
|
14
src/modules/game/model/betting-history.model.ts
Normal file
14
src/modules/game/model/betting-history.model.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import { UserDateAuditEntity } from 'src/modules/common/data/model/audit';
|
||||||
|
import { SportsEvent } from './sports-event.model';
|
||||||
|
import { BettingResultName } from '../type/betting-result.type';
|
||||||
|
export interface BettingHistory extends UserDateAuditEntity {
|
||||||
|
id?: number;
|
||||||
|
league?: number;
|
||||||
|
sportsEvents?: SportsEvent[];
|
||||||
|
user?: number;
|
||||||
|
moneyLog?: number;
|
||||||
|
bettingMoney?: number;
|
||||||
|
predictMoney?: number;
|
||||||
|
realMoney?: number;
|
||||||
|
bettingResult?: BettingResultName;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { DateAudit } from 'src/modules/common/data/model/audit';
|
import { DateAudit } from 'src/modules/common/data/model/audit';
|
||||||
import { Sports } from './sports.model';
|
import { SportsTypeName } from '../type/sports-name.type';
|
||||||
|
|
||||||
export interface League extends DateAudit {
|
export interface League extends DateAudit {
|
||||||
id?: number;
|
id?: number;
|
||||||
|
@ -8,5 +8,5 @@ export interface League extends DateAudit {
|
||||||
sevenName?: string;
|
sevenName?: string;
|
||||||
engCountry?: string;
|
engCountry?: string;
|
||||||
korCountry?: string;
|
korCountry?: string;
|
||||||
sportsEntities?: Sports[];
|
sportsType?: SportsTypeName;
|
||||||
}
|
}
|
||||||
|
|
15
src/modules/game/model/mini-game.model.ts
Normal file
15
src/modules/game/model/mini-game.model.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import { UserDateAuditEntity } from 'src/modules/common/data/model/audit';
|
||||||
|
|
||||||
|
export interface MiniGame extends UserDateAuditEntity {
|
||||||
|
id?: number;
|
||||||
|
drawName?: string;
|
||||||
|
awayName?: string;
|
||||||
|
miniGameType?: string;
|
||||||
|
miniGameRound?: number;
|
||||||
|
resultStatus?: number;
|
||||||
|
bettingStatus?: number;
|
||||||
|
matchDateTime?: Date;
|
||||||
|
homeOdds?: number;
|
||||||
|
drawOdds?: number;
|
||||||
|
awayOdds?: number;
|
||||||
|
}
|
12
src/modules/game/model/sports-event-result.model.ts
Normal file
12
src/modules/game/model/sports-event-result.model.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { DateAudit } from 'src/modules/common/data/model/audit';
|
||||||
|
|
||||||
|
export interface SportsEventResult extends DateAudit {
|
||||||
|
id?: number;
|
||||||
|
sportsEvent?: number;
|
||||||
|
status?: number;
|
||||||
|
homeFullTimeScore?: number;
|
||||||
|
homeFinalScore?: number;
|
||||||
|
awayFullTimeScore?: number;
|
||||||
|
awayFinalScore?: number;
|
||||||
|
scoreInfo?: object;
|
||||||
|
}
|
21
src/modules/game/model/sports-event.model.ts
Normal file
21
src/modules/game/model/sports-event.model.ts
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { DateAudit } from 'src/modules/common/data/model/audit';
|
||||||
|
|
||||||
|
export interface SportsEvent extends DateAudit {
|
||||||
|
id?: number;
|
||||||
|
matchDateTime?: Date;
|
||||||
|
resultStatus?: number;
|
||||||
|
bettingStatus?: number;
|
||||||
|
gameWay?: number;
|
||||||
|
gameType?: number;
|
||||||
|
parseStatus?: number;
|
||||||
|
sportsEngName?: string;
|
||||||
|
sportsKorName?: string;
|
||||||
|
matchEtc?: string;
|
||||||
|
league?: number;
|
||||||
|
homeTeam?: string;
|
||||||
|
awayTeam?: string;
|
||||||
|
homeOdds?: number;
|
||||||
|
drawOdds?: number;
|
||||||
|
awayOdds?: number;
|
||||||
|
optionOdds?: number;
|
||||||
|
}
|
10
src/modules/game/model/sports-team.model.ts
Normal file
10
src/modules/game/model/sports-team.model.ts
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { DateAudit } from 'src/modules/common/data/model/audit';
|
||||||
|
import { SportsTypeName } from '../type/sports-name.type';
|
||||||
|
|
||||||
|
export interface SportsTeam extends DateAudit {
|
||||||
|
id?: number;
|
||||||
|
engName?: string;
|
||||||
|
korName?: string;
|
||||||
|
countryCode?: string;
|
||||||
|
sportsType?: SportsTypeName;
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map, takeUntil } from 'rxjs/operators';
|
import { map, takeUntil } from 'rxjs/operators';
|
||||||
import { BetHistory } from '../model/bet-history.model';
|
import { BettingHistory } from '../model/betting-history.model';
|
||||||
import { API_BASE_URL } from 'src/modules/common/type/injection-token.type';
|
import { API_BASE_URL } from 'src/modules/common/type/injection-token.type';
|
||||||
import { Page } from 'src/modules/common/data/model/page';
|
import { Page } from 'src/modules/common/data/model/page';
|
||||||
import { FormArray } from '@angular/forms';
|
import { FormArray } from '@angular/forms';
|
||||||
|
@ -11,7 +11,7 @@ import { FormArray } from '@angular/forms';
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class BetHistoryService {
|
export class BettingHistoryService {
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(API_BASE_URL) private apiBaseUrl: string,
|
@Inject(API_BASE_URL) private apiBaseUrl: string,
|
||||||
private httpClient: HttpClient
|
private httpClient: HttpClient
|
|
@ -1,3 +1,3 @@
|
||||||
import { LeagueService } from './league.service';
|
import { LeagueService } from './league.service';
|
||||||
import { BetHistoryService } from './bet-historyservice';
|
import { BettingHistoryService } from './betting-history.service';
|
||||||
export const SERVICES = [LeagueService, BetHistoryService];
|
export const SERVICES = [LeagueService, BettingHistoryService];
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class LeagueService {
|
||||||
const sevenName = league.sevenName;
|
const sevenName = league.sevenName;
|
||||||
const engCountry = league.engCountry;
|
const engCountry = league.engCountry;
|
||||||
const korCountry = league.korCountry;
|
const korCountry = league.korCountry;
|
||||||
const sportsEntities = league.sportsEntities;
|
const sportsType = league.sportsType;
|
||||||
|
|
||||||
return this.httpClient
|
return this.httpClient
|
||||||
.post<any>(`${this.apiBaseUrl}/league`, {
|
.post<any>(`${this.apiBaseUrl}/league`, {
|
||||||
|
@ -32,7 +32,7 @@ export class LeagueService {
|
||||||
sevenName,
|
sevenName,
|
||||||
engCountry,
|
engCountry,
|
||||||
korCountry,
|
korCountry,
|
||||||
sportsEntities
|
sportsType
|
||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(res => {
|
map(res => {
|
||||||
|
@ -49,7 +49,7 @@ export class LeagueService {
|
||||||
const sevenName = league.sevenName;
|
const sevenName = league.sevenName;
|
||||||
const engCountry = league.engCountry;
|
const engCountry = league.engCountry;
|
||||||
const korCountry = league.korCountry;
|
const korCountry = league.korCountry;
|
||||||
const sportsEntities = league.sportsEntities;
|
const sportsType = league.sportsType;
|
||||||
|
|
||||||
return this.httpClient
|
return this.httpClient
|
||||||
.put<any>(`${this.apiBaseUrl}/league/${id}`, {
|
.put<any>(`${this.apiBaseUrl}/league/${id}`, {
|
||||||
|
@ -59,7 +59,7 @@ export class LeagueService {
|
||||||
sevenName,
|
sevenName,
|
||||||
engCountry,
|
engCountry,
|
||||||
korCountry,
|
korCountry,
|
||||||
sportsEntities
|
sportsType
|
||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
map(res => {
|
map(res => {
|
||||||
|
|
5
src/modules/game/type/betting-result.type.ts
Normal file
5
src/modules/game/type/betting-result.type.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export enum BettingResultName {
|
||||||
|
WINNING = 'WINNING',
|
||||||
|
FAILURE = 'FAILURE',
|
||||||
|
INVALIDITY = 'INVALIDITY'
|
||||||
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
import { DateAudit } from 'src/modules/common/data/model/audit';
|
export enum SportsTypeName {
|
||||||
|
|
||||||
export enum SportsName {
|
|
||||||
SOCCER = 'SOCCER',
|
SOCCER = 'SOCCER',
|
||||||
BASEBALL = 'BASEBALL',
|
BASEBALL = 'BASEBALL',
|
||||||
BASKET_BALL = 'BASKET_BALL',
|
BASKET_BALL = 'BASKET_BALL',
|
||||||
|
@ -10,8 +8,3 @@ export enum SportsName {
|
||||||
VALLEY_BALL = 'VALLEY_BALL',
|
VALLEY_BALL = 'VALLEY_BALL',
|
||||||
HAND_BALL = 'HAND_BALL'
|
HAND_BALL = 'HAND_BALL'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Sports extends DateAudit {
|
|
||||||
id?: number;
|
|
||||||
name?: SportsName;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user