2024-07-22 16:07:41 +08:00
|
|
|
import requireAPI from "@/utils/requireAPI";
|
2024-09-09 15:34:31 +08:00
|
|
|
import { Toast } from "antd-mobile";
|
2024-07-06 11:05:19 +08:00
|
|
|
export const getStreamerInfo = async (mid) => {
|
|
|
|
try {
|
2024-07-22 16:07:41 +08:00
|
|
|
const data = await requireAPI("POST", "/api/zone/list_by_mid", {
|
2024-07-06 11:05:19 +08:00
|
|
|
body: {
|
|
|
|
mid,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
if (data.ret === -1) {
|
|
|
|
Toast.show({
|
|
|
|
icon: "fail",
|
|
|
|
content: data.msg,
|
|
|
|
position: "top",
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...data.data.list[0],
|
|
|
|
refund_enable: data.data.refund_enable,
|
|
|
|
refund_status: data.data.refund_status,
|
|
|
|
};
|
|
|
|
} catch (error) {
|
2024-09-09 15:34:31 +08:00
|
|
|
// console.error(error);
|
2024-07-06 11:05:19 +08:00
|
|
|
}
|
|
|
|
};
|
2024-07-08 20:07:36 +08:00
|
|
|
export const getStreamerDetailInfo = async (mid) => {
|
|
|
|
try {
|
2024-07-22 16:07:41 +08:00
|
|
|
const data = await requireAPI("POST", "/api/streamer/list_ext_by_mid", {
|
2024-07-08 20:07:36 +08:00
|
|
|
body: {
|
|
|
|
mid,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
if (data.ret === -1) {
|
|
|
|
Toast.show({
|
|
|
|
icon: "fail",
|
|
|
|
content: data.msg,
|
|
|
|
position: "top",
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
...data.data,
|
|
|
|
};
|
|
|
|
} catch (error) {
|
2024-09-09 15:34:31 +08:00
|
|
|
// console.error(error);
|
2024-07-08 20:07:36 +08:00
|
|
|
}
|
|
|
|
};
|
2024-07-06 11:05:19 +08:00
|
|
|
//获取空间数据并将该空间标为已读
|
|
|
|
export const getSpaceData = async (mid) => {
|
|
|
|
try {
|
2024-07-22 16:07:41 +08:00
|
|
|
const data = await requireAPI("POST", `/api/zone/list_by_mid`, {
|
2024-07-06 11:05:19 +08:00
|
|
|
body: {
|
|
|
|
mid,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
if (data.ret === -1) {
|
|
|
|
Toast.show({
|
2024-07-08 20:07:36 +08:00
|
|
|
icon: "fail",
|
|
|
|
content: data.msg,
|
|
|
|
position: "top",
|
2024-07-06 11:05:19 +08:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//将空间标为已读
|
2024-07-22 16:07:41 +08:00
|
|
|
const data2 = await requireAPI("POST", `/api/zone_session/upsert`, {
|
2024-07-06 11:05:19 +08:00
|
|
|
body: {
|
2024-07-06 16:03:15 +08:00
|
|
|
zid: data.data.list[0]?.id,
|
2024-07-06 11:05:19 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
if (data2.ret === -1) {
|
|
|
|
Toast.show({
|
2024-07-08 20:07:36 +08:00
|
|
|
icon: "fail",
|
|
|
|
content: data.msg,
|
|
|
|
position: "top",
|
2024-07-06 11:05:19 +08:00
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
isRefunding: data.data.refund_status === 1,
|
2024-07-31 20:05:17 +08:00
|
|
|
refund_enable: data.data.refund_enable,
|
2024-07-06 11:05:19 +08:00
|
|
|
noRole: data.data.list[0].visitor_role === 4,
|
|
|
|
};
|
|
|
|
} catch (error) {
|
2024-09-09 15:34:31 +08:00
|
|
|
// console.error(error);
|
2024-07-06 11:05:19 +08:00
|
|
|
}
|
|
|
|
};
|