회원 리스트 수정

This commit is contained in:
Park Byung Eun 2022-08-24 06:33:19 +00:00
parent 39d9fc0f19
commit 8724c0468e
4 changed files with 158 additions and 30 deletions

View File

@ -184,8 +184,8 @@
<div
class="flex flex-col flex-auto sm:mb-18 overflow-hidden sm:overflow-y-auto overflow-x-auto overflow-y-hidden"
>
<ng-container *ngIf="users$ | async as users">
<ng-container *ngIf="users.length > 0; else noUser">
<ng-container *ngIf="listMembers$ | async as mebers">
<ng-container *ngIf="mebers.length > 0; else noUser">
<div class="grid">
<!-- Header -->
<div
@ -234,9 +234,13 @@
<div class="hidden lg:block" style="text-align: center">로그</div>
</div>
<!-- Rows -->
<ng-container *ngIf="users$ | async as users">
<ng-container *ngIf="listMembers$ | async as mebers">
<ng-container
*ngFor="let user of users; let i = index; trackBy: __trackByFn"
*ngFor="
let member of mebers;
let i = index;
trackBy: __trackByFn
"
>
<div
class="user-grid grid items-center gap-4 py-3 px-6 md:px-8 border-b"
@ -271,7 +275,7 @@
<button mat-menu-item (click)="__onClickMessage($event)">
쪽지보내기
</button>
<button mat-menu-item (click)="viewSlot(user.id!)">
<button mat-menu-item (click)="viewSlot(member.getId())">
배팅리스트
</button>
<button
@ -284,48 +288,48 @@
</div>
<div [matTooltip]="__getRateTooltop()">요율</div>
<div>
{{ user.highRank }}
{{ __getParentUsername(member) }}
</div>
<div style="text-align: center">
<div
(click)="viewUserDetail(user.id!)"
(click)="viewUserDetail(member.getId())"
style="cursor: pointer"
>
{{ user.signinId }}
{{ member.getUsername() }}
</div>
<hr style="margin: 7px 0px" />
{{ user.nickname }}
{{ member.getNickname() }}
<hr style="margin: 7px 0px" />
{{ user.phoneNumber }}
{{ member.getMobilePhoneNumber() }}
</div>
<div style="text-align: center">
{{ user.rank }}
{{ member.getMemberClass()?.getName() }}
<hr style="margin: 7px 0px" />
{{ user.level }}
{{ member.getMemberLevel()?.getName() }}
<hr style="margin: 7px 0px" />
{{ user.state }}
{{ __getMemberState(member) }}
</div>
<div class="hidden sm:block" style="text-align: center">
{{ user.accountHolder }}
{{ member.getBankAccount()?.getName() }}
</div>
<div class="hidden md:block" style="text-align: center">
캐쉬{{ user.ownCash }}
캐쉬: 2000
<hr style="margin: 7px 0px" />
콤프{{ user.ownComp }}P
콤프: 2000P
<hr style="margin: 7px 0px" />
쿠폰{{ user.ownCoupon }}
쿠폰: 2000
</div>
<div class="hidden md:block" style="text-align: center">
{{ user.gameMoney }}
0
<hr style="margin: 7px 0px" />
{{ user.todayComp }}P
0P
</div>
<div class="hidden md:block" style="text-align: center">
입금{{ user.totalDeposit }}
입금 20000
<hr style="margin: 7px 0px" />
출금{{ user.totalWithdraw }}
출금 20000
<hr style="margin: 7px 0px" />
차익{{ user.balance }}
차익 20000
</div>
<div class="hidden lg:block" style="text-align: center">
<button
@ -345,11 +349,12 @@
</button>
</div>
<div class="hidden lg:block" style="text-align: center">
가입{{ user.registrationDate }}
가입: {{ member.getCreatedAt() | date: "yyyy-MM-dd HH:mm" }}
<hr style="margin: 7px 0px" />
최종{{ user.finalSigninDate }}
최종:
{{ member.getLastSigninedAt() | date: "yyyy-MM-dd HH:mm" }}
<hr style="margin: 7px 0px" />
IP{{ user.ip }}
IP: {{ member.getLastSigninedIp() }}
</div>
</div>
</ng-container>

View File

@ -11,14 +11,22 @@ import {
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { map, merge, Observable, Subject, switchMap, takeUntil } from 'rxjs';
import {
map,
merge,
Observable,
of,
Subject,
switchMap,
takeUntil,
} from 'rxjs';
import { fuseAnimations } from '@fuse/animations';
import { FuseConfirmationService } from '@fuse/services/confirmation';
import { User } from '../models/user';
import { UserPagination } from '../models/user-pagination';
import { UserService } from '../services/user.service';
import { Router } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
import { MatDialog } from '@angular/material/dialog';
import { CashComposeComponent } from '../compose/cash-compose.component';
@ -26,6 +34,11 @@ import { CommissionComposeComponent } from '../compose/commission-compose.compon
import { CompComposeComponent } from '../compose/comp-compose.component';
import { CouponComposeComponent } from '../compose/coupon-compose.component';
import { MessageComposeComponent } from '../compose/message-compose.component';
import { ListMembersResponse } from 'app/modules/proto/c2se/member_pb';
import { MemberModel, MemberState } from 'app/modules/proto/models/member_pb';
import { MemberClass } from 'app/modules/proto/models/member_class_pb';
import { MemberClassService } from 'app/modules/polyglot/member_class/services/member_class.service';
import { result } from 'lodash';
@Component({
selector: 'user-list',
@ -66,7 +79,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild(MatPaginator) private _paginator!: MatPaginator;
@ViewChild(MatSort) private _sort!: MatSort;
users$!: Observable<User[] | undefined>;
listMembers$!: Observable<MemberModel[] | undefined>;
__isSearchOpened = false;
isLoading = false;
@ -74,6 +87,8 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
selectedUser?: User;
pagination?: UserPagination;
memberClasses!: MemberClass[];
signoutBlockConfigForm!: FormGroup;
private _unsubscribeAll: Subject<any> = new Subject<any>();
@ -83,10 +98,12 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
*/
constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _activatedRoute: ActivatedRoute,
private _fuseConfirmationService: FuseConfirmationService,
private _formBuilder: FormBuilder,
private _userService: UserService,
private _identityService: IdentityService,
private _memberClassService: MemberClassService,
private router: Router,
private _matDialog: MatDialog
) {}
@ -111,7 +128,19 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
});
// Get the products
this.users$ = this._userService.users$;
this._memberClassService
.listMemberClasss()
.then((result) => (this.memberClasses = result.getMemberClassesList()));
// Get the products
this._activatedRoute.data.subscribe((data) => {
let listMemberResult: ListMembersResponse.Result = data['listmembers'];
this.listMembers$ = of(listMemberResult.getMembersList());
// Mark for check
this._changeDetectorRef.markForCheck();
});
// Set signout block config
this.__signoutBlockConfirmConfig();
@ -297,4 +326,61 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
this.signoutBlockConfigForm.value
);
}
__getParentUsername(member: MemberModel): string {
if (!member.getParentMember()) {
return '';
}
const parentUsername = member.getParentMember()?.getUsername();
const parentClassessId = member.getParentMember()?.getMemberClassId();
const findClass = this.findMemberClasses(parentClassessId);
if (!findClass) {
return '';
}
return `[${findClass.getName()}]${parentUsername}`;
}
__getMemberState(member: MemberModel): string {
const state = member.getState();
let resultStr = '';
switch (state) {
case MemberState.NONE:
resultStr = '없음';
break;
case MemberState.NORMAL:
resultStr = '정상';
break;
case MemberState.PENDING:
resultStr = '대기';
break;
case MemberState.WITHDRAWAL:
resultStr = '탈퇴';
break;
case MemberState.DORMANCY:
resultStr = '휴면';
break;
case MemberState.BLACKLIST:
resultStr = '블랙리스트';
break;
case MemberState.SUSPENDED:
resultStr = '정지';
break;
default:
break;
}
return resultStr;
}
private findMemberClasses(classId?: string): MemberClass | undefined {
if (!classId || classId === '') {
return undefined;
}
return this.memberClasses.find((mc) => mc.getId() === classId);
}
}

View File

@ -7,6 +7,11 @@ import {
} from '@angular/router';
import { MemberService } from 'app/modules/polyglot/member/services/member.service';
import { GetMemberResponse } from 'app/modules/proto/c2se/member_pb';
import {
ListMembersRequest,
ListMembersResponse,
} from 'app/modules/proto/c2se/member_pb';
import { catchError, Observable, throwError } from 'rxjs';
import { User } from '../models/user';
@ -85,6 +90,37 @@ export class UsersResolver implements Resolve<any> {
}
}
@Injectable({
providedIn: 'root',
})
export class ListMemberResolver implements Resolve<any> {
/**
* Constructor
*/
constructor(private _router: Router, private _memberService: MemberService) {}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Resolver
*
* @param route
* @param state
*/
resolve(
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot
):
| Observable<ListMembersResponse.Result>
| Promise<ListMembersResponse.Result>
| ListMembersResponse.Result {
return this._memberService.listMembers();
}
}
@Injectable({
providedIn: 'root',
})

View File

@ -7,6 +7,7 @@ import {
UsersResolver,
UserResolver,
MemberResolver,
ListMemberResolver,
} from './resolvers/user.resolver';
export const userRoutes: Route[] = [
@ -14,7 +15,7 @@ export const userRoutes: Route[] = [
path: '',
component: ListComponent,
resolve: {
users: UsersResolver,
listmembers: ListMemberResolver,
},
},
{