From 95d0e5524c3ab1e55a9909e2c38e7cc35901220f Mon Sep 17 00:00:00 2001
From: 劉鈞霖 <benson@gmail.com>
Date: 星期三, 15 十二月 2021 14:52:58 +0800
Subject: [PATCH] [ Update ] :新增 pamService class 將 consultant interface 移出

---
 PAMapp/assets/ts/models/editAppointmentParams.model.ts  |   12 ++
 PAMapp/assets/ts/models/clientInfo.ts                   |   18 +++
 PAMapp/assets/ts/models/fastQueryParams.model.ts        |    7 +
 PAMapp/assets/ts/models/strictQueryParams.ts            |   12 ++
 PAMapp/assets/ts/models/loginRequest.model.ts           |    7 +
 PAMapp/assets/ts/models/otpInfo.model.ts                |    9 +
 PAMapp/assets/ts/services/pamService.service.ts         |  132 ++++++++++++++++++++++++++
 PAMapp/assets/ts/models/loginVerify.model.ts            |    9 +
 PAMapp/assets/ts/models/registerInfo.ts                 |   10 ++
 PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts |    4 
 PAMapp/assets/ts/models/agentOfStrictQuery.ts           |   12 ++
 PAMapp/assets/ts/models/loginSuccessToken.model.ts      |    4 
 PAMapp/assets/ts/models/appointmentParams.ts            |   12 ++
 13 files changed, 248 insertions(+), 0 deletions(-)

