添加收藏茶室接口和完善茶室详情

This commit is contained in:
wangxiaowei
2025-11-12 17:40:35 +08:00
parent 29bf4dae74
commit 0cad65c295
32 changed files with 1522 additions and 505 deletions

91
src/api/tea-room.ts Normal file
View File

@ -0,0 +1,91 @@
import { http } from '@/http/alova'
import type { IHomeTeaRoomListResult, IOpenCityListResult, ITeaRoomDetailResult } from '@/api/types/tea-room'
/**
* 获取茶室列表
*/
export interface IHomeTeaRoomListParams {
page: number
size: number
search: string
latitude: number
longitude: number
}
export function getHomeTeaRoomList(data: any) {
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreLists',
data,
{
meta: { ignoreAuth: true }
}
)
}
/**
* 获取茶室开通城市列表
*/
export function getOpenCityList() {
return http.Post<IOpenCityListResult>('/api/teaStore/teaStoreCity',
{
meta: { ignoreAuth: true }
}
)
}
/**
* 茶室搜索历史
*/
export function getTeaRoomSearchHistory() {
return http.Post<{ list: Array<string> }>('/api/teaStore/teaStoreSearchHistory')
}
/**
* 清除茶室搜索历史
*/
export function clearTeaRoomSearchHistory() {
return http.Post('/api/teaStore/delTeaStoreSearchHistory', null)
}
/**
* 茶室详情
*/
export interface IRoomDetailParams {
id: number
latitude: number
longitude: number
user_id: number
}
export function getTeaRoomDetail(data: IRoomDetailParams) {
return http.Post<ITeaRoomDetailResult>('/api/teaStore/teaStoreDetails',
data
)
}
/**
* 收藏茶室
*/
export interface ICollectTeaRoomParams {
id: number
status: number // 1收藏 0取消收藏
}
export function collectTeaRoom(data: ICollectTeaRoomParams) {
return http.Post('/api/teaStore/teaStoreCollect',
data
)
}
/**
* 收藏的茶室列表
*/
export interface ICollectTeaRoomListParams {
page: number
size: number
}
export function getCollectTeaRoomList(data: ICollectTeaRoomListParams) {
return http.Post<IHomeTeaRoomListResult>('/api/teaStore/teaStoreCollectList',
data
)
}