import requireAPI from "@/utils/requireAPI"; import {Toast} from "antd-mobile" export const getStreamerInfo = async (mid) => { try { const data = await requireAPI("POST", "/api/zone/list_by_mid", { 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) { console.error(error); } }; export const getStreamerDetailInfo = async (mid) => { try { const data = await requireAPI("POST", "/api/streamer/list_ext_by_mid", { body: { mid, }, }); if (data.ret === -1) { Toast.show({ icon: "fail", content: data.msg, position: "top", }); return; } return { ...data.data, }; } catch (error) { console.error(error); } }; //获取空间数据并将该空间标为已读 export const getSpaceData = async (mid) => { try { const data = await requireAPI("POST", `/api/zone/list_by_mid`, { body: { mid, }, }); if (data.ret === -1) { Toast.show({ icon: "fail", content: data.msg, position: "top", }); return; } //将空间标为已读 const data2 = await requireAPI("POST", `/api/zone_session/upsert`, { body: { zid: data.data.list[0]?.id, }, }); if (data2.ret === -1) { Toast.show({ icon: "fail", content: data.msg, position: "top", }); return; } return { isRefunding: data.data.refund_status === 1, noRole: data.data.list[0].visitor_role === 4, }; } catch (error) { console.error(error); } };