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-label>레벨</mat-label>
<mat-select
[formControlName]="'levelId'"
[formControlName]="'levelName'"
placeholder="레벨 선택"
>
<mat-option
*ngFor="let level of memberLevels"
[value]="'level.getId()'"
[value]="level.getName()"
>
{{ level.getName() }}
</mat-option>
@ -306,12 +306,12 @@
<mat-label>사이트변경</mat-label>
<mat-select
[formControlName]="'siteId'"
[formControlName]="'siteUrl'"
placeholder="사이트 선택"
>
<mat-option
*ngFor="let site of sites"
[value]="site.getId()"
[value]="site.getUrl()"
>
{{ site.getUrl() }}
</mat-option>

View File

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

View File

@ -5,12 +5,18 @@ import {
Router,
RouterStateSnapshot,
} from '@angular/router';
import { BankService } from 'app/modules/polyglot/bank/services/bank.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 {
ListMembersRequest,
ListMembersResponse,
} from 'app/modules/proto/c2se/member_pb';
import { ListSitesResponse } from 'app/modules/proto/c2se/site_pb';
import { catchError, Observable, throwError } from 'rxjs';
@ -155,3 +161,84 @@ export class MemberResolver implements Resolve<any> {
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();
}
}