Files
urbanLifeline/urbanLifelineWeb/packages/shared/src/api/sys/guest.ts

73 lines
2.3 KiB
TypeScript
Raw Normal View History

2025-12-22 19:16:53 +08:00
import { api } from '@/api/index'
import type { TbGuestDTO } from '@/types/sys/guest'
import type { LoginParam, LoginDomain } from '@/types/auth/auth'
import type { ResultDomain, PageRequest } from '@/types'
/**
* API
* Gateway (8180) 访 System Service
* /urban-lifeline/system/** system-service
*/
export const guestAPI = {
baseUrl: '/urban-lifeline/system/guest',
/**
*
*/
async createGuest(guest: TbGuestDTO): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.post<TbGuestDTO>(`${this.baseUrl}`, guest)
return response.data
},
/**
*
*/
async updateGuest(guest: TbGuestDTO): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.put<TbGuestDTO>(`${this.baseUrl}`, guest)
return response.data
},
/**
*
*/
async deleteGuest(userId: string): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.delete<TbGuestDTO>(`${this.baseUrl}`, { params: { userId } })
return response.data
},
/**
* ID查询来客
*/
async selectGuestByWechat(wechatId: string): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.get<TbGuestDTO>(`${this.baseUrl}/wechat/${wechatId}`)
return response.data
},
/**
*
*/
async listGuest(filter?: TbGuestDTO): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.get<TbGuestDTO>(`${this.baseUrl}/list`, { params: filter })
return response.data
},
/**
*
*/
async pageGuest(pageRequest: PageRequest<TbGuestDTO>): Promise<ResultDomain<TbGuestDTO>> {
const response = await api.post<TbGuestDTO>(`${this.baseUrl}/page`, pageRequest)
return response.data
},
/**
*
* /
* @param loginParam wechatId或phone必填
* @returns LoginDomain token
*/
async identify(loginParam: LoginParam): Promise<ResultDomain<LoginDomain>> {
const response = await api.post<LoginDomain>(`${this.baseUrl}/identify`, loginParam)
return response.data
}
}