From f36e617e9e534a4b05f2029724d678bbd6c655b3 Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期三, 22 十二月 2021 11:38:54 +0800
Subject: [PATCH] refactor: separate api/consultant.ts into serveral services

---
 PAMapp/components/QuickFilter/QuickFilterSelector.vue |    2 
 PAMapp/pages/quickFilter/index.vue                    |    7 +
 PAMapp/store/index.ts                                 |   20 ++--
 PAMapp/pages/recommendConsultant/result.vue           |    2 
 PAMapp/pages/questionnaire/_agentNo.vue               |   13 ++-
 PAMapp/shared/storageRequests.ts                      |    2 
 PAMapp/pages/accountSetting/index.vue                 |    7 +
 PAMapp/components/Consultant/ConsultantCard.vue       |    5 
 /dev/null                                             |   12 ---
 PAMapp/shared/services/appointment.service.ts         |    9 +
 PAMapp/shared/services/account-setting.service.ts     |   17 ++++
 PAMapp/shared/services/query-consultant.service.ts    |   33 +++++++-
 PAMapp/shared/services/reviews.service.ts             |   13 +++
 PAMapp/store/localStorage.ts                          |    2 
 PAMapp/shared/models/quick-filter.model.ts            |   14 +-
 PAMapp/shared/models/strict-query.model.ts            |   24 ++++++
 PAMapp/shared/const/quickFilter-questionList.ts       |    2 
 PAMapp/shared/models/appointment.model.ts             |   39 +++++++++
 PAMapp/shared/models/reviews.model.ts                 |    4 +
 PAMapp/shared/services/my-consultant.service.ts       |    5 +
 20 files changed, 178 insertions(+), 54 deletions(-)

diff --git a/PAMapp/components/Consultant/ConsultantCard.vue b/PAMapp/components/Consultant/ConsultantCard.vue
index 1bc5269..6d2c5ae 100644
--- a/PAMapp/components/Consultant/ConsultantCard.vue
+++ b/PAMapp/components/Consultant/ConsultantCard.vue
@@ -130,11 +130,12 @@
 import { Vue, Component, Prop, Action, namespace } from 'nuxt-property-decorator';
 
 import appointmentService from '~/shared/services/appointment.service';
+import reviewsService from '~/shared/services/reviews.service';
 import { isMobileDevice } from '~/shared/device';
 import { hideReviews } from '~/shared/const/hide-reviews';
-import { UserReviewsConsultantsParams, userReviewsConsultants } from '~/shared/api/consultant';
 import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
 import { Appointment } from '~/shared/models/appointment.model';
+import { UserReviewsConsultantsParams } from '~/shared/models/reviews.model';
 
 const localStorage = namespace('localStorage');
 @Component({
@@ -354,7 +355,7 @@
         }
         this.appointmentDetail.satisfactionScore = this.inputScore;
 
-        userReviewsConsultants(reviewParams).then((res) => {
+        reviewsService.userReviewsConsultants(reviewParams).then((res) => {
             this.reviewsBtn = false;
             this.storeConsultantList();
         });
diff --git a/PAMapp/components/QuickFilter/QuickFilterSelector.vue b/PAMapp/components/QuickFilter/QuickFilterSelector.vue
index 8797fc0..f2b434b 100644
--- a/PAMapp/components/QuickFilter/QuickFilterSelector.vue
+++ b/PAMapp/components/QuickFilter/QuickFilterSelector.vue
@@ -67,7 +67,7 @@
 <script lang="ts">
 import { Vue, Component, Prop, Watch, Emit } from 'nuxt-property-decorator';
 import { hideReviews } from '~/shared/const/hide-reviews';
-import { FastQueryParams, QuestionOption, Selected } from '~/shared/models/quickFilter.model';
+import { FastQueryParams, QuestionOption, Selected } from '~/shared/models/quick-filter.model';
 @Component
 export default class QuickFilterDrawer extends Vue {
     pickedItem: FastQueryParams = {
diff --git a/PAMapp/pages/accountSetting/index.vue b/PAMapp/pages/accountSetting/index.vue
index e1c8058..33ecd55 100644
--- a/PAMapp/pages/accountSetting/index.vue
+++ b/PAMapp/pages/accountSetting/index.vue
@@ -70,8 +70,9 @@
 
 <script lang="ts">
 import { Vue,Component } from 'vue-property-decorator'
-import { getUserAccountSetting, updateAccountSetting } from '~/shared/api/consultant';
 import { UserSetting } from '~/shared/models/account.model';
+
+import accountSettingService from '~/shared/services/account-setting.service';
 
 @Component
 export default class AccountSetting extends Vue {
@@ -139,7 +140,7 @@
                 phone: this.phoneValue,
                 email: this.emailValue
             }
-            updateAccountSetting(editSettingInfo).then((res: any) => {
+            accountSettingService.updateAccountSetting(editSettingInfo).then((res: any) => {
                 console.log('updateRes:', res);
                 this.resetSettingForm();
             });
@@ -153,7 +154,7 @@
         }
 
         mounted(){
-            getUserAccountSetting().then((userInfo: UserSetting)=>{
+            accountSettingService.getUserAccountSetting().then((userInfo: UserSetting)=>{
                 this._userSetting = {
                     name: userInfo.name || '',
                     phone: userInfo.phone || '',
diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index 5ac1167..83f35e9 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -140,13 +140,16 @@
 
 <script lang="ts">
 import { Vue, Component, State, Action, Watch, namespace } from 'nuxt-property-decorator';
-import { addFavoriteConsultant, appointmentDemand, AppointmentParams, AppointmentRequests ,editAppointment } from '~/shared/api/consultant';
-import { getRequestQuestionFromStorage, getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/shared/storageRequests';
+import { getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/shared/storageRequests';
 import _ from 'lodash';
+
+import queryConsultantService from '~/shared/services/query-consultant.service';
+import appointmentService from '~/shared/services/appointment.service';
 import { Consultant } from '~/shared/models/consultant.model';
 import { ContactType } from '~/shared/models/enum/ContactType';
 import { Gender } from '~/shared/models/enum/Gender';
 import { RegisterInfo } from '~/shared/models/registerInfo';
+import { AppointmentParams, AppointmentRequests } from '~/shared/models/appointment.model';
 
   const roleStorage = namespace('localStorage');
   @Component
@@ -350,7 +353,7 @@
       if (this.isEditBtn) {
         this.sentEditAppointmentDemand();
       } else {
-        addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand());
+        queryConsultantService.addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand());
       }
 
     }
@@ -363,7 +366,7 @@
           agentNo: this.$route.params.agentNo
         };
 
-        appointmentDemand(data).then(res => {
+        queryConsultantService.appointmentDemand(data).then(res => {
             this.sendReserve = true;
             this.myRequest.hopeContactTime = [];
             setRequestsToStorage(this.myRequest);
@@ -378,7 +381,7 @@
           id: this.appointmentId,
           otherRequirement: null
         }
-        editAppointment(info).then(res => {
+        appointmentService.editAppointment(info).then(res => {
           this.sendReserve = true;
           this.myRequest.hopeContactTime = [];
           setRequestsToStorage(this.myRequest);
diff --git a/PAMapp/pages/quickFilter/index.vue b/PAMapp/pages/quickFilter/index.vue
index 8aa5f7a..e8f352f 100644
--- a/PAMapp/pages/quickFilter/index.vue
+++ b/PAMapp/pages/quickFilter/index.vue
@@ -66,10 +66,11 @@
 
 <script lang="ts">
 import { Vue, Component, namespace } from 'nuxt-property-decorator';
+
+import queryConsultantService from '~/shared/services/query-consultant.service';
 import { Consultant } from '~/shared/models/consultant.model';
-import { fastQuery } from '~/shared/api/consultant';
 import { questionList } from '~/shared/const/quickFilter-questionList';
-import { FastQueryParams, QuestionOption, Selected } from '~/shared/models/quickFilter.model';
+import { FastQueryParams, QuestionOption, Selected } from '~/shared/models/quick-filter.model';
 
 const localStorage = namespace('localStorage');
 @Component
@@ -168,7 +169,7 @@
             status: ''
         }
 
-        fastQuery(data).then((consultantList) => {
+        queryConsultantService.fastQuery(data).then((consultantList) => {
             this.consultantList = consultantList;
             this.storageQuickFilter(JSON.stringify(this.confirmItem))
         })
diff --git a/PAMapp/pages/recommendConsultant/result.vue b/PAMapp/pages/recommendConsultant/result.vue
index 0b0c85e..3695bfc 100644
--- a/PAMapp/pages/recommendConsultant/result.vue
+++ b/PAMapp/pages/recommendConsultant/result.vue
@@ -83,8 +83,8 @@
 </template>
 <script lang="ts">
 import {Vue,Component, State, namespace, Action} from 'nuxt-property-decorator';
-import { AgentOfStrictQuery } from '~/shared/api/consultant';
 import { hideReviews } from '~/shared/const/hide-reviews';
+import { AgentOfStrictQuery } from '~/shared/models/strict-query.model';
 
 const localStorage = namespace('localStorage');
 
diff --git a/PAMapp/shared/api/consultant.ts b/PAMapp/shared/api/consultant.ts
deleted file mode 100644
index 7caea29..0000000
--- a/PAMapp/shared/api/consultant.ts
+++ /dev/null
@@ -1,164 +0,0 @@
-import { AxiosResponse } from 'axios';
-import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
-import _ from 'lodash';
-import { UserSetting } from '../models/account.model';
-import { Consultant } from '~/shared/models/consultant.model';
-import { http } from '../services/httpClient';
-import { FastQueryParams } from '../models/quickFilter.model';
-
-
-// ��靽憿批��
-export function recommend() {
-    return http.get<Consultant[]>('/consultant/recommend')
-            .then(res => res.data);
-}
-
-// 敹恍�祟�
-export function fastQuery(data: FastQueryParams) {
-    return http.post<Consultant[]>('/consultant/fastQuery', data).then(res => res.data);
-}
-
-// ������
-export function strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{
-    return http.post('/consultant/strictQuery', data)
-}
-
-// ��憿批��
-export function addFavoriteConsultant(agentNoList: string[]) {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.post('/consultant/favorite', {agentNoList}, {headers})
-}
-
-// ����岷���
-export function appointmentDemand(data: AppointmentParams) {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.post('/appointment/customer/create', data, {headers})
-}
-
-//憿批�底蝝啗���
-export function getConsultantDetail(agentNo:string){
-    return http.get('/consultant/detail', {params:{agentNo:agentNo}})
-}
-
-// 蝘駁憿批��
-export function deleteConsultant(agentId: string) {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.delete('/consultant/favorite/'+agentId, {headers})
-}
-
-//���蝙��董�����
-export function getUserAccountSetting() : Promise<UserSetting> {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.get<UserSetting>('/customer/info', {headers}).then(res => res.data);
-}
-
-//��雿輻�董�����
-export function updateAccountSetting(params: any) : any {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.put('/customer/info', params ,{headers}).then(res => res.data);
-}
-
-//摰X�脰�遛��漲閰��
-
-export function userReviewsConsultants(data: UserReviewsConsultantsParams) {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.post('/satisfaction/create', data ,{headers});
-}
-
-// ������
-// export function cancelAppointment(appointment: number) {
-//     const headers = {
-//         Authorization: 'Bearer ' + localStorage.getItem('id_token')
-//     }
-//     return http.delete('/appointment/'+appointment ,{headers});
-// }
-
-// 蝺刻摩����
-export function editAppointment(editAppointmentParams: editAppointmentParams) {
-    const headers = {
-        Authorization: 'Bearer ' + localStorage.getItem('id_token')
-    }
-    return http.put('/appointment', editAppointmentParams, {headers});
-}
-
-export interface AppointmentRequests {
-    phone          : string,
-    email          : string,
-    contactType    : string,
-    gender         : string,
-    age            : string,
-    job            : string,
-    requirement    : string[],
-    hopeContactTime: ContactTime[],
-    agentNo        : string,
-}
-export interface ContactTime {
-  selectWeekOptions : string[],
-  selectTimesOptions: string[]
-}
-export interface AppointmentParams {
-    phone          : string,
-    email          : string,
-    contactType    : string,
-    gender         : string,
-    age            : string,
-    job            : string,
-    requirement    : string,
-    hopeContactTime: string,
-    agentNo        : string
-}
-export interface StrictQueryParams{
-    gender          : string;
-    avgScore        : number;
-    status          : string;    //phase 1 disable
-    area            : string;
-    requirements    : string[];
-    otherRequirement: string;
-    seniority       : string;
-    popularTags     : string[];
-    otherPopularTags: string;
-}
-export interface AgentOfStrictQuery {
-    agentNo      : string;
-    name         : string;
-    img          : string;
-    expertise    : string[];
-    avgScore     : number;
-    contactStatus: null;
-    updateTime   : null;
-    seniority    : string;
-    new          : boolean;
-}
-export interface RequestOfLoginSuccess{
-  id_token: string;
-}
-
-export interface UserReviewsConsultantsParams{
-    appointmentId: number,
-    score        : number,
-}
-
-export interface editAppointmentParams {
-    id              : number,
-    phone           : string,
-    email           : string,
-    contactType     : string,
-    gender          : string,
-    age             : string,
-    job             : string,
-    requirement     : string,
-    hopeContactTime : string,
-    otherRequirement: null
-}
diff --git a/PAMapp/shared/const/quickFilter-questionList.ts b/PAMapp/shared/const/quickFilter-questionList.ts
index ea35dca..42af218 100644
--- a/PAMapp/shared/const/quickFilter-questionList.ts
+++ b/PAMapp/shared/const/quickFilter-questionList.ts
@@ -1,4 +1,4 @@
-import { QuestionOption } from "../models/quickFilter.model";
+import { QuestionOption } from "~/shared/models/quick-filter.model";
 
 export const questionList: QuestionOption[] = [
     {
diff --git a/PAMapp/shared/models/UserReviewsConsultantsParams.ts b/PAMapp/shared/models/UserReviewsConsultantsParams.ts
deleted file mode 100644
index 93ece16..0000000
--- a/PAMapp/shared/models/UserReviewsConsultantsParams.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface UserReviewsConsultantsParams{
-  appointmentId:number,
-  score:number,
-}
diff --git a/PAMapp/shared/models/agentOfStrictQuery.ts b/PAMapp/shared/models/agentOfStrictQuery.ts
deleted file mode 100644
index 16d6627..0000000
--- a/PAMapp/shared/models/agentOfStrictQuery.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-
-export interface AgentOfStrictQuery {
-  agentNo: string;
-  name: string;
-  img: string;
-  expertise: string[];
-  avgScore: number;
-  contactStatus: null;
-  updateTime: null;
-  seniority: string;
-  new: boolean;
-}
diff --git a/PAMapp/shared/models/appointment.model.ts b/PAMapp/shared/models/appointment.model.ts
index f411b7a..1774dd6 100644
--- a/PAMapp/shared/models/appointment.model.ts
+++ b/PAMapp/shared/models/appointment.model.ts
@@ -55,4 +55,41 @@
   customerId       : number;
   name             : string;
 }
-
+export interface AppointmentParams {
+  phone          : string;
+  email          : string;
+  contactType    : string;
+  gender         : string;
+  age            : string;
+  job            : string;
+  requirement    : string;
+  hopeContactTime: string;
+  agentNo        : string;
+}
+export interface EditAppointmentParams {
+  id              : number,
+  phone           : string,
+  email           : string,
+  contactType     : string,
+  gender          : string,
+  age             : string,
+  job             : string,
+  requirement     : string,
+  hopeContactTime : string,
+  otherRequirement: null
+}
+export interface AppointmentRequests {
+  phone          : string,
+  email          : string,
+  contactType    : string,
+  gender         : string,
+  age            : string,
+  job            : string,
+  requirement    : string[],
+  hopeContactTime: ContactTime[],
+  agentNo        : string,
+}
+export interface ContactTime {
+selectWeekOptions : string[],
+selectTimesOptions: string[]
+}
diff --git a/PAMapp/shared/models/appointmentParams.ts b/PAMapp/shared/models/appointmentParams.ts
deleted file mode 100644
index e3eead8..0000000
--- a/PAMapp/shared/models/appointmentParams.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-
-export interface AppointmentParams {
-  phone: string;
-  email: string;
-  contactType: string;
-  gender: string;
-  age: string;
-  job: string;
-  requirement: string;
-  hopeContactTime: string;
-  agentNo: string;
-}
diff --git a/PAMapp/shared/models/fastQueryParams.model.ts b/PAMapp/shared/models/fastQueryParams.model.ts
deleted file mode 100644
index c24376d..0000000
--- a/PAMapp/shared/models/fastQueryParams.model.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-
-export interface FastQueryParams {
-  gender: string;
-  communicationStyles: string[];
-  avgScore: number;
-  status: string;
-}
diff --git a/PAMapp/shared/models/quickFilter.model.ts b/PAMapp/shared/models/quick-filter.model.ts
similarity index 72%
rename from PAMapp/shared/models/quickFilter.model.ts
rename to PAMapp/shared/models/quick-filter.model.ts
index 9445659..1364f73 100644
--- a/PAMapp/shared/models/quickFilter.model.ts
+++ b/PAMapp/shared/models/quick-filter.model.ts
@@ -1,13 +1,13 @@
 export interface QuestionOption {
-    title: string;
+    title : string;
     detail: Detail[];
-    type: string;
-    name: string;
+    type  : string;
+    name  : string;
 }
 
 interface Detail {
-    value: string;
-    name?: string;
+    value    : string;
+    name?    : string;
     className: string;
 }
 
@@ -20,5 +20,5 @@
 
 export interface Selected {
     option: string;
-    value: any;
-}
\ No newline at end of file
+    value : any;
+}
diff --git a/PAMapp/shared/models/reviews.model.ts b/PAMapp/shared/models/reviews.model.ts
new file mode 100644
index 0000000..438cdd3
--- /dev/null
+++ b/PAMapp/shared/models/reviews.model.ts
@@ -0,0 +1,4 @@
+export interface UserReviewsConsultantsParams{
+  appointmentId: number,
+  score        : number,
+}
diff --git a/PAMapp/shared/models/strict-query.model.ts b/PAMapp/shared/models/strict-query.model.ts
new file mode 100644
index 0000000..59892c1
--- /dev/null
+++ b/PAMapp/shared/models/strict-query.model.ts
@@ -0,0 +1,24 @@
+
+export interface StrictQueryParams {
+  gender          : string;
+  avgScore        : number;
+  status          : string;    //phase 1 disable
+  area            : string;
+  requirements    : string[];
+  otherRequirement: string;
+  seniority       : string;
+  popularTags     : string[];
+  otherPopularTags: string;
+}
+
+export interface AgentOfStrictQuery {
+  agentNo      : string;
+  name         : string;
+  img          : string;
+  expertise    : string[];
+  avgScore     : number;
+  contactStatus: null;
+  updateTime   : null;
+  seniority    : string;
+  new          : boolean;
+}
diff --git a/PAMapp/shared/models/strictQueryParams.ts b/PAMapp/shared/models/strictQueryParams.ts
deleted file mode 100644
index ba69baf..0000000
--- a/PAMapp/shared/models/strictQueryParams.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-
-export interface StrictQueryParams {
-  gender: string;
-  avgScore: number;
-  status: string; //phase 1 disable
-  area: string;
-  requirements: string[];
-  otherRequirement: string;
-  seniority: string;
-  popularTags: string[];
-  otherPopularTags: string;
-}
diff --git a/PAMapp/shared/services/account-setting.service.ts b/PAMapp/shared/services/account-setting.service.ts
new file mode 100644
index 0000000..ab560f5
--- /dev/null
+++ b/PAMapp/shared/services/account-setting.service.ts
@@ -0,0 +1,17 @@
+import { http } from "./httpClient";
+
+import { UserSetting } from "~/shared/models/account.model";
+
+class AccountSettingService{
+
+  //���蝙��董�����
+  async getUserAccountSetting() : Promise<UserSetting> {
+    return http.get<UserSetting>('/customer/info').then(res => res.data);
+  }
+  //��雿輻�董�����
+  async updateAccountSetting(params: any) : Promise<any> {
+    return http.put('/customer/info', params ).then(res => res.data);
+  }
+
+}
+export default new AccountSettingService();
diff --git a/PAMapp/shared/services/appointment.service.ts b/PAMapp/shared/services/appointment.service.ts
index 33f33b2..ef4cea0 100644
--- a/PAMapp/shared/services/appointment.service.ts
+++ b/PAMapp/shared/services/appointment.service.ts
@@ -1,7 +1,7 @@
 import { http } from "./httpClient";
 
-import { ClientInfo } from "../models/client.model";
-import { AppointmentDetail } from "../models/appointment.model";
+import { ClientInfo } from "~/shared/models/client.model";
+import { AppointmentDetail, EditAppointmentParams } from "~/shared/models/appointment.model";
 
 class AppointmentService {
 
@@ -43,6 +43,11 @@
     return http.delete(`/appointment/${appointmentId}`);
   }
 
+  // 蝺刻摩����
+  editAppointment(editAppointmentParams: EditAppointmentParams) {
+    return http.put('/appointment', editAppointmentParams);
+  }
+
 }
 
 export default new AppointmentService();
diff --git a/PAMapp/shared/services/my-consultant.service.ts b/PAMapp/shared/services/my-consultant.service.ts
index 1b97fed..c4d4fa2 100644
--- a/PAMapp/shared/services/my-consultant.service.ts
+++ b/PAMapp/shared/services/my-consultant.service.ts
@@ -24,6 +24,11 @@
     return http.get('/consultant/detail', {params:{agentNo:agentNo}}).then((res) => res.data);
   }
 
+  // 蝘駁憿批��
+  async deleteConsultant(agentId: string) {
+    return http.delete(`/consultant/favorite/${agentId}`);
+  }
+
 }
 
 export default new MyConsultantService();
diff --git a/PAMapp/shared/services/query-consultant.service.ts b/PAMapp/shared/services/query-consultant.service.ts
index 1236fdc..a11cd13 100644
--- a/PAMapp/shared/services/query-consultant.service.ts
+++ b/PAMapp/shared/services/query-consultant.service.ts
@@ -1,13 +1,36 @@
 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[]> {
+    return http.post<Consultant[]>('/consultant/fastQuery', data).then(res => res.data);
+  }
+
+  // ������
+  async strictQuery(data:StrictQueryParams): Promise<AgentOfStrictQuery[]>{
+    return http.post('/consultant/strictQuery', data).then((res) => res.data);
+  }
+
+  // ��憿批��
+  async addFavoriteConsultant(agentNoList: string[]) {
+    return http.post('/consultant/favorite', { agentNoList });
+  }
+
+  // ����岷���
+  async appointmentDemand(data: AppointmentParams) {
+    return http.post('/appointment/customer/create', data);
+  }
 
 }
 
diff --git a/PAMapp/shared/services/reviews.service.ts b/PAMapp/shared/services/reviews.service.ts
new file mode 100644
index 0000000..9eaa5e4
--- /dev/null
+++ b/PAMapp/shared/services/reviews.service.ts
@@ -0,0 +1,13 @@
+import { http } from "./httpClient";
+
+import { UserReviewsConsultantsParams } from "../models/reviews.model";
+
+class ReviewsService {
+
+  //摰X�脰�遛��漲閰��
+  userReviewsConsultants(data: UserReviewsConsultantsParams) {
+    return http.post('/satisfaction/create', data );
+  }
+}
+
+export default new ReviewsService();
diff --git a/PAMapp/shared/storageRequests.ts b/PAMapp/shared/storageRequests.ts
index 4b499a5..a50917f 100644
--- a/PAMapp/shared/storageRequests.ts
+++ b/PAMapp/shared/storageRequests.ts
@@ -1,4 +1,4 @@
-import { AppointmentRequests } from "./api/consultant";
+import { AppointmentRequests } from "./models/appointment.model";
 
 export function getRequestsFromStorage(): AppointmentRequests {
   const requests = localStorage.getItem('myRequests');
diff --git a/PAMapp/store/index.ts b/PAMapp/store/index.ts
index 98316db..73ab54c 100644
--- a/PAMapp/store/index.ts
+++ b/PAMapp/store/index.ts
@@ -1,15 +1,17 @@
+import { StrictQueryParams } from '~/shared/models/strict-query.model';
 import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
 
 import { getMyReviewLog } from '~/shared/api/appointment';
-import { recommend, AgentOfStrictQuery, addFavoriteConsultant, deleteConsultant, strictQuery } from '~/shared/api/consultant';
 import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
 
 import myConsultantService from '~/shared/services/my-consultant.service';
+import queryConsultantService from '~/shared/services/query-consultant.service';
 import appointmentService from '~/shared/services/appointment.service';
 
 import { Consultant } from '~/shared/models/consultant.model';
 import { AppointmentLog } from '~/shared/models/appointment.model';
 import { ClientInfo } from '~/shared/models/client.model';
+import { AgentOfStrictQuery } from '~/shared/models/strict-query.model';
 @Module
 export default class Store extends VuexModule {
     recommendList: Consultant[] = [];
@@ -57,7 +59,7 @@
 
     @Action
     storeRecommendList() {
-        recommend().then(data => {
+        queryConsultantService.getRecommendConsultantList().then(data => {
             this.context.commit('updateRecommend', data)
         })
     }
@@ -74,7 +76,7 @@
 
         if (localData?.length) {
             const agentNoList = localData.map(i => i.agentNo)
-            await addFavoriteConsultant(agentNoList).then(res => {
+            await queryConsultantService.addFavoriteConsultant(agentNoList).then(res => {
                 localStorage.removeItem('favoriteConsultant')
             })
         }
@@ -94,7 +96,7 @@
         if (!this.isUserLogin) {
             setFavoriteToStorage(left);
         } else {
-            await deleteConsultant(agentNo)
+            await myConsultantService.deleteConsultant(agentNo)
         }
 
         this.context.commit('updateConsultantList', left)
@@ -109,7 +111,7 @@
             if (!found) {
                 const newData = [consultantToAdd].concat(this.myConsultantList);
                 if (this.isUserLogin) {
-                    await addFavoriteConsultant([consultantToAdd.agentNo])
+                    await queryConsultantService.addFavoriteConsultant([consultantToAdd.agentNo])
                 } else {
                     setFavoriteToStorage(newData);
                 }
@@ -154,11 +156,11 @@
     }
 
     @Action
-    async storeStrictQueryList(strictQueryDto) {
-        return await strictQuery(strictQueryDto).then(res=>{
+    async storeStrictQueryList(strictQueryDto: StrictQueryParams) {
+        return await queryConsultantService.strictQuery(strictQueryDto).then(res=>{
             this.context.commit('localStorage/storageRecommendConsultant', JSON.stringify(strictQueryDto));
-            this.context.commit('updateStrictQueryList', res.data)
-            return res.data.length;
+            this.context.commit('updateStrictQueryList', res)
+            return res.length;
         });
     }
 
diff --git a/PAMapp/store/localStorage.ts b/PAMapp/store/localStorage.ts
index 70f3fa2..aefef14 100644
--- a/PAMapp/store/localStorage.ts
+++ b/PAMapp/store/localStorage.ts
@@ -1,6 +1,6 @@
 import { Module, Mutation, VuexModule ,Action } from 'vuex-module-decorators';
 import { Role } from '~/shared/models/enum/role';
-import { Selected } from '~/shared/models/quickFilter.model';
+import { Selected } from '~/shared/models/quick-filter.model';
 @Module
 export default class LocalStorage extends VuexModule {
   id_token = localStorage.getItem('id_token');

--
Gitblit v1.8.0