From 3ecee0fa557b7bb9e83b67e289b316f04efa9ce5 Mon Sep 17 00:00:00 2001 From: jack <jack.su@pollex.com.tw> Date: 星期二, 05 九月 2023 11:59:07 +0800 Subject: [PATCH] Merge branch '滲透' of ssh://dev.pollex.com.tw:29418/pcalife/PAM into 滲透 --- PAMapp/shared/services/query-consultant.service.ts | 81 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 77 insertions(+), 4 deletions(-) diff --git a/PAMapp/shared/services/query-consultant.service.ts b/PAMapp/shared/services/query-consultant.service.ts index 1236fdc..23ac24d 100644 --- a/PAMapp/shared/services/query-consultant.service.ts +++ b/PAMapp/shared/services/query-consultant.service.ts @@ -1,14 +1,87 @@ import { http } from "./httpClient"; -import { Consultant } from "../models/consultant.model"; +import { Consultant } from "~/shared/models/consultant.model"; +import { FastQueryParams } from "~/shared/models/quick-filter.model"; +import { AgentOfStrictQuery, StrictQueryParams } from "~/shared/models/strict-query.model"; +import { AppointmentParams } from "~/shared/models/appointment.model"; class QueryConsultantService { - // ��靽憿批�� - async getRecommendConsultantList(): Promise<Consultant[]> { - return http.get<Consultant[]>('/consultant/recommend').then((res) => res.data); + // ��靽憿批�� + async getRecommendConsultantList(): Promise<Consultant[]> { + return http.get<Consultant[]>('/consultant/recommend').then((res) => res.data); + } + + // 敹恍�祟� + async fastQuery(data: FastQueryParams): Promise<Consultant[]> { + try { + const response = await http.post<Consultant[]>('/consultant/fastQuery', data); + if (response !== null) { + return response.data; + } else { + throw new Error('http.post returned null-like value.'); + } + } catch (error) { + console.error('An error occurred while performing fast query:', error); + // �隞亙甇方���隤斗����身�� + throw error; } + } + + + // ������ + async strictQuery(data: StrictQueryParams): Promise<AgentOfStrictQuery[]> { + try { + const response = await http.post('/consultant/strictQuery', data); + if (response !== null) { + return response.data; + } else { + throw new Error('http.post returned null-like value.'); + } + } catch (error) { + console.error('An error occurred while performing strict query:', error); + // �隞亙甇方���隤斗����身�� + throw error; + } + } + + + // ��憿批�� + async addFavoriteConsultant(addFavoriteConsultantList: AddFavoriteConsultantItem[]) { + const payload = { + consultantList: addFavoriteConsultantList + }; + return http.post('/consultant/favorite', payload); + } + + /** + * ����瘙� + * @param data ������瘙�����隞� + * @returns ������瘙��� + */ + async appointmentDemand(data: AppointmentParams) { + try { + // 撘望�est4: �� promise.then 撖急�� + return http.post('/appointment/customer/create', data).then((res) => { + if (res) { + return res['data']; + } else { + throw new Error('http.post returned null-like value.'); + } + }) + } catch (error) { + // �隞亙甇方���隤斗����身�� + console.error('An error occurred while creating appointment demand:', error); + throw error; + } + } + } export default new QueryConsultantService(); + +export interface AddFavoriteConsultantItem { + agentNo : string; + createdTime: string; +} -- Gitblit v1.8.0