20 lines
545 B
JavaScript
20 lines
545 B
JavaScript
const getCookie = require("../../auth/3xuiLogin");
|
|
const instance = require("../../utils/http");
|
|
|
|
module.exports = async (ctx) => {
|
|
let { id } = ctx.request.query;
|
|
if (!ctx.state.cookie) {
|
|
ctx.state.cookie = await getCookie();
|
|
instance.interceptors.request.use((config) => {
|
|
config.headers.Cookie = ctx.state.cookie;
|
|
return config;
|
|
});
|
|
}
|
|
const status = await instance.get(`/panel/api/inbounds/getClientTrafficsById/${id}`);
|
|
ctx.body = {
|
|
code: 0,
|
|
data: status.obj?.[0] || {},
|
|
msg: "success",
|
|
};
|
|
};
|