From f316bd2d97efb54ef48fde17b4e38fba2fc7b1aa Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期四, 11 一月 2024 17:17:01 +0800
Subject: [PATCH] project: remove lodash library

---
 PAMapp/shared/services/my-consultant.service.ts |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index 1b97fed..5356979 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -1,8 +1,8 @@
-import { http } from "./httpClient";
 
 import { AgentInfo } from '~/shared/models/agent-info.model';
+import { Appointment } from "../models/appointment.model";
 import { Consultant } from "../models/consultant.model";
-
+import { http } from "./httpClient";
 class MyConsultantService {
 
   async getFavoriteConsultantList(): Promise<Consultant[]> {
@@ -15,6 +15,10 @@
     });
   }
 
+  async getAllGroupByConsultant(): Promise<Consultant[]> {
+    return http.get<Consultant[]>('/appointment/customer/get_all_group_by_consultant').then((res) => res.data);
+  }
+
   private viewMyConsultantList(): void {
     http.post('/consultant/favorite/view');
   }
@@ -24,6 +28,40 @@
     return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
   }
 
+  // 蝘駁憿批��
+  async deleteConsultant(agentId: string) {
+    return http.delete(`/consultant/favorite/${agentId}`);
+  }
+
+  // 璅�撌脰蝯�
+  async markAsContact(appointmentId: number): Promise<Appointment> {
+    try {
+      const response = await http.post(`/appointment/markAsContacted/${appointmentId}`);
+      if (response !== null) {
+        return response.data;
+      } else {
+        throw new Error('http.post returned null-like value.');
+      }
+    } catch (error) {
+      console.error('An error occurred while marking appointment as contacted:', error);
+      // �隞亙甇方���隤斗����身��
+      throw error;
+    }
+  }
+
+
+  // ���“�����
+  getConsultantAvatar(agentNo:string):Promise<string>{
+    return http.get(`/consultant/avatar/${agentNo}`,{ responseType : 'arraybuffer' })
+      .then( response => {
+        const toBase64 = window.btoa(
+                          Array.from(new Uint8Array(response.data)).reduce((data, byte) =>
+                            data + String.fromCharCode(byte), '')
+                        );
+        const imgSrc = `data:image/png;base64,${toBase64}`;
+        return imgSrc;
+    });
+  }
 }
 
 export default new MyConsultantService();

--
Gitblit v1.8.0