feat:移植工程
This commit is contained in:
82
src/apis/travel.ts
Normal file
82
src/apis/travel.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { cloudService } from './index'
|
||||
import { ITravelQuery, ITravelRecord, ITravelSpot, ITravelStats } from '@/types/travel'
|
||||
|
||||
export const addTravelSpotApi = (travelSpot: ITravelSpot): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/spot',
|
||||
method: 'post',
|
||||
data: travelSpot
|
||||
})
|
||||
|
||||
export const updateTravelSpotApi = (id: number, travelSpot: ITravelSpot): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/travel/spot/${id}`,
|
||||
method: 'put',
|
||||
data: travelSpot
|
||||
})
|
||||
|
||||
export const deleteTravelSpotApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/travel/spot/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryTravelSpotApi = (id: number): Promise<ITravelSpot> =>
|
||||
cloudService({
|
||||
url: `/home-service/travel/spot/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryTravelSpotListApi = (currentPage: number, pageSize: number,
|
||||
query: ITravelQuery): Promise<any> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/spot/page',
|
||||
method: 'get',
|
||||
params: { currentPage, pageSize, ...query }
|
||||
})
|
||||
|
||||
export const queryTravelSpotNameListApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/spot/name',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const addTravelRecordApi = (travelRecord: ITravelRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/record',
|
||||
method: 'post',
|
||||
data: travelRecord
|
||||
})
|
||||
|
||||
export const updateTravelRecordApi = (id: number, travelRecord: ITravelRecord): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/travel/record/${id}`,
|
||||
method: 'put',
|
||||
data: travelRecord
|
||||
})
|
||||
|
||||
export const deleteTravelRecordApi = (id: number): Promise<boolean> =>
|
||||
cloudService({
|
||||
url: `/home-service/travel/record/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
export const queryTravelRecordApi = (startDate: string, endDate: string):
|
||||
Promise<ITravelRecord[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/record',
|
||||
method: 'get',
|
||||
params: { startDate, endDate }
|
||||
})
|
||||
|
||||
export const queryTravelCategoryApi = (): Promise<string[]> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/category',
|
||||
method: 'get'
|
||||
})
|
||||
|
||||
export const queryTravelStatsApi = (): Promise<ITravelStats> =>
|
||||
cloudService({
|
||||
url: '/home-service/travel/stats',
|
||||
method: 'get'
|
||||
})
|
||||
Reference in New Issue
Block a user