UNPKG

@shencom/api

Version:
42 lines (34 loc) 1.3 kB
import type { Unfurl } from '@shencom/typing'; import { getInitializedApiConfig } from '../config'; type Ids = string | string[]; /** gis详情 */ export const ApiGisShow = (body: { ids: Ids }, headers?: Record<string, any>) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/gispoi/show`; return http.post<SC.Gis.Point[]>(api, body, { headers: { Authorization: null, ...headers } }); }; type ReqGisCreate = Unfurl<{ lat?: number | string; lng?: number | string; addr?: string; mapType?: 'gaode' | 'baidu' | 'tencent'; }>; /** 创建gis */ export const ApiGisCreate = (body: ReqGisCreate, headers?: Record<string, any>) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/gispoi/create`; return http.post<SC.Gis.Point>(api, body, { headers: { Authorization: null, ...headers } }); }; type FindRegionByLnglatRes = Unfurl<{ regionId: string; name: string; }>; /** 根据经纬度获取区域 */ export const ApiFindRegionByLngLat = ( body: { lng: number; lat: number }, headers?: Record<string, any>, ) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/geo/find/region/by/lnglat`; return http.post<FindRegionByLnglatRes[]>(api, body, { headers }); };