| | |
| | | import { http } from "./httpClient"; |
| | | |
| | | import { NotificationList, UserReviewsConsultantsParams } from "../models/reviews.model"; |
| | | import { NotificationList, UserReviewPlatformRes, UserReviewParams } from "../models/reviews.model"; |
| | | import { AppointmentLog } from "../models/appointment.model"; |
| | | |
| | | class ReviewsService { |
| | | |
| | | //客戶進行滿意度評分(單筆) |
| | | userReviewsConsultants(data: UserReviewsConsultantsParams) { |
| | | userReviewsConsultants(data: UserReviewParams) { |
| | | return http.post('/satisfaction/score', data); |
| | | } |
| | | |
| | | // 客戶進行滿意度(多筆) |
| | | allUserReviewsConsultants(data: UserReviewsConsultantsParams[]) { |
| | | allUserReviewsConsultants(data: UserReviewParams[]) { |
| | | return http.post('/satisfaction/score/all', data); |
| | | } |
| | | |
| | |
| | | return http.get('/satisfaction/getMySatisfaction').then(res => res.data); |
| | | } |
| | | |
| | | // 顧問主動發送滿意度通知 |
| | | sendSatisfactionToClient(appointmentId: number) { |
| | | return http.post(`/consultant/sendSatisfactionToClient/${appointmentId}`).then((res) => res); |
| | | /** |
| | | * 顧問主動發送滿意度通知 |
| | | * @param appointmentId 預約的ID |
| | | * @returns 回傳發送結果 |
| | | */ |
| | | async sendSatisfactionToClient(appointmentId: number): Promise<any> { |
| | | try { |
| | | const response = await http.post(`/consultant/sendSatisfactionToClient/${appointmentId}`); |
| | | // 弱掃TEST3: 判斷 response && response.data |
| | | if (response) { |
| | | return response && response.data; |
| | | } else { |
| | | throw new Error('http.post returned null-like value.'); |
| | | } |
| | | } catch (error) { |
| | | // 可以在此處處理錯誤或回傳預設值 |
| | | console.error('An error occurred while sending satisfaction to client:', error); |
| | | throw error; |
| | | } |
| | | } |
| | | |
| | | // 通知小鈴鐺 |
| | |
| | | readAllMyNotification() { |
| | | return http.post('/personal_notification/readAllMyNotification') |
| | | } |
| | | |
| | | // 客戶填寫平台滿意度 |
| | | reviewPlatform(params: UserReviewParams): Promise<UserReviewPlatformRes> { |
| | | return http.post('/satisfaction/score', params); |
| | | } |
| | | } |
| | | |
| | | export default new ReviewsService(); |