Merge branch 'feature/BETERAN-BACKEND-APP-BROWSER-init' of https://gitlab.loafle.net/bet/beteran-backend-app-browser into feature/BETERAN-BACKEND-APP-BROWSER-init

This commit is contained in:
병준 박 2022-08-12 09:40:46 +00:00
commit 51958a34e1
10 changed files with 384 additions and 85 deletions

View File

@ -93,7 +93,12 @@
<button mat-menu-item (click)="__onClickCash($event)"> <button mat-menu-item (click)="__onClickCash($event)">
보유금지급/회수 보유금지급/회수
</button> </button>
<button mat-menu-item>수수료설정</button> <button
mat-menu-item
(click)="__onClickCommission($event)"
>
수수료설정
</button>
<button mat-menu-item>콤프지급/회수</button> <button mat-menu-item>콤프지급/회수</button>
<button mat-menu-item>쿠폰머니지급/회수</button> <button mat-menu-item>쿠폰머니지급/회수</button>
<button mat-menu-item>쪽지보내기</button> <button mat-menu-item>쪽지보내기</button>

View File

@ -22,6 +22,7 @@ import {
startWith, startWith,
Subject, Subject,
switchMap, switchMap,
take,
takeUntil, takeUntil,
timer, timer,
} from 'rxjs'; } from 'rxjs';
@ -32,8 +33,12 @@ import { Partner } from '../models/partner';
import { PartnerPagination } from '../models/partner-pagination'; import { PartnerPagination } from '../models/partner-pagination';
import { PartnerService } from '../services/partner.service'; import { PartnerService } from '../services/partner.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { RegistComposeComponent } from '../compose/regist-compose.component'; import {
RegistComposeComponent,
RegistComposeResult,
} from '../compose/regist-compose.component';
import { CashComposeComponent } from '../compose/cash-compose.component'; import { CashComposeComponent } from '../compose/cash-compose.component';
import { CommissionComposeComponent } from '../compose/commission-compose.component';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service'; import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
@ -240,15 +245,27 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
__onClickRegist(event: MouseEvent, partner: MemberModel): void { __onClickRegist(event: MouseEvent, partner: MemberModel): void {
const dialogRef = this._matDialog.open(RegistComposeComponent, { const dialogRef = this._matDialog.open(RegistComposeComponent, {
data: { title: '대본 등록하기', parent: partner, sites: this.sites }, data: { title: '대본 등록', parent: partner, sites: this.sites },
});
dialogRef
.afterClosed()
.pipe(take(1))
.subscribe((result: RegistComposeResult) => {
console.log('Compose dialog was closed: ', result);
});
}
__onClickCash(event: MouseEvent): void {
const dialogRef = this._matDialog.open(CashComposeComponent, {
data: { price: '', memo: '' },
}); });
dialogRef.afterClosed().subscribe((result) => { dialogRef.afterClosed().subscribe((result) => {
console.log('Compose dialog was closed!'); console.log('Compose dialog was closed!');
}); });
} }
__onClickCash(event: MouseEvent): void { __onClickCommission(event: MouseEvent): void {
const dialogRef = this._matDialog.open(CashComposeComponent, { const dialogRef = this._matDialog.open(CommissionComposeComponent, {
data: { price: '', memo: '' }, data: { price: '', memo: '' },
}); });

View File

@ -0,0 +1,96 @@
<div class="flex flex-col max-w-240 md:min-w-160 max-h-screen -m-6">
<!-- Header -->
<div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
>
<div class="text-lg font-medium">수수료 변경</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<mat-icon
class="text-current"
[svgIcon]="'heroicons_outline:x'"
></mat-icon>
</button>
</div>
<!-- Compose form -->
<form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
[formGroup]="composeForm"
>
<fieldset>
<div class="font-semibold mb-2">카지노 요율</div>
<!-- 바카라 -->
<mat-form-field style="text-align: center">
<mat-label>바카라</mat-label>
<input matInput [formControlName]="'bacaraRate'" />2.00
</mat-form-field>
<span style="float: inherit">%(최소 2 ~ 최대 5)</span
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!-- 룰렛 -->
<mat-form-field style="text-align: center">
<mat-label>룰렛</mat-label>
<input matInput [formControlName]="'rouletteRate'" />2.00
</mat-form-field>
<span style="float: inherit">%(최소 1.8 ~ 최대 5)</span>
<br />
<!-- 드레곤타이거 -->
<mat-form-field style="text-align: center">
<mat-label>드레곤타이거</mat-label>
<input matInput [formControlName]="'dragonTigerRate'" />2.00
</mat-form-field>
<span style="float: inherit">%(최소 1.8 ~ 최대 5)</span
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<!-- 기타게임 -->
<mat-form-field style="text-align: center">
<mat-label>기타게임</mat-label>
<input matInput [formControlName]="'otherGameRate'" />2.00
</mat-form-field>
<span style="float: inherit">%(최소 1.5 ~ 최대 5)</span>
</fieldset>
<b><mat-divider></mat-divider></b>
<!-- 슬롯요율 -->
<fieldset>
<mat-form-field style="text-align: center">
<mat-label>슬롯요율</mat-label>
<input matInput [formControlName]="'slotRate'" />5.00
</mat-form-field>
<span style="float: inherit">%(최소 4 ~ 최대 5)</span>
</fieldset>
<mat-divider></mat-divider>
<fieldset>
<!-- 카지노 루징 -->
<mat-form-field style="text-align: center">
<mat-label>카지노 루징</mat-label>
<input matInput [formControlName]="'casinoLoosing'" />50.00
</mat-form-field>
<span style="float: inherit">%(최소 40 ~ 최대 50)</span>
&nbsp;&nbsp;&nbsp;
<!-- 술롯 루징 -->
<mat-form-field style="text-align: center">
<mat-label>슬롯 루징</mat-label>
<input matInput [formControlName]="'slotLoosing'" />50.00
</mat-form-field>
<span style="float: inherit">%(최소 40 ~ 최대 50)</span>
</fieldset>
<!-- Actions -->
<div
class="flex flex-col sm:flex-row sm:items-center justify-between mt-4 sm:mt-6"
>
<div class="flex items-center mt-4 sm:mt-0">
<!-- Send -->
<button
class="order-first sm:order-last"
mat-flat-button
[color]="'primary'"
(click)="send()"
>
요율변경
</button>
<!-- Save as draft -->
<button class="sm:mx-3" mat-stroked-button (click)="saveAsDraft()">
<span>닫기</span>
</button>
</div>
</div>
</form>
</div>

View File

@ -0,0 +1,99 @@
import {
ChangeDetectorRef,
Component,
Inject,
OnInit,
ViewEncapsulation,
} from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
import { Site } from 'app/modules/protobuf/models/domain/site_pb';
export interface CommissionComposeData {
price: string;
memo: string;
}
export interface CommissionComposeResult {
price: string;
memo: string;
}
@Component({
selector: 'app-commission-compose',
templateUrl: './commission-compose.component.html',
encapsulation: ViewEncapsulation.None,
})
export class CommissionComposeComponent implements OnInit {
composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
/**
* Constructor
*/
constructor(
public matDialogRef: MatDialogRef<CommissionComposeComponent>,
@Inject(MAT_DIALOG_DATA) public data: CommissionComposeData,
private _formBuilder: FormBuilder,
private _identityService: IdentityService,
private _changeDetectorRef: ChangeDetectorRef
) {}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void {
// Create the form
this.composeForm = this._formBuilder.group({
bacaraRate: ['', [Validators.required]],
rouletteRate: ['', [Validators.required]],
dragonTigerRate: ['', [Validators.required]],
otherGameRate: ['', [Validators.required]],
slotRate: ['', [Validators.required]],
casinoLoosing: ['', [Validators.required]],
slotLoosing: ['', [Validators.required]],
});
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Save and close
*/
saveAndClose(): void {
// Save the message as a draft
this.saveAsDraft();
// Close the dialog
this.matDialogRef.close();
}
/**
* Discard the message
*/
discard(): void {}
/**
* Save the message as a draft
*/
saveAsDraft(): void {}
/**
* Send the message
*/
send(): void {}
}

View File

@ -1,4 +1,9 @@
import { RegistComposeComponent } from './regist-compose.component'; import { RegistComposeComponent } from './regist-compose.component';
import { CashComposeComponent } from './cash-compose.component'; import { CashComposeComponent } from './cash-compose.component';
import { CommissionComposeComponent } from './commission-compose.component';
export const COMPOSE = [RegistComposeComponent, CashComposeComponent]; export const COMPOSE = [
RegistComposeComponent,
CashComposeComponent,
CommissionComposeComponent,
];

View File

@ -3,7 +3,7 @@
<div <div
class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary" class="flex flex-0 items-center justify-between h-16 pr-3 sm:pr-5 pl-6 sm:pl-8 bg-primary text-on-primary"
> >
<div class="text-lg font-medium">{{ data.title }} 등록</div> <div class="text-lg font-medium">{{ data.title }}</div>
<button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1"> <button mat-icon-button (click)="saveAndClose()" [tabIndex]="-1">
<mat-icon <mat-icon
class="text-current" class="text-current"
@ -12,6 +12,17 @@
</button> </button>
</div> </div>
<fuse-alert
class="mt-8 -mb-4"
*ngIf="showAlert"
[appearance]="'outline'"
[showIcon]="false"
[type]="alert.type"
[@shake]="alert.type === 'error'"
>
{{ alert.message }}
</fuse-alert>
<!-- Compose form --> <!-- Compose form -->
<form <form
class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto" class="flex flex-col flex-auto p-6 sm:p-8 overflow-y-auto"
@ -98,12 +109,23 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field> <!-- <mat-form-field>
<mat-label>정산종류</mat-label> <mat-label>정산종류</mat-label>
<input matInput [formControlName]="'calculateType'" /> <input matInput [formControlName]="'calculateType'" />
<mat-error *ngIf="composeForm.get('calculateType')?.hasError('required')"> <mat-error *ngIf="composeForm.get('calculateType')?.hasError('required')">
정산종류는 필수 입력입니다. 정산종류는 필수 입력입니다.
</mat-error> </mat-error>
</mat-form-field> -->
<mat-form-field>
<mat-label>정산종류</mat-label>
<mat-select [formControlName]="'calculateType'">
<mat-option [value]="0"> 롤링 </mat-option>
</mat-select>
<mat-error *ngIf="composeForm.get('siteName')?.hasError('required')">
정산종류는 필수 입력입니다.
</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -116,12 +138,26 @@
<mat-form-field> <mat-form-field>
<mat-label>은행명</mat-label> <mat-label>은행명</mat-label>
<input matInput [formControlName]="'bankName'" />
<mat-select [formControlName]="'bankName'" placeholder="은행 선택">
<mat-option *ngFor="let bank of data.banks" [value]="bank.getId()">
{{ bank.getName() }}
</mat-option>
<mat-option [value]="'0'"> 국민은행 </mat-option>
</mat-select>
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')"> <mat-error *ngIf="composeForm.get('bankName')?.hasError('required')">
은행명은 필수 입력입니다. 은행명은 필수 입력입니다.
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<!-- <mat-form-field>
<mat-label>은행명</mat-label>
<input matInput [formControlName]="'bankName'" />
<mat-error *ngIf="composeForm.get('bankName')?.hasError('required')">
은행명은 필수 입력입니다.
</mat-error>
</mat-form-field> -->
<mat-form-field> <mat-form-field>
<mat-label>계좌번호</mat-label> <mat-label>계좌번호</mat-label>
<input matInput [formControlName]="'accountNumber'" /> <input matInput [formControlName]="'accountNumber'" />
@ -160,6 +196,7 @@
mat-flat-button mat-flat-button
[color]="'primary'" [color]="'primary'"
(click)="send()" (click)="send()"
[disabled]="isSendDisable"
> >
등록 등록
</button> </button>

View File

@ -7,46 +7,45 @@ import {
} from '@angular/core'; } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { FuseAlertType } from '@fuse/components/alert';
import { SiteService } from 'app/modules/polyglot/domain/services/site.service'; import { SiteService } from 'app/modules/polyglot/domain/services/site.service';
import { IdentityService } from 'app/modules/polyglot/member/services/identity.service'; import { IdentityService } from 'app/modules/polyglot/member/services/identity.service';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import {
CreateMemberRequest,
CreateMemberResponse,
} from 'app/modules/protobuf/c2se/backend/member_pb';
import { Bank } from 'app/modules/protobuf/models/account/bank_pb';
import { Site } from 'app/modules/protobuf/models/domain/site_pb'; import { Site } from 'app/modules/protobuf/models/domain/site_pb';
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb'; import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
import { fuseAnimations } from '@fuse/animations';
export interface RegistComposeData { export interface RegistComposeData {
title: string; title: string;
parent: MemberModel; parent: MemberModel;
sites: Site[]; sites: Site[];
banks: Bank[];
} }
export interface RegistComposeResult { export interface RegistComposeResult {
parentId: string; choice: boolean;
siteName: string;
signinId: string;
password: string;
exchangePassword: string;
nickname: string;
calculateType: string;
phoneNumber: string;
bankName: string;
accountNumber: string;
accountHolder: string;
} }
@Component({ @Component({
selector: 'app-regist-compose', selector: 'app-regist-compose',
templateUrl: './regist-compose.component.html', templateUrl: './regist-compose.component.html',
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
animations: fuseAnimations,
}) })
export class RegistComposeComponent implements OnInit { export class RegistComposeComponent implements OnInit {
composeForm!: FormGroup; composeForm!: FormGroup;
sites: any[] = [];
// quillModules: any = {
// toolbar: [
// ['bold', 'italic', 'underline'],
// [{ align: [] }, { list: 'ordered' }, { list: 'bullet' }],
// ['clean'],
// ],
// };
alert: { type: FuseAlertType; message: string } = {
type: 'success',
message: '등록이 성공하였습니다.',
};
showAlert: boolean = false;
isSendDisable = false;
/** /**
* Constructor * Constructor
*/ */
@ -55,10 +54,9 @@ export class RegistComposeComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public data: RegistComposeData, @Inject(MAT_DIALOG_DATA) public data: RegistComposeData,
private _formBuilder: FormBuilder, private _formBuilder: FormBuilder,
private _identityService: IdentityService, private _identityService: IdentityService,
private _memberService: MemberService,
private _changeDetectorRef: ChangeDetectorRef private _changeDetectorRef: ChangeDetectorRef
) { ) {}
this.data.sites.forEach((v) => console.log(v.getUrl()));
}
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks // @ Lifecycle hooks
@ -111,11 +109,61 @@ export class RegistComposeComponent implements OnInit {
/** /**
* Send the message * Send the message
*
}
*/ */
send(): void { send(): void {
console.log(this.composeForm.value); if (!this.composeForm.valid) {
return;
} }
this.isSendDisable = true;
const {
partnerId,
siteName,
signinId,
password,
exchangePassword,
nickname,
calculateType,
phoneNumber,
bankName,
accountNumber,
accountHolder,
} = this.composeForm.value;
const member = new CreateMemberRequest();
const site = new Site();
site.setId(siteName);
member.setSiteId(siteName);
member.setUsername(signinId);
member.setPassword('beteran');
member.setMemberClassId('ae9b874e-5d0e-4c4d-8432-f45f02691ceb');
member.setMemberLevelId('c56231ac-2120-4a81-a30a-5d41fafb6c57');
member.setReferrerMemberUsername(this.data.parent.getUsername());
member.setNickname(nickname);
member.setMobilePhoneNumber(phoneNumber);
this._memberService
.createMember(member)
.then((res: CreateMemberResponse.Result) => {
console.log(res.getMember());
this.showAlert = true;
})
.catch((e) => {
this.showAlert = true;
this.alert = { type: 'error', message: '등록에 실패하였습니다.' };
})
.finally(() => (this.showAlert = false));
}
private close(): void {
this.matDialogRef.close({
choice: true,
});
}
__checkSigninId(event: FocusEvent): void { __checkSigninId(event: FocusEvent): void {
const signinId = this.composeForm.get('signinId')?.value; const signinId = this.composeForm.get('signinId')?.value;
// console.log(event, '::', signinId); // console.log(event, '::', signinId);

View File

@ -16,6 +16,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { MatGridListModule } from '@angular/material/grid-list'; import { MatGridListModule } from '@angular/material/grid-list';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { MatRadioModule } from '@angular/material/radio'; import { MatRadioModule } from '@angular/material/radio';
import { MatDividerModule } from '@angular/material/divider';
import { TranslocoModule } from '@ngneat/transloco'; import { TranslocoModule } from '@ngneat/transloco';
@ -26,6 +27,7 @@ import { COMPOSE } from './compose';
import { partnerRoutes } from './partner.routing'; import { partnerRoutes } from './partner.routing';
import { MatDialogModule } from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import { FuseAlertModule } from '@fuse/components/alert';
@NgModule({ @NgModule({
declarations: [COMPONENTS, COMPOSE], declarations: [COMPONENTS, COMPOSE],
@ -51,6 +53,9 @@ import { MatDialogModule } from '@angular/material/dialog';
MatGridListModule, MatGridListModule,
MatMenuModule, MatMenuModule,
MatRadioModule, MatRadioModule,
MatDividerModule,
FuseAlertModule,
], ],
}) })
export class PartnerModule {} export class PartnerModule {}

View File

@ -217,17 +217,24 @@
</div> </div>
</div> </div>
<div> <div>
<p>
<span style="color: red" <span style="color: red"
>-도메인 www.을 빼고 등록해야 합니다.(ex:demo.com)</span >-도메인 www.을 빼고 등록해야 합니다.(ex:demo.com)</span
> >
</p>
<p>
<span style="color: red" <span style="color: red"
>-만료일은 도메인 구입처(구입당시)에서 확인가능합니다. (등록하지 >-만료일은 도메인 구입처(구입당시)에서 확인가능합니다. (등록하지
않으면 등록날짜 기준으로 365 남은기간이 설정됩니다.)</span 않으면 등록날짜 기준으로 365 남은기간이 설정됩니다.)</span
> >
</p>
<p>
<span style="color: red" <span style="color: red"
>-메모란을 등록하셔서 도메인을 관리하시면 좋습니다. (150자 이하로 >-메모란을 등록하셔서 도메인을 관리하시면 좋습니다. (150자 이하로
등록해주세요.)</span 등록해주세요.)</span
> >
</p>
</div> </div>
</div> </div>
</div> </div>

View File

@ -17,8 +17,12 @@ import {
UpdateMemberRequest, UpdateMemberRequest,
UpdateMemberResponse, UpdateMemberResponse,
SUBJECT_UPDATE_MEMBER, SUBJECT_UPDATE_MEMBER,
CreateMemberResponse,
CreateMemberRequest,
SUBJECT_CREATE_MEMBER,
} from 'app/modules/protobuf/c2se/backend/member_pb'; } from 'app/modules/protobuf/c2se/backend/member_pb';
import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb'; import { Pagination } from 'app/modules/protobuf/protobuf/pagination/pagination_pb';
import { MemberModel } from 'app/modules/protobuf/models/member/member_pb';
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
@ -157,46 +161,22 @@ export class MemberService {
// classId: 4b014ef5-3bab-4413-aaf9-b0040a70ec77 // classId: 4b014ef5-3bab-4413-aaf9-b0040a70ec77
// levelId: c56231ac-2120-4a81-a30a-5d41fafb6c57 // levelId: c56231ac-2120-4a81-a30a-5d41fafb6c57
// createMember( createMember(req: CreateMemberRequest): Promise<CreateMemberResponse.Result> {
// siteId: string = '8429a7ab-b9de-400b-a209-28ff46e22bec', return new Promise<CreateMemberResponse.Result>((resolve, reject) => {
// memberLevelId: string = 'c56231ac-2120-4a81-a30a-5d41fafb6c57', this.__natsService
// classId: string = '4b014ef5-3bab-4413-aaf9-b0040a70ec77', .request<CreateMemberResponse.Result>(
// signinId: string, SUBJECT_CREATE_MEMBER,
// nickname: string, req.serializeBinary(),
// password: string, CreateMemberResponse.deserializeBinary
// mobilePhoneNumber: string )
// ): Promise<MemberRequ.Result> { .then((result) => {
// return new Promise<UpdateMemberResponse.Result>((resolve, reject) => { console.log('createMember Result: ', result);
// let req = new UpdateMemberRequest(); resolve(result);
// req.setId(id); })
.catch((e: Error) => {
// if (!!siteId) { console.log('failed', e);
// req.setSiteId(siteId); reject(e);
// } });
// if (!!memberLevelId) { });
// req.setMemberLevelId(memberLevelId); }
// }
// if (!!password) {
// req.setPassword(password);
// }
// if (!!mobilePhoneNumber) {
// req.setMobilePhoneNumber(mobilePhoneNumber);
// }
// this.__natsService
// .request<UpdateMemberResponse.Result>(
// SUBJECT_UPDATE_MEMBER,
// req.serializeBinary(),
// UpdateMemberResponse.deserializeBinary
// )
// .then((result) => {
// console.log('updateMember Result: ', result);
// resolve(result);
// })
// .catch((e: Error) => {
// console.log('failed', e);
// reject(e);
// });
// });
// }
} }