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-25 05:46:55 +00:00
commit d8d79fa2ba
3 changed files with 142 additions and 61 deletions

View File

@ -228,12 +228,12 @@
<mat-form-field class="w-1/3 pr-2"> <mat-form-field class="w-1/3 pr-2">
<mat-label>레벨</mat-label> <mat-label>레벨</mat-label>
<mat-select <mat-select
[formControlName]="'levelId'" [formControlName]="'levelName'"
placeholder="레벨 선택" placeholder="레벨 선택"
> >
<mat-option <mat-option
*ngFor="let level of memberLevels" *ngFor="let level of memberLevels"
[value]="'level.getId()'" [value]="level.getName()"
> >
{{ level.getName() }} {{ level.getName() }}
</mat-option> </mat-option>
@ -306,12 +306,12 @@
<mat-label>사이트변경</mat-label> <mat-label>사이트변경</mat-label>
<mat-select <mat-select
[formControlName]="'siteId'" [formControlName]="'siteUrl'"
placeholder="사이트 선택" placeholder="사이트 선택"
> >
<mat-option <mat-option
*ngFor="let site of sites" *ngFor="let site of sites"
[value]="site.getId()" [value]="site.getUrl()"
> >
{{ site.getUrl() }} {{ site.getUrl() }}
</mat-option> </mat-option>

View File

@ -93,13 +93,6 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
isLoading = false; isLoading = false;
searchInputControl = new FormControl(); searchInputControl = new FormControl();
/* NONE: 0;
NORMAL: 1;
PENDING: 2;
WITHDRAWAL: 3;
DORMANCY: 4;
BLACKLIST: 5;
SUSPENDED: 6; */
memberStateOptions = [ memberStateOptions = [
{ {
value: 1, value: 1,
@ -185,13 +178,13 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
nickname: [{ value: '', disabled: true }], nickname: [{ value: '', disabled: true }],
ownCash: [''], ownCash: [''],
mobilePhoneNumber: [''], mobilePhoneNumber: [''],
levelId: [''], levelName: [''],
state: [''], state: [''],
isExcahngeMoney: [''], isExcahngeMoney: [''],
comp: [''], comp: [''],
coupon: [''], coupon: [''],
recommender: [{ value: '', disabled: true }], recommender: [{ value: '', disabled: true }],
siteId: [''], siteUrl: [''],
recommendCount: [''], recommendCount: [''],
hodingGameMoney: [{ value: '0', disabled: true }], hodingGameMoney: [{ value: '0', disabled: true }],
}); });
@ -289,10 +282,26 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}); });
this._siteService this._siteService.listSites().then((result) => {
.listSites() this.sites = result
.then((result) => (this.sites = result.getSitesList())); .getSitesList()
.filter((v) => !!v.getShow() && !!v.getCanUse());
this.memberDefaultForm
.get('siteUrl')
?.setValue(this.currentMember?.getSite()?.getUrl());
this._changeDetectorRef.markForCheck();
});
/* this._memberLevelService.listMemberLevels().then((result) => {
this.memberLevels = result
.getMemberLevelsList()
.filter((v) => !!v.getShow());
this.memberDefaultForm
.get('levelName')
?.setValue(this.currentMember?.getMemberLevel()?.getName());
this._changeDetectorRef.markForCheck();
}); */
this._bankService this._bankService
.listBanks() .listBanks()
.then((result) => (this.banks = result.getBanksList())); .then((result) => (this.banks = result.getBanksList()));
@ -310,7 +319,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
signinPw: '', signinPw: '',
exchangePw: '', exchangePw: '',
mobilePhoneNumber: this.currentMember?.getMobilePhoneNumber(), mobilePhoneNumber: this.currentMember?.getMobilePhoneNumber(),
levelId: this.currentMember?.getMemberLevel()?.getId(), levelName: this.currentMember?.getMemberLevel()?.getId(),
state: this.currentMember?.getState(), state: this.currentMember?.getState(),
nickname: this.currentMember?.getNickname(), nickname: this.currentMember?.getNickname(),
bankId: this.currentMember?.getBankAccount()?.getId(), bankId: this.currentMember?.getBankAccount()?.getId(),
@ -386,23 +395,27 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
nickname, nickname,
ownCash, ownCash,
mobilePhoneNumber, mobilePhoneNumber,
levelId, levelName,
state, state,
isExcahngeMoney, isExcahngeMoney,
comp, comp,
coupon, coupon,
siteId, siteUrl,
hodingGameMoney, hodingGameMoney,
} = this.memberDefaultForm.value; } = this.memberDefaultForm.value;
if (!!levelId && levelId == '') { if (!!levelName && levelName !== '') {
req.setMemberLevelId(levelId); const level = this.memberLevels.find(
(v) => v.getName() === levelName
);
if (!!level) req.setMemberLevelId(level?.getId());
} }
if (!!mobilePhoneNumber && mobilePhoneNumber == '') { if (!!mobilePhoneNumber && mobilePhoneNumber !== '') {
req.setMobilePhoneNumber(mobilePhoneNumber); req.setMobilePhoneNumber(mobilePhoneNumber);
} }
if (!!siteId && siteId == '') { if (!!siteUrl && siteUrl !== '') {
req.setSiteId(siteId); const site = this.sites.find((v) => v.getUrl() === siteUrl);
if (!!site) req.setSiteId(site.getId());
} }
} }
@ -479,21 +492,14 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
?.value as string; ?.value as string;
if (!password || !passwordConfirm) { if (!password || !passwordConfirm) {
this.changePasswordResultShowAlert = true; this.showAlert('error', '비밀번호를 입력하세요.');
this.alertConfig = {
type: 'error',
message: '비밀번호를 입력하세요.',
};
this.closeChangePasswordAlert(); this.closeChangePasswordAlert();
return; return;
} }
if (password !== passwordConfirm) { if (password !== passwordConfirm) {
this.changePasswordResultShowAlert = true; this.showAlert('error', '비밀번호가 일치하지 않습니다.');
this.alertConfig = {
type: 'error',
message: '비밀번호가 일치하지 않습니다.',
};
this.closeChangePasswordAlert(); this.closeChangePasswordAlert();
return; return;
} }
@ -512,22 +518,12 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._memberService this._memberService
.updateMemberForPassword(req) .updateMemberForPassword(req)
.then((result) => { .then((result) => {
this.changePasswordResultShowAlert = true; this.showAlert('success', '비밀번호가 수정 되었습니다.');
this.alertConfig = {
type: 'success',
message: '비밀번호가 수정 되었습니다.',
};
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}) })
.catch((reson) => { .catch((reson) => {
this.changePasswordResultShowAlert = true; this.showAlert('error', '패스워드 변경이 실패하였습니다.');
// Set the alert
this.alertConfig = {
type: 'error',
message: '패스워드 변경이 실패하였습니다.',
};
this._changeDetectorRef.markForCheck(); this._changeDetectorRef.markForCheck();
}) })
.finally(() => this.closeChangePasswordAlert()); .finally(() => this.closeChangePasswordAlert());
@ -539,10 +535,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
const state = event.value; const state = event.value;
if (!state) { if (!state) {
this.alertConfig = { this.showAlert('error', '상태값이 선택 되지 않았습니다.');
type: 'error',
message: '상태값이 선택 되지 않았습니다.',
};
this.closeChangePasswordAlert(); this.closeChangePasswordAlert();
return; return;
} }
@ -554,19 +548,10 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
this._memberService this._memberService
.updateMemberForState(req) .updateMemberForState(req)
.then((result) => { .then((result) => {
this.changePasswordResultShowAlert = true; this.showAlert('success', '회원 상태가 수정 되었습니다.');
this.alertConfig = {
type: 'success',
message: '회원 상태가 수정 되었습니다.',
};
}) })
.catch((reson) => { .catch((reson) => {
this.changePasswordResultShowAlert = true; this.showAlert('error', '회원 상태 변경이 실패하였습니다.');
// Set the alert
this.alertConfig = {
type: 'error',
message: '회원 상태 변경이 실패하였습니다.',
};
}) })
.finally(() => this.closeChangePasswordAlert()); .finally(() => this.closeChangePasswordAlert());
} }
@ -575,6 +560,15 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy {
const state = this.memberDefaultForm.get('state')?.value; const state = this.memberDefaultForm.get('state')?.value;
} }
private showAlert(type: FuseAlertType, message: string): void {
this.changePasswordResultShowAlert = true;
// Set the alert
this.alertConfig = {
type,
message,
};
}
private closeChangePasswordAlert(): void { private closeChangePasswordAlert(): void {
setTimeout(() => { setTimeout(() => {
this.changePasswordResultShowAlert = false; this.changePasswordResultShowAlert = false;

View File

@ -5,12 +5,18 @@ import {
Router, Router,
RouterStateSnapshot, RouterStateSnapshot,
} from '@angular/router'; } from '@angular/router';
import { BankService } from 'app/modules/polyglot/bank/services/bank.service';
import { MemberService } from 'app/modules/polyglot/member/services/member.service'; import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service';
import { SiteService } from 'app/modules/polyglot/site/services/site.service';
import { ListBanksResponse } from 'app/modules/proto/c2se/bank_pb';
import { ListMemberLevelsResponse } from 'app/modules/proto/c2se/member_level_pb';
import { GetMemberResponse } from 'app/modules/proto/c2se/member_pb'; import { GetMemberResponse } from 'app/modules/proto/c2se/member_pb';
import { import {
ListMembersRequest, ListMembersRequest,
ListMembersResponse, ListMembersResponse,
} from 'app/modules/proto/c2se/member_pb'; } from 'app/modules/proto/c2se/member_pb';
import { ListSitesResponse } from 'app/modules/proto/c2se/site_pb';
import { catchError, Observable, throwError } from 'rxjs'; import { catchError, Observable, throwError } from 'rxjs';
@ -155,3 +161,84 @@ export class MemberResolver implements Resolve<any> {
return this._memberService.getMember(memberId!); return this._memberService.getMember(memberId!);
} }
} }
export class SitesResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private __siteService: SiteService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListSitesResponse.Result>
| Promise<ListSitesResponse.Result>
| ListSitesResponse.Result {
return this.__siteService.listSites();
}
}
export class BanksResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _bankService: BankService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListBanksResponse.Result>
| Promise<ListBanksResponse.Result>
| ListBanksResponse.Result {
return this._bankService.listBanks();
}
}
export class MemberLevelsResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _memberLevelService: MemberLevelService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMemberLevelsResponse.Result>
| Promise<ListMemberLevelsResponse.Result>
| ListMemberLevelsResponse.Result {
return this._memberLevelService.listMemberLevels();
}
}