|
|
@ -1,11 +1,18 @@ |
|
|
|
import axios from "axios"; |
|
|
|
import exp from "constants"; |
|
|
|
|
|
|
|
// 视频点播、云台各种控制、录像回放和下载,主要就是这些接口,后面缺的再加就行
|
|
|
|
// Ip : 113.200.190.167
|
|
|
|
// username : liusuo
|
|
|
|
// passwd : MapMap123
|
|
|
|
|
|
|
|
const apiUrl = { |
|
|
|
YuShiApiUrl: 'http://113.200.190.167:8088/VIID', |
|
|
|
YuShiVmUrl: 'http://113.200.190.167:7010/VIID', |
|
|
|
} |
|
|
|
export const vmIp = "113.200.190.167" |
|
|
|
export const username = "liusuo"; |
|
|
|
export const passwd = "MapMap123"; |
|
|
|
|
|
|
|
const service = axios.create({ |
|
|
|
baseURL: '/', // api base_url
|
|
|
|
timeout: 9000, // 请求超时时间
|
|
|
@ -26,7 +33,7 @@ service.interceptors.request.use( |
|
|
|
request.params = {} |
|
|
|
} |
|
|
|
// 带上 token
|
|
|
|
let viidToken = GetViidToken(); |
|
|
|
let viidToken = Base.GetViidToken(); |
|
|
|
if (!!viidToken) { |
|
|
|
request.headers!.Authorization = viidToken; |
|
|
|
} |
|
|
@ -50,61 +57,75 @@ service.interceptors.response.use( |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
const apiUrl = { |
|
|
|
YuShiApiUrl: 'http://113.200.190.167:8088/VIID', |
|
|
|
YuShiVmUrl: 'http://113.200.190.167:7010/VIID', |
|
|
|
} |
|
|
|
export const vmIp="113.200.190.167" |
|
|
|
export const username = "liusuo"; |
|
|
|
export const passwd = "MapMap123"; |
|
|
|
|
|
|
|
enum ApiName { |
|
|
|
Login = '/login', |
|
|
|
KeepAlive = '/token/alive/keep', |
|
|
|
Logout = '/logout', |
|
|
|
LoginV2 = '/login/v2', |
|
|
|
KeepAliveV2 = '/hadesadapter/user/keepalive', |
|
|
|
Query = '/query', |
|
|
|
QueryOrg = '/org/query/list', |
|
|
|
PtzCtrl = '/ptz/ctrl' |
|
|
|
} |
|
|
|
|
|
|
|
const baseUrl = apiUrl.YuShiApiUrl; |
|
|
|
const vmUrl = apiUrl.YuShiVmUrl; |
|
|
|
|
|
|
|
let viidToken = '', vmToken = ''; |
|
|
|
|
|
|
|
export const GetViidToken = () => { |
|
|
|
return viidToken; |
|
|
|
enum BaseApiName { |
|
|
|
Login = '/login', // 登录接口
|
|
|
|
KeepAlive = '/token/alive/keep', // 登录保活
|
|
|
|
Logout = '/logout', // 退出接口
|
|
|
|
LoginV2 = '/login/v2', // 登录接口 v2
|
|
|
|
KeepAliveV2 = '/hadesadapter/user/keepalive', // 登录保活 V2
|
|
|
|
} |
|
|
|
|
|
|
|
export const SetViidToken = (token: string) => { |
|
|
|
viidToken = token; |
|
|
|
enum CommonApiName { |
|
|
|
Query = '/query', // 查询组织下资源列表
|
|
|
|
} |
|
|
|
|
|
|
|
export const GetVmToken = () => { |
|
|
|
return vmToken; |
|
|
|
enum OrgApiName { |
|
|
|
QueryList = '/org/query/list', // 查询组织下子组织列表
|
|
|
|
} |
|
|
|
|
|
|
|
export const SetVmToken = (token: string) => { |
|
|
|
vmToken = token; |
|
|
|
enum PtzApiName { |
|
|
|
Ctrl = '/ptz/ctrl', // 发送云台控制指令
|
|
|
|
} |
|
|
|
|
|
|
|
export const Login = (params?: any) => service.post(baseUrl + ApiName.Login, params) |
|
|
|
|
|
|
|
export const KeepAlive = (params?: any) => service.post(baseUrl + ApiName.KeepAlive, params) |
|
|
|
|
|
|
|
export const Logout = (params?: any) => service.post(baseUrl + ApiName.Logout, params) |
|
|
|
enum A8ApiName { |
|
|
|
QueryTvList = '/A8/tvlist', // 查询电视墙列表
|
|
|
|
QueryTvWall = '/A8/tvwall', // 查询电视墙信息
|
|
|
|
OpenWindow = '/window/open', // 开启窗口
|
|
|
|
CloseWindow = '/window/close', // 关闭窗口
|
|
|
|
StartMonitor = '/A8/monitor/start', // 开始实时监控
|
|
|
|
StopMonitor = '/A8/monitor/stop', // 停止实时监控
|
|
|
|
} |
|
|
|
|
|
|
|
export const LoginV2 = (params?: any) => service.post(baseUrl + ApiName.LoginV2, params) |
|
|
|
let viidToken = '', vmToken = ''; |
|
|
|
|
|
|
|
export const KeepAliveV2 = (params?: any) => service.post(baseUrl + ApiName.KeepAliveV2, params) |
|
|
|
// Base
|
|
|
|
export const Base = { |
|
|
|
GetViidToken: () => { |
|
|
|
return viidToken; |
|
|
|
}, |
|
|
|
SetViidToken: (token: string) => { |
|
|
|
viidToken = token; |
|
|
|
}, |
|
|
|
GetVmToken: () => { |
|
|
|
return vmToken; |
|
|
|
}, |
|
|
|
SetVmToken: (token: string) => { |
|
|
|
vmToken = token; |
|
|
|
}, |
|
|
|
Login: (params?: any) => service.post(baseUrl + BaseApiName.Login, params), |
|
|
|
KeepAlive: (params?: any) => service.post(baseUrl + BaseApiName.KeepAlive, params), |
|
|
|
Logout: (params?: any) => service.post(baseUrl + BaseApiName.Logout, params), |
|
|
|
LoginV2: (params?: any) => service.post(baseUrl + BaseApiName.LoginV2, params), |
|
|
|
KeepAliveV2: (params?: any) => service.post(baseUrl + BaseApiName.KeepAliveV2, params) |
|
|
|
} |
|
|
|
|
|
|
|
export const Query = (params: any) => service.get(baseUrl + ApiName.Query, {params: params}) |
|
|
|
// Common
|
|
|
|
export const Common = { |
|
|
|
Query: (params: any) => service.get(baseUrl + CommonApiName.Query, {params: params}), |
|
|
|
} |
|
|
|
|
|
|
|
export const QueryOrg = (params: any) => service.get(baseUrl + ApiName.QueryOrg + `/${params.id}`, params.condition) |
|
|
|
// Org
|
|
|
|
export const Org = { |
|
|
|
QueryList: (params: any) => service.get(baseUrl + OrgApiName.QueryList + `/${params.id}`, {params: params.condition}) |
|
|
|
} |
|
|
|
|
|
|
|
export const PtzCtrl = (params: any) => service.post(baseUrl + ApiName.PtzCtrl+ `/${params.code}`, params) |
|
|
|
// Ptz
|
|
|
|
export const Ptz = { |
|
|
|
Ctrl: (params: any) => service.post(baseUrl + PtzApiName.Ctrl + `/${params.code}`, params) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 发送云台控制指令 |
|
|
@ -151,4 +172,13 @@ export enum PtzCmdId { |
|
|
|
AllStop = 0x0901 |
|
|
|
} |
|
|
|
|
|
|
|
// export const Get = (params?: any) => axios.get(baseUrl + Api.Get, {params: params})
|
|
|
|
// A8
|
|
|
|
export const A8 = { |
|
|
|
QueryTvList: () => service.get(baseUrl + A8ApiName.QueryTvList), |
|
|
|
QueryTvWall: (params?: any) => service.get(baseUrl + A8ApiName.QueryTvWall + `/${params.code}`), |
|
|
|
OpenWindow: (params?: any) => service.post(baseUrl + A8ApiName.OpenWindow, params), |
|
|
|
CloseWindow: (params?: any) => service.get(baseUrl + A8ApiName.CloseWindow, {params: params}), |
|
|
|
StartMonitor: (params?: any) => service.get(baseUrl + A8ApiName.StartMonitor, params), |
|
|
|
StopMonitor: (params?: any) => service.get(baseUrl + A8ApiName.StopMonitor, params), |
|
|
|
} |
|
|
|
|
|
|
|