From 965db8f11b4ce3df0c0604cc5f008d42aa6db7d4 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期六, 05 八月 2023 18:06:43 +0800
Subject: [PATCH] Fixed: [弱掃] p19.1 Bad use of null-like value

---
 PAMapp/shared/services/query-consultant.service.ts |   67 +++++++++++++++++++++++++++++++--
 1 files changed, 63 insertions(+), 4 deletions(-)

diff --git a/PAMapp/shared/services/query-consultant.service.ts b/PAMapp/shared/services/query-consultant.service.ts
index 1236fdc..8da40cd 100644
--- a/PAMapp/shared/services/query-consultant.service.ts
+++ b/PAMapp/shared/services/query-consultant.service.ts
@@ -1,14 +1,73 @@
 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[]>{
+    return http.post('/consultant/strictQuery', data).then((res) => res.data);
+  }
+
+  // ��憿批��
+  async addFavoriteConsultant(addFavoriteConsultantList: AddFavoriteConsultantItem[]) {
+    const payload = {
+      consultantList: addFavoriteConsultantList
+    };
+    return http.post('/consultant/favorite', payload);
+  }
+
+  /**
+   * ����瘙�
+   * @param data ������瘙�����隞�
+   * @returns ������瘙���
+   */
+  async  appointmentDemand(data: AppointmentParams) {
+    try {
+      const response = await http.post('/appointment/customer/create', 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 creating appointment demand:', error);
+      throw error;
+    }
+  }
+
 
 }
 
 export default new QueryConsultantService();
+
+export interface AddFavoriteConsultantItem {
+  agentNo    : string;
+  createdTime: string;
+}

--
Gitblit v1.9.3