[대상향] 웹링크 결재 카운트 처리.

This commit is contained in:
leejinho 2019-12-19 18:08:16 +09:00
parent c88b198abb
commit 83e29c172b
3 changed files with 38 additions and 16 deletions

View File

@ -245,12 +245,7 @@ export class TopBarComponent implements OnInit, OnDestroy {
this.nativeService.openDefaultBrowser(url);
}
getShowWebLinkbadge(link: WebLink): boolean {
const showType = [
'WebLinkMail',
'WebLinkMailCnt',
'WebLinkPayment',
'WebLinkPaymentCnt'
];
const showType = ['WebLinkMail', 'WebLinkPayment'];
if (showType.indexOf(link.key) > -1) {
return false;

View File

@ -9,12 +9,6 @@ export const decodeMailCount: APIDecoder<MailCountResponse> = (res: any) => {
const domParser = new DOMParser();
const dom: Document = domParser.parseFromString(res, 'text/xml');
let systemName = '';
const systemNameDom: HTMLCollection = dom.getElementsByTagName('COUNT');
if (!!systemNameDom && systemNameDom.length > 0) {
systemName = systemNameDom[0].textContent;
}
let count = 0;
const countDom: HTMLCollection = dom.getElementsByTagName('COUNT');
if (!!countDom && countDom.length > 0) {
@ -24,7 +18,35 @@ export const decodeMailCount: APIDecoder<MailCountResponse> = (res: any) => {
: 0;
}
return {
systemName,
systemName: 'mailCount',
count
} as MailCountResponse;
};
export interface PaymentCountResponse {
systemName: string;
count: number;
}
export const decodePaymentCount: APIDecoder<PaymentCountResponse> = (
res: any
) => {
const domParser = new DOMParser();
const dom: Document = domParser.parseFromString(res, 'text/xml');
let count = 0;
const viewentriesDom: HTMLCollection = dom.getElementsByTagName(
'viewentries'
);
if (!!viewentriesDom && viewentriesDom.length > 0) {
count =
viewentriesDom[0].getAttribute('toplevelentries').trim().length > 0
? Number(viewentriesDom[0].getAttribute('toplevelentries').trim())
: 0;
}
return {
systemName: 'paymentCount',
count
} as PaymentCountResponse;
};

View File

@ -5,7 +5,12 @@ import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { NGXLogger } from 'ngx-logger';
import { decodeMailCount, MailCountResponse } from '../apis/api';
import {
decodeMailCount,
MailCountResponse,
decodePaymentCount,
PaymentCountResponse
} from '../apis/api';
@Injectable({
providedIn: 'root'
@ -19,9 +24,9 @@ export class DaesangApiService {
.pipe(map(res => decodeMailCount(res)));
}
public retrievePaymentCount(url: string): Observable<any> {
public retrievePaymentCount(url: string): Observable<PaymentCountResponse> {
return this.httpClient
.post<any>(url, {}, {})
.pipe(map(res => decodeMailCount(res)));
.pipe(map(res => decodePaymentCount(res)));
}
}