"use strict";const e=require("../common/vendor.js"),d=require("./url.js");exports.request=a=>new Promise(((t,o)=>{a.hideLoading||e.index.showLoading({title:a.loadingText||"加载中...",mask:!0}),e.index.request({url:d.URL+a.url,method:a.method,data:a.data,header:{"Content-Type":"application/x-www-form-urlencoded",...a.headers,appid:d.appid,Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")},success:e=>200!==e.statusCode?(console.error(`HTTP状态码错误: ${e.statusCode}`,e.data),e.data?void t(e.data):void o({msg:`请求失败，状态码：${e.statusCode}`})):e.data&&200!==e.data.code?(console.warn(`业务状态码错误: ${e.data.code}`,e.data),a.ignoreEmptyError&&500===e.data.code&&e.data.msg&&(e.data.msg.includes("未找到")||e.data.msg.includes("不存在"))?void t({code:200,msg:"操作成功",data:[]}):void t(e.data)):void t(e.data),fail(e){console.error(`请求失败: ${a.url}`,e),o(e)},complete(){a.hideLoading||e.index.hideLoading()}})}));