diff --git a/PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts b/PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts
new file mode 100644
index 0000000..93ece16
--- /dev/null
+++ b/PAMapp/assets/ts/models/UserReviewsConsultantsParams.ts
@@ -0,0 +1,4 @@
+export interface UserReviewsConsultantsParams{
+  appointmentId:number,
+  score:number,
+}
diff --git a/PAMapp/assets/ts/models/agentOfStrictQuery.ts b/PAMapp/assets/ts/models/agentOfStrictQuery.ts
new file mode 100644
index 0000000..16d6627
--- /dev/null
+++ b/PAMapp/assets/ts/models/agentOfStrictQuery.ts
@@ -0,0 +1,12 @@
+
+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/assets/ts/models/appointmentParams.ts b/PAMapp/assets/ts/models/appointmentParams.ts
new file mode 100644
index 0000000..e3eead8
--- /dev/null
+++ b/PAMapp/assets/ts/models/appointmentParams.ts
@@ -0,0 +1,12 @@
+
+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/assets/ts/models/clientInfo.ts b/PAMapp/assets/ts/models/clientInfo.ts
new file mode 100644
index 0000000..4529e8a
--- /dev/null
+++ b/PAMapp/assets/ts/models/clientInfo.ts
@@ -0,0 +1,18 @@
+
+export interface ClientInfo {
+  id: number;
+  phone: string;
+  email: string;
+  contactType: string;
+  gender: string;
+  age: string;
+  job: string;
+  requirement: string;
+  communicateStatus: string;
+  hopeContactTime: string;
+  otherRequirement: string;
+  appointmentDate: Date;
+  agentNo: string;
+  customerId: number;
+  name: string;
+}
diff --git a/PAMapp/assets/ts/models/editAppointmentParams.model.ts b/PAMapp/assets/ts/models/editAppointmentParams.model.ts
new file mode 100644
index 0000000..39d8078
--- /dev/null
+++ b/PAMapp/assets/ts/models/editAppointmentParams.model.ts
@@ -0,0 +1,12 @@
+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/assets/ts/models/fastQueryParams.model.ts b/PAMapp/assets/ts/models/fastQueryParams.model.ts
new file mode 100644
index 0000000..c24376d
--- /dev/null
+++ b/PAMapp/assets/ts/models/fastQueryParams.model.ts
@@ -0,0 +1,7 @@
+
+export interface FastQueryParams {
+  gender: string;
+  communicationStyles: string[];
+  avgScore: number;
+  status: string;
+}
diff --git a/PAMapp/assets/ts/models/loginRequest.model.ts b/PAMapp/assets/ts/models/loginRequest.model.ts
new file mode 100644
index 0000000..99c2559
--- /dev/null
+++ b/PAMapp/assets/ts/models/loginRequest.model.ts
@@ -0,0 +1,7 @@
+
+export interface LoginRequest {
+  /** "SMS"=�����"EMAIL"=email */
+  loginType: string;
+  /** �loginType憛俟MS��府甈葆�����MAIL��葆��隞嗡縑蝞� */
+  account: string;
+}
diff --git a/PAMapp/assets/ts/models/loginSuccessToken.model.ts b/PAMapp/assets/ts/models/loginSuccessToken.model.ts
new file mode 100644
index 0000000..98dfcd0
--- /dev/null
+++ b/PAMapp/assets/ts/models/loginSuccessToken.model.ts
@@ -0,0 +1,4 @@
+
+export interface LoginSuccessToken {
+  id_token: string;
+}
diff --git a/PAMapp/assets/ts/models/loginVerify.model.ts b/PAMapp/assets/ts/models/loginVerify.model.ts
new file mode 100644
index 0000000..15ed5a6
--- /dev/null
+++ b/PAMapp/assets/ts/models/loginVerify.model.ts
@@ -0,0 +1,9 @@
+
+export interface LoginVerify {
+  /** �撣嗅����mail */
+  account: string;
+  /** �otp��pi���ndex key */
+  indexKey: string;
+  /** �����縑蝞望�����Ⅳ */
+  otpCode: string;
+}
diff --git a/PAMapp/assets/ts/models/otpInfo.model.ts b/PAMapp/assets/ts/models/otpInfo.model.ts
new file mode 100644
index 0000000..657e006
--- /dev/null
+++ b/PAMapp/assets/ts/models/otpInfo.model.ts
@@ -0,0 +1,9 @@
+
+export interface OtpInfo {
+  /** ��撣嗅otp隤��� */
+  indexKey: string;
+  /** Otp�������� */
+  success: boolean;
+  failCode: string;
+  failReason: string;
+}
diff --git a/PAMapp/assets/ts/models/registerInfo.ts b/PAMapp/assets/ts/models/registerInfo.ts
new file mode 100644
index 0000000..e752493
--- /dev/null
+++ b/PAMapp/assets/ts/models/registerInfo.ts
@@ -0,0 +1,10 @@
+
+export interface RegisterInfo {
+  phone?: string;
+  email?: string;
+  indexKey: string;
+  otpCode: string;
+  name: string;
+  /** "SMS"嚗tp������"EMAIL":Otp�email */
+  contactType: string;
+}
diff --git a/PAMapp/assets/ts/models/strictQueryParams.ts b/PAMapp/assets/ts/models/strictQueryParams.ts
new file mode 100644
index 0000000..ba69baf
--- /dev/null
+++ b/PAMapp/assets/ts/models/strictQueryParams.ts
@@ -0,0 +1,12 @@
+
+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/assets/ts/services/pamService.service.ts b/PAMapp/assets/ts/services/pamService.service.ts
new file mode 100644
index 0000000..b9fb62f
--- /dev/null
+++ b/PAMapp/assets/ts/services/pamService.service.ts
@@ -0,0 +1,132 @@
+import { AxiosResponse } from 'axios';
+import { http } from "./httpClient";
+import { editAppointmentParams } from '../models/editAppointmentParams.model';
+import { AppointmentDetail } from '../models/AppointmentDetail';
+import { ConsultantLoginInfo } from '../models/ConsultantLoginInfo';
+import { UserSetting } from '../models/account.model';
+import { FastQueryParams } from '../models/quickFilter.model';
+import { LoginRequest } from "../models/loginRequest.model";
+import { OtpInfo } from "../models/otpInfo.model";
+import { Consultant } from '../models/consultant.model';
+import { RegisterInfo } from '../models/registerInfo';
+import { LoginVerify } from '../models/loginVerify.model';
+import { StrictQueryParams } from '../models/strictQueryParams';
+import { AppointmentParams } from '../models/appointmentParams';
+import { UserReviewsConsultantsParams } from '../models/UserReviewsConsultantsParams';
+import { LoginSuccessToken } from '../models/loginSuccessToken.model';
+import { AgentOfStrictQuery } from '../models/agentOfStrictQuery';
+import _ from "lodash";
+
+
+
+
+class PamService {
+  constructor() {}
+
+  /** 憿批恥��-��TP **/
+  sendOtp(loginInfo: LoginRequest):Promise<AxiosResponse<OtpInfo>> {
+    return http.post('/otp/sendOtp', loginInfo).then( res => res.data );
+  }
+
+  /** 憿批恥��-撽�TP **/
+  loginVerify(loginVerify: LoginVerify):Promise<AxiosResponse<any>>{
+    return http.post('/otp/verify', loginVerify);
+  }
+
+  /** 憿批恥閮餃�� **/
+  register(registerInfo: RegisterInfo):Promise<AxiosResponse<any>>{
+    return http.post('/otp/register', registerInfo);
+  }
+
+  /** ��靽憿批�� **/
+  recommend():Promise<AxiosResponse<Consultant[]>>{
+    return http.get('/consultant/recommend');
+  }
+
+  /** 敹恍�祟� **/
+  fastQuery(data: FastQueryParams):Promise<AxiosResponse<Consultant[]>>{
+    return http.post('/consultant/fastQuery', data)
+  }
+
+  /** ������ **/
+  strictQuery(data:StrictQueryParams):Promise<AxiosResponse<AgentOfStrictQuery[]>>{
+    return http.post('/consultant/strictQuery', data)
+  }
+
+  /** ��憿批�� **/
+  addFavoriteConsultant(agentNoList: string[]):Promise<AxiosResponse<any>>{
+    return http.post('/consultant/favorite', {agentNoList})
+  }
+
+  /** ����岷��� **/
+  appointmentDemand(data: AppointmentParams):Promise<AxiosResponse<any>> {
+    return http.post('/appointment/customer/create', data)
+  }
+
+  /** 憿批�底蝝啗��� **/
+  getConsultantDetail(agentNo:string):Promise<AxiosResponse<any>>{
+    return http.get('/consultant/detail', {params:{agentNo:agentNo}})
+  }
+
+  /** 蝘駁憿批�� **/
+  deleteConsultant(agentId: string):Promise<AxiosResponse<any>>{
+    return http.delete('/consultant/favorite/'+agentId);
+  }
+
+  /** �����Ⅳ���� **/
+  getImgOfVerification():Promise<string>{
+    return http.get('/login/validate/get_img_code',{ responseType : 'arraybuffer' })
+      .then( response => {
+        const toBase64 = window.btoa(
+                          _.reduce( new Uint8Array(response.data),(data,byte) =>
+                            data + String.fromCharCode(byte),'')
+                        );
+        const imgSrc = `data:image/jpeg;base64,${toBase64}`;
+        return imgSrc;
+    });
+  }
+
+  /** 撽�Ⅳ-撽�� **/
+  getVerificationStatus(imgCode:string):Promise<AxiosResponse<boolean>>{
+    return http.get('/login/validate/verify_img_code/'+imgCode);
+  }
+
+  /** 憿批�� **/
+  logInToConsultant(consultantDto:ConsultantLoginInfo):Promise<AxiosResponse<LoginSuccessToken>>{
+    return http.post('/ehttp/authenticate',consultantDto);
+  }
+
+  /** �����蝝啁� **/
+  getAppointmentDetail(apointmentId: number):Promise<AxiosResponse<AppointmentDetail>> {
+    return http.get('/appointment/getDetail/'+apointmentId)
+  }
+
+  /** ���蝙��董����� **/
+  getUserAccountSetting():Promise<AxiosResponse<UserSetting>>{
+    return http.get<UserSetting>('/customer/info');
+  }
+
+  /** ��雿輻�董����� **/
+  updateAccountSetting(params: any):Promise<AxiosResponse<any>> {
+    return http.put('/customer/info', params);
+  }
+
+  //摰X�脰�遛��漲閰��
+  userReviewsConsultants(data: UserReviewsConsultantsParams):Promise<AxiosResponse<any>> {
+    return http.post('/satisfaction/create', data);
+  }
+
+  // ������
+  cancelAppointment(appointment: number):Promise<AxiosResponse<any>>{
+    return http.delete('/appointment/'+appointment);
+  }
+
+  // 蝺刻摩����
+  editAppointment(editAppointmentParams:editAppointmentParams):Promise<AxiosResponse<any>>{
+    return http.put('/appointment', editAppointmentParams);
+  }
+}
+
+export default new PamService();
+
+

--
Gitblit v1.8.0