From f20682f2be23f9fd79d3bce1c326a7ad019156f6 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 26 Aug 2022 06:43:18 +0000 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=9E=84=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/components/view.component.html | 15 +++- .../member/user/components/view.component.ts | 68 ++++++++++++------- .../services/member_game_setting.service.ts | 6 +- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/src/app/modules/admin/member/user/components/view.component.html b/src/app/modules/admin/member/user/components/view.component.html index cd1d63d..6cb19cf 100644 --- a/src/app/modules/admin/member/user/components/view.component.html +++ b/src/app/modules/admin/member/user/components/view.component.html @@ -612,17 +612,26 @@ >
- + 파워볼베팅 - + 카지노 베팅 - + 슬롯베팅 diff --git a/src/app/modules/admin/member/user/components/view.component.ts b/src/app/modules/admin/member/user/components/view.component.ts index 7e423c0..46113e9 100644 --- a/src/app/modules/admin/member/user/components/view.component.ts +++ b/src/app/modules/admin/member/user/components/view.component.ts @@ -16,23 +16,13 @@ import { ValidatorFn, Validators, } from '@angular/forms'; -import { MatCheckboxChange } from '@angular/material/checkbox'; + import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; -import { - debounceTime, - map, - merge, - Observable, - Subject, - switchMap, - takeUntil, -} from 'rxjs'; +import { Observable, Subject, takeUntil } from 'rxjs'; import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; -import { User } from '../models/user'; -import { UserService } from '../services/user.service'; import { ActivatedRoute } from '@angular/router'; import { GetMemberResponse, @@ -42,11 +32,9 @@ import { } from 'app/modules/proto/c2se/member_pb'; import { MemberModel, MemberState } from 'app/modules/proto/models/member_pb'; import { MemberService } from 'app/modules/polyglot/member/services/member.service'; -import { MemberLevelService } from 'app/modules/polyglot/member_level/services/member_level.service'; -import { BankService } from 'app/modules/polyglot/bank/services/bank.service'; import { MemberLevel } from 'app/modules/proto/models/member_level_pb'; import { Bank } from 'app/modules/proto/models/bank_pb'; -import { SiteService } from 'app/modules/polyglot/site/services/site.service'; + import { Site } from 'app/modules/proto/models/site_pb'; import { MatDrawer } from '@angular/material/sidenav'; @@ -60,18 +48,16 @@ import { } from 'app/modules/proto/c2se/member_bank_account_pb'; import { MemberBankAccountService } from 'app/modules/polyglot/member_bank_account/services/member_bank_account.service'; import { ListBanksResponse } from 'app/modules/proto/c2se/bank_pb'; -import { ListMemberClassesResponse } from 'app/modules/proto/c2se/member_class_pb'; + import { ListSitesResponse } from 'app/modules/proto/c2se/site_pb'; -import { - GetMemberSettlementSettingResponse, - ListMemberSettlementSettingsResponse, - UpdateMemberSettlementSettingRequest, -} from 'app/modules/proto/c2se/member_settlement_setting_pb'; +import { UpdateMemberSettlementSettingRequest } from 'app/modules/proto/c2se/member_settlement_setting_pb'; import { ManualPaymentType, MemberSettlementSetting, } from 'app/modules/proto/models/member_settlement_setting_pb'; import { MemberSettlementSettingService } from 'app/modules/polyglot/member_settlement_setting/services/member_settlement_setting.service'; +import { UpdateMemberGameSettingRequest } from 'app/modules/proto/c2se/member_game_setting_pb'; +import { MemberGameSettingService } from 'app/modules/polyglot/member_game_setting/services/member_game_setting.service'; @Component({ selector: 'user-view', @@ -178,7 +164,8 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { private _formBuilder: FormBuilder, private _memberService: MemberService, private _memberBankAccountService: MemberBankAccountService, - private _memberSettlementSettingService: MemberSettlementSettingService + private _memberSettlementSettingService: MemberSettlementSettingService, + private _memberGameSettingService: MemberGameSettingService ) {} // ----------------------------------------------------------------------------------------------------- @@ -230,7 +217,11 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { manualPaymentTypeForPartner: ['', [Validators.required]], }); - this.memberGameSettingForm = this._formBuilder.group({}); + this.memberGameSettingForm = this._formBuilder.group({ + canBetPowerball: [], + canBetCasino: [], + canBetSlot: [], + }); this.passwordConfirmConfigForm = this._formBuilder.group({ title: '알림', @@ -321,6 +312,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { this.sites = listSitesResult.getSitesList(); const memberSettlement = this.currentMember?.getMemberSettlementSetting(); + const memberGameSetting = this.currentMember?.getMemberGameSetting(); this.memberDefaultForm.patchValue({ username: this.currentMember?.getUsername(), @@ -340,8 +332,6 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { description: this.currentMember?.getBankAccount()?.getMemo(), }); - console.log('canExchange: ', memberSettlement?.getCanExchange()); - this.memberSettleForm.patchValue({ rateCasinoBacara: memberSettlement?.getRateCasinoBacara(), rateCasinoRoulette: memberSettlement?.getRateCasinoRoulette(), @@ -357,6 +347,12 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { memberSettlement?.getManualPaymentTypeForPartner(), }); + this.memberGameSettingForm.patchValue({ + canBetPowerball: memberGameSetting?.getCanBetPowerball(), + canBetCasino: memberGameSetting?.getCanBetCasino(), + canBetSlot: memberGameSetting?.getCanBetSlot(), + }); + // Mark for check this._changeDetectorRef.markForCheck(); }); @@ -428,6 +424,7 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { break; case 'gameInfo': + this.modifyMemberGameSettingInfo(); break; case 'historyInfo': break; @@ -568,6 +565,27 @@ export class ViewComponent implements OnInit, AfterViewInit, OnDestroy { }) .finally(() => this.closeChangePasswordAlert()); } + + private modifyMemberGameSettingInfo(): void { + const { canBetPowerball, canBetCasino, canBetSlot } = + this.memberGameSettingForm.value; + + const updateGSReq = new UpdateMemberGameSettingRequest(); + updateGSReq.setId(this.currentMember?.getMemberGameSetting()?.getId()!); + updateGSReq.setCanBetPowerball(canBetPowerball); + updateGSReq.setCanBetCasino(canBetCasino); + updateGSReq.setCanBetSlot(canBetSlot); + + this._memberGameSettingService + .updateMemberGameSetting(updateGSReq) + .then((result) => { + this.showAlert('success', '수정이 완료되었습니다.'); + }) + .catch((reson) => { + this.showAlert('error', '수정 실패 잠시 후 다시 시도하세요.'); + }) + .finally(() => this.closeChangePasswordAlert()); + } /** * Navigate to the panel * diff --git a/src/app/modules/polyglot/member_game_setting/services/member_game_setting.service.ts b/src/app/modules/polyglot/member_game_setting/services/member_game_setting.service.ts index 600012e..9918e32 100644 --- a/src/app/modules/polyglot/member_game_setting/services/member_game_setting.service.ts +++ b/src/app/modules/polyglot/member_game_setting/services/member_game_setting.service.ts @@ -113,11 +113,11 @@ export class MemberGameSettingService { ); } - updateMemberGameSetting(): Promise { + updateMemberGameSetting( + req: UpdateMemberGameSettingRequest + ): Promise { return new Promise( (resolve, reject) => { - let req = new UpdateMemberGameSettingRequest(); - this.__natsService .request( SUBJECT_UPDATE_MEMBER_GAME_SETTING,