UNPKG

@shencom/api

Version:
903 lines (886 loc) 34.5 kB
import JSEncrypt from 'jsencrypt'; const globalApiConfig = { initialized: false }; function init(http, url) { globalApiConfig.http = http; globalApiConfig.url = url; globalApiConfig.initialized = true; } function getInitializedApiConfig() { if (!globalApiConfig.initialized || !globalApiConfig.http) { throw new Error("API not initialized. Call init(http, url) before using any API functions."); } return { http: globalApiConfig.http, url: globalApiConfig.url || "" }; } var __defProp$7 = Object.defineProperty; var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols; var __hasOwnProp$7 = Object.prototype.hasOwnProperty; var __propIsEnum$7 = Object.prototype.propertyIsEnumerable; var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$7 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$7.call(b, prop)) __defNormalProp$7(a, prop, b[prop]); if (__getOwnPropSymbols$7) for (var prop of __getOwnPropSymbols$7(b)) { if (__propIsEnum$7.call(b, prop)) __defNormalProp$7(a, prop, b[prop]); } return a; }; const pubkey = `-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArromvW2N/rg0ADw9zpTL cGdO0wNazPcp+SepPrv1dicCamEVPfvPKlWMuYszt/tE6lNjMT8pphmatPvgjAFy KfE1fEpcvHqRSZTUtlo/fGJzh2nss6mxyDXlqi+sGitjwaGj6/MXO6zLQcMQmZ/U vliOhECvuLBsAqqLY8ik63Ah7ylWAap3jDD0OvgSy+glqebwfacy9WPYOy4K75n/ DQRw9FJBYFg1BtfbVn55Oji3AZ0E3lY96b0JhJGtFM6vjF0bhVDkmP/XZINPcVZy xydRFvxjgA6we/KmxXDD/JdZmvGmrZ2XCAhGS3vuk3XJnkMquGYO4GAI13JIs8Z1 rwIDAQAB -----END PUBLIC KEY----- `; const Jsencrypt = (pwd) => { const crypt = new JSEncrypt(); crypt.setKey(pubkey); const crypted = crypt.encrypt(pwd); if (!crypted) { return ""; } return crypted; }; const unToken = (headers) => ({ headers: __spreadValues$7({ Authorization: null }, headers) }); var __defProp$6 = Object.defineProperty; var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols; var __hasOwnProp$6 = Object.prototype.hasOwnProperty; var __propIsEnum$6 = Object.prototype.propertyIsEnumerable; var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$6 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$6.call(b, prop)) __defNormalProp$6(a, prop, b[prop]); if (__getOwnPropSymbols$6) for (var prop of __getOwnPropSymbols$6(b)) { if (__propIsEnum$6.call(b, prop)) __defNormalProp$6(a, prop, b[prop]); } return a; }; const ApiGetScCode = () => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sc/auth/code`; return http.get(api); }; const ApiScCodeLogin = (code, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sc/auth/code/login`; return http.get(api, { code }, { headers: __spreadValues$6({ Authorization: null }, headers) }); }; const ApiPhoneAndPasswordLogin = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/auth/phone-password/login`; body.password = Jsencrypt(body.password); return http.post(api, body, { headers: __spreadValues$6({ Authorization: null }, headers) }); }; const ApiScOAuthSecuser = (params, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sc/auth/secuser`; return http.post(api, params, headers); }; const ApiScOAuthLogin = (params, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sc/auth/secuser/login`; return http.get(api, params, { headers: __spreadValues$6({ Authorization: null }, headers) }); }; const ApiRefreshToken = (refreshToken, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/auth/token-user/refresh`; return http.post( api, { refreshToken }, { headers: __spreadValues$6({ Authorization: null }, headers) } ); }; const ApiPhoneOrUsernameAndPasswordAndCodeLogin = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/login`; body.password = Jsencrypt(body.password); return http.post(api, body, unToken(headers)); }; const ApiPhoneOrUsernameAndPasswordAndCodeLoginPlatform = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/sys/user/login`; body.password = Jsencrypt(body.password); return http.post(api, body, unToken(headers)); }; const ApiPhoneOrUsernameAndPasswordLogin = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/user/login`; if (body.password) body.password = Jsencrypt(body.password); return http.post(api, body, unToken(headers)); }; const ApiSysUpdateInfo = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/update`; return http.post(api, body, { headers }); }; const ApiSysUpdateInfoPlatform = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/platform/sys/user/update`; return http.post(api, body, { headers }); }; const ApiPhoneAndCodeLoginOrRegister = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/auth/registry-login/phone`; return http.post(api, body, unToken(headers)); }; const ApiPhoneAndCodeLogin = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/mobile/user/login`; return http.post(api, body, unToken(headers)); }; const ApiGetPlaintextUserInfo = () => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/current`; return http.get(api); }; const ApiUserSysUpdate = (body, headers = {}) => { if (body.password) body.password = Jsencrypt(body.password); if (body.oldPassword) body.oldPassword = Jsencrypt(body.oldPassword); const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/self/update/pwd`; return http.post(api, body, headers); }; const ApiUserSysUpdatePlatform = (body, headers = {}) => { if (body.password) body.password = Jsencrypt(body.password); if (body.oldPassword) body.oldPassword = Jsencrypt(body.oldPassword); const { http, url } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/platform/sys/user/self/update/pwd`; return http.post(api, body, headers); }; const ApiResetPwd = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/update/pwd`; if (body.password) body.password = Jsencrypt(body.password); return http.post(api, body, unToken(headers)); }; const ApiResetPwdPlatform = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/platform/sys/user/update/pwd`; if (body.password) body.password = Jsencrypt(body.password); return http.post(api, body, unToken(headers)); }; const ApiNeedChangePwd = (headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/need-change-pwd`; return http.get(api, headers); }; const ApiNeedGraphic = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/need/graphic`; return http.post(api, body, unToken(headers)); }; const ApiValidateImage = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/validate/image`; return http.get(api, body, unToken(headers)); }; const ApiLogOut = (headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/user/logout`; return http.post(api, headers); }; const ApiIlhOauthLogin = (body, headers = {}) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/lh/one/level/login`; return http.get(api, body, unToken(headers)); }; var __defProp$5 = Object.defineProperty; var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols; var __hasOwnProp$5 = Object.prototype.hasOwnProperty; var __propIsEnum$5 = Object.prototype.propertyIsEnumerable; var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$5 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$5.call(b, prop)) __defNormalProp$5(a, prop, b[prop]); if (__getOwnPropSymbols$5) for (var prop of __getOwnPropSymbols$5(b)) { if (__propIsEnum$5.call(b, prop)) __defNormalProp$5(a, prop, b[prop]); } return a; }; const ApiWechatMiniBindPhone = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/auth/miniprogram/phone/login`; return http.post(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiWechatMiniLogin = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/auth/miniprogram/login`; return http.post(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiWechatCodeLogin = (code) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/scan/login`; return http.get(api, { code }); }; const ApiWechatUpdateInfo = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/wechat/wxuserinfo/openid/update`; return http.post(api, body, { headers }); }; const ApiWechatLogout = (headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/wx/userinfo/logout`; return http.post(api, {}, { headers }); }; const ApiWechatCodeBindPhone = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/wechat/fast/login`; const { wxToken, code, phone } = body; return http.post( api, { phone, code }, { headers: __spreadValues$5({ Authorization: wxToken }, headers) } ); }; const ApiWechatCodeAuth = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/csm/wechat/auth`; return http.get(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiWechatAuthUrl = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/sc/wechat/auth`; return http.get(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiWechatUserRecords = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/wx/user/phone/record/by-code`; return http.post(api, body, { headers }); }; const ApiWechatBindPhonePlatform = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/user/phone/update`; return http.post(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiWechatBindPhone = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/user/phone/update`; return http.post(api, body, { headers: __spreadValues$5({ Authorization: null }, headers) }); }; const ApiYzyGetAuthUrl = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/url`; return http.post(api, body, unToken(headers)); }; const ApiYzyCodeAuth = (code, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/gettoken`; return http.post(api, { code }, unToken(headers)); }; const ApiYzyAuthVerify = (accessToken, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/verify`; return http.post(api, { accessToken }, unToken(headers)); }; const ApiYzyRefreshToken = (refreshToken, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/exchange`; return http.post(api, { refreshToken }, unToken(headers)); }; const ApiYzyLogin = (accessToken, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/login`; return http.post(api, { accessToken }, unToken(headers)); }; const ApiYzyLogout = (accessToken, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/yzy/auth/logout`; return http.post(api, { accessToken }, { headers }); }; var __defProp$4 = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols; var __hasOwnProp$4 = Object.prototype.hasOwnProperty; var __propIsEnum$4 = Object.prototype.propertyIsEnumerable; var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$4 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); if (__getOwnPropSymbols$4) for (var prop of __getOwnPropSymbols$4(b)) { if (__propIsEnum$4.call(b, prop)) __defNormalProp$4(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); function isFormData(val) { return Object.prototype.toString.call(val) === "[object FormData]"; } const ApiFileShow = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-file/file/show`; return http.post(api, body, { headers }); }; const ApiFileOssSign = (body = {}, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/sign`; return http.get(api, __spreadValues$4({ target: 0, open: 1 }, body), { headers }); }; const ApiFileOssSignV2 = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/signV2`; return http.post(api, __spreadValues$4({ target: 0, open: 1 }, body), { headers }); }; const ApiFileOssBatchSignV2 = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/batchSignV2`; return http.post(api, __spreadValues$4({ target: 0, open: 1 }, body), { headers }); }; function HandleFileETag(headers = {}) { let etag = headers.etag || headers.ETag || headers.Etag; if (!etag) return; if (Array.isArray(etag)) etag = etag[0]; try { etag = JSON.parse(etag); } catch (error) { } return etag; } const ApiFileOssUpload = async (body, custom) => { const { http } = getInitializedApiConfig(); const { file, fileName, accessid, host, signature, policy, dir } = body; const key = `${dir}${fileName}`; let name; if ("name" in file) name = file.name; const param = { key, file, policy, signature, OSSAccessKeyId: accessid, success_action_status: "200", // 下载时的文件名 "Content-Disposition": name ? `attachment;filename="${encodeURIComponent(name)}"` : void 0 }; let formData; if (typeof FormData === "undefined") { formData = param; } else { formData = new FormData(); const formDataKey = Object.keys(param); formDataKey.forEach((key2) => { if (key2 === "file") return; if (param[key2] === void 0 || param[key2] === null) return; formData.append(key2, `${param[key2]}`); }); formData.append("file", param.file); } const res = await http.upload(host, formData, custom); const etag = HandleFileETag(res.headers); const data = { sign: 1, etag, fileName, signature, fileSize: file.size, name: name || fileName, remoteUrl: `${host.replace(/(?=\/)\/$/, "")}/${key}` // 处理 host 可能后面添加 / 的情况 }; return data; }; const ApiFileOssUploadV2 = async (body, custom) => { const { http } = getInitializedApiConfig(); const { file, fileName, accessid, host, signature, policy, objectName } = body; let name; if ("name" in file) name = file.name; const param = { key: objectName, file, policy, signature, OSSAccessKeyId: accessid, success_action_status: "200", // 下载时的文件名 "Content-Disposition": name ? `attachment;filename="${encodeURIComponent(name)}"` : void 0 }; let formData; if (typeof FormData === "undefined") { formData = param; } else { formData = new FormData(); const formDataKey = Object.keys(param); formDataKey.forEach((key) => { if (key === "file") return; if (param[key] === void 0 || param[key] === null) return; formData.append(key, `${param[key]}`); }); formData.append("file", param.file); } const res = await http.upload(host, formData, custom); const etag = HandleFileETag(res.headers); const data = { sign: 1, etag, fileName, signature, fileSize: file.size, name: name || fileName, remoteUrl: `${host.replace(/(?=\/)\/$/, "")}/${objectName}` // 处理 host 可能后面添加 / 的情况 }; return data; }; const ApiFileUpdate = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/update`; return http.post(api, body, { headers }); }; function HandleFileUploadBody(defaultBody, body) { const param = body; if (typeof FormData === "undefined" && !isFormData(param)) { if (param.isDownload === true) { param.disposition = `attachment;filename=`; } const data = __spreadValues$4(__spreadValues$4({}, defaultBody), param); delete data.isDownload; return data; } if (!isFormData(param)) { const formData = new FormData(); const data = __spreadValues$4(__spreadValues$4({}, defaultBody), param); const formDataKey = Object.keys(data); formDataKey.forEach((key) => { if (key === "file") return; if (data[key] === void 0 || data[key] === null) return; if (key === "isDownload" && data[key]) { formData.append("disposition", `attachment;filename=`); return; } formData.append(key, `${data[key]}`); }); formData.append("file", data.file); return formData; } else { if (param.has("isDownload")) { param.delete("isDownload"); param.append("disposition", `attachment;filename=`); } Object.keys(defaultBody).forEach((key) => { const value = param.get(key); if (value === void 0) param.append(key, `${defaultBody[key]}`); }); } return param; } const ApiFileUpload = (body, custom) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/upload/single`; const formData = HandleFileUploadBody({ target: 0, open: 1, isDownload: true }, body); return http.upload(api, formData, custom); }; const ApiFileStsToken = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/tempCrudStsToken`; return http.post(api, __spreadValues$4({ target: 0, open: 1 }, body), { headers }); }; const ApiFilePresigned = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/presigned`; return http.post( api, __spreadProps(__spreadValues$4({ target: 0 }, body), { open: 0 }), { headers: __spreadValues$4({ Authorization: null }, headers) } ); }; const ApiFileExist = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/exist`; return http.get(`${api}/${body.etag}`, {}, { headers }); }; const ApiFileRepeat = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-file/file/management/repeatpic/check`; return http.post(api, body, { headers }); }; var __defProp$3 = Object.defineProperty; var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols; var __hasOwnProp$3 = Object.prototype.hasOwnProperty; var __propIsEnum$3 = Object.prototype.propertyIsEnumerable; var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$3 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); if (__getOwnPropSymbols$3) for (var prop of __getOwnPropSymbols$3(b)) { if (__propIsEnum$3.call(b, prop)) __defNormalProp$3(a, prop, b[prop]); } return a; }; const ApiGisShow = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/gispoi/show`; return http.post(api, body, { headers: __spreadValues$3({ Authorization: null }, headers) }); }; const ApiGisCreate = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/gispoi/create`; return http.post(api, body, { headers: __spreadValues$3({ Authorization: null }, headers) }); }; const ApiFindRegionByLngLat = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-gis/geo/find/region/by/lnglat`; return http.post(api, body, { headers }); }; var __defProp$2 = Object.defineProperty; var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols; var __hasOwnProp$2 = Object.prototype.hasOwnProperty; var __propIsEnum$2 = Object.prototype.propertyIsEnumerable; var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$2 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]); if (__getOwnPropSymbols$2) for (var prop of __getOwnPropSymbols$2(b)) { if (__propIsEnum$2.call(b, prop)) __defNormalProp$2(a, prop, b[prop]); } return a; }; const ApiCMSCategoryTree = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-cms/ncms/category/tree`; return http.post(api, body, { headers: __spreadValues$2({ Authorization: null }, headers) }); }; const ApiCMSCategoryIndex = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-cms/ncms/category/index`; return http.post(api, body, { headers: __spreadValues$2({ Authorization: null }, headers) }); }; const ApiCMSArticlesIndex = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-cms/ncms/articles/index`; return http.post(api, body, { headers: __spreadValues$2({ Authorization: null }, headers) }); }; const ApiCMSArticlesShow = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-cms/ncms/articles/show`; return http.post(api, body, { headers: __spreadValues$2({ Authorization: null }, headers) }); }; const ApiWechatGetConfig = (scid) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/wechat/jsconfig`; return http.get(api, { scid }); }; const ApiYyzGetSDKConfig = ({ url, token }, headers) => { const config = getInitializedApiConfig(); const api = `${config.url}/service-uaa/yzy/auth/jsticket`; return config.http.post(api, { url, token }, { headers }); }; const ApiWechatGetQrcode = (body) => { const { url, http } = getInitializedApiConfig(); const api = `${url}/service-uaa/sys/user/qr/code`; return http.get(api, { url: body.redirect }); }; var __defProp$1 = Object.defineProperty; var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); if (__getOwnPropSymbols$1) for (var prop of __getOwnPropSymbols$1(b)) { if (__propIsEnum$1.call(b, prop)) __defNormalProp$1(a, prop, b[prop]); } return a; }; const v3 = "/_AMapServiceWeb/v3"; const ApiAMapGeocodeGeo = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}${v3}/geocode/geo`; return http.get(api, body, { headers: __spreadValues$1({ Authorization: null }, headers) }); }; const ApiAMapGeocodeRegeo = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}${v3}/geocode/regeo`; return http.get(api, body, { headers: __spreadValues$1({ Authorization: null }, headers) }); }; const ApiAMapWeather = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}${v3}/weather/weatherInfo`; return http.get(api, body, { headers: __spreadValues$1({ Authorization: null }, headers) }); }; const ApiAMapIP = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}${v3}/ip`; return http.get(api, body, { headers: __spreadValues$1({ Authorization: null }, headers) }); }; const ApiAMapInputtips = (body, headers) => { const { url, http } = getInitializedApiConfig(); const api = `${url}${v3}/assistant/inputtips`; return http.get(api, body, { headers: __spreadValues$1({ Authorization: null }, headers) }); }; var __defProp = Object.defineProperty; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; const url = "https://apis.map.qq.com/ws"; const ApiQQMapGeocodeGeo = (body, headers) => { const { http } = getInitializedApiConfig(); const api = `${url}/geocoder/v1`; return http.get(api, body, { headers: __spreadValues({ Authorization: null }, headers) }); }; const ApiQQMapGeocodeRegeo = (body, headers) => { const api = `${url}/geocoder/v1`; const { http } = getInitializedApiConfig(); return http.get(api, body, { headers: __spreadValues({ Authorization: null }, headers) }); }; const ApiQQMapIP = (body, headers) => { const api = `${url}/location/v1/ip`; const { http } = getInitializedApiConfig(); return http.get(api, body, { headers: __spreadValues({ Authorization: null }, headers) }); }; const ApiSmsTenants = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/validate/msg`; return http.get(api, body, unToken(headers)); }; const ApiSmsPlatform = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-platform-uaa/validate/msg`; return http.get(api, body, unToken(headers)); }; const ApiSmsUnbound = (body, headers) => { const { http, url } = getInitializedApiConfig(); const api = `${url}/service-uaa/validate/unbound/msg`; return http.get(api, body, unToken(headers)); }; const sortType = ["ASC", "DESC"]; function ApiSortsConstruct(prop, type) { if (Array.isArray(prop)) { return prop.map((item) => ({ orderField: item[0], orderType: item[1] || "DESC" })); } return [{ orderField: prop, orderType: type || "DESC" }]; } const ApiSortsHandler = ApiSortsConstruct; function ApiSortsDestructure(param) { const result = {}; if (Array.isArray(param)) { param.forEach((item) => { if (item && item.orderField) { result[item.orderField] = item.orderType || "DESC"; } }); } else if (param && param.orderField) { result[param.orderField] = param.orderType || "DESC"; } return result; } function ApiSortsDelete(sorts, deleteProps) { if (!Array.isArray(sorts) || sorts.length === 0) return sorts; if (!deleteProps || deleteProps.length === 0) return sorts; const targetDeleteProps = Array.isArray(deleteProps) ? deleteProps : [deleteProps]; targetDeleteProps.forEach((prop) => { const index = sorts.findIndex((item) => item.orderField === prop); if (index > -1) { sorts.splice(index, 1); } }); return sorts.length === 0 ? null : sorts; } var OperateEnum = /* @__PURE__ */ ((OperateEnum2) => { OperateEnum2["EQ"] = "EQ"; OperateEnum2["LT"] = "LT"; OperateEnum2["GT"] = "GT"; OperateEnum2["LTE"] = "LTE"; OperateEnum2["GTE"] = "GTE"; OperateEnum2["NEQ"] = "NEQ"; OperateEnum2["IN"] = "IN"; OperateEnum2["NN"] = "NN"; OperateEnum2["NULL"] = "NULL"; OperateEnum2["BTW"] = "BTW"; OperateEnum2["LIKE"] = "LIKE"; OperateEnum2["LL"] = "LL"; OperateEnum2["RL"] = "RL"; return OperateEnum2; })(OperateEnum || {}); var LrEnum = /* @__PURE__ */ ((LrEnum2) => { LrEnum2["AND"] = "and"; LrEnum2["OR"] = "or"; return LrEnum2; })(LrEnum || {}); function ApiQueryItemConstruct(val, prop, operate, lr) { if (val === null || val === void 0 || val === "") { return null; } const _operate = operate || OperateEnum.LIKE; return { value: val, prop, operate: _operate, lr }; } const OperateTypeDefault = { number: OperateEnum.EQ, string: OperateEnum.LIKE, rangeDateTime: OperateEnum.BTW, select: OperateEnum.IN, date: OperateEnum.EQ }; function ApiQueryHandler(val, prop, operate, lr) { const exps = []; if (Array.isArray(val)) { for (let index = 0; index < val.length; index++) { const [value, prop2, operate2, lr2] = val[index]; const _lr = index === 0 ? void 0 : lr2; const _operate = OperateTypeDefault[operate2] || operate2; const item = ApiQueryItemConstruct(value, prop2, _operate, _lr); if (item) { exps.push(item); } } } else { const _operate = OperateTypeDefault[operate] || operate; const item = ApiQueryItemConstruct(val, prop, _operate, lr); if (item) { exps.push(item); } } return [{ exps }]; } function ApiQueryConstruct(val, prop, operate, lr) { const queries = []; if (Array.isArray(val)) { for (let index = 0; index < val.length; index++) { const [value, prop2, operate2, lr2] = val[index]; const _lr = index === 0 ? void 0 : lr2; const queryItem = ApiQueryItemConstruct(value, prop2, operate2, _lr); if (queryItem !== null) { queries.push(queryItem); } } } else { const queryItem = ApiQueryItemConstruct(val, prop, operate, lr); if (queryItem !== null) { queries.push(queryItem); } } return queries; } function ApiQueryDestructure(param) { const result = {}; if (Array.isArray(param)) { param.forEach((item) => { if (item && item.prop) { result[item.prop] = item.value; } }); } else if (param && param.prop) { result[param.prop] = param.value; } return result; } function ApiQueryInsert(query, insertQuery) { if (!Array.isArray(query) || query.length === 0) { return Array.isArray(insertQuery) ? [...insertQuery] : [insertQuery]; } if (Array.isArray(insertQuery)) { return [...query, ...insertQuery]; } else { return [...query, insertQuery]; } } function ApiQueryDelete(query, deleteProps) { if (!Array.isArray(query) || query.length === 0) { return query; } if (!deleteProps || Array.isArray(deleteProps) && deleteProps.length === 0) { return query; } const targetDeleteProps = Array.isArray(deleteProps) ? deleteProps : [deleteProps]; const filteredQuery = query.filter((item) => !targetDeleteProps.includes(item.prop)); return filteredQuery.length === 0 ? null : filteredQuery; } export { ApiAMapGeocodeGeo, ApiAMapGeocodeRegeo, ApiAMapIP, ApiAMapInputtips, ApiAMapWeather, ApiCMSArticlesIndex, ApiCMSArticlesShow, ApiCMSCategoryIndex, ApiCMSCategoryTree, ApiFileExist, ApiFileOssBatchSignV2, ApiFileOssSign, ApiFileOssSignV2, ApiFileOssUpload, ApiFileOssUploadV2, ApiFilePresigned, ApiFileRepeat, ApiFileShow, ApiFileStsToken, ApiFileUpdate, ApiFileUpload, ApiFindRegionByLngLat, ApiGetPlaintextUserInfo, ApiGetScCode, ApiGisCreate, ApiGisShow, ApiIlhOauthLogin, ApiLogOut, ApiNeedChangePwd, ApiNeedGraphic, ApiPhoneAndCodeLogin, ApiPhoneAndCodeLoginOrRegister, ApiPhoneAndPasswordLogin, ApiPhoneOrUsernameAndPasswordAndCodeLogin, ApiPhoneOrUsernameAndPasswordAndCodeLoginPlatform, ApiPhoneOrUsernameAndPasswordLogin, ApiQQMapGeocodeGeo, ApiQQMapGeocodeRegeo, ApiQQMapIP, ApiQueryConstruct, ApiQueryDelete, ApiQueryDestructure, ApiQueryHandler, ApiQueryInsert, ApiQueryItemConstruct, ApiRefreshToken, ApiResetPwd, ApiResetPwdPlatform, ApiScCodeLogin, ApiScOAuthLogin, ApiScOAuthSecuser, ApiSmsPlatform, ApiSmsTenants, ApiSmsUnbound, ApiSortsConstruct, ApiSortsDelete, ApiSortsDestructure, ApiSortsHandler, ApiSysUpdateInfo, ApiSysUpdateInfoPlatform, ApiUserSysUpdate, ApiUserSysUpdatePlatform, ApiValidateImage, ApiWechatAuthUrl, ApiWechatBindPhone, ApiWechatBindPhonePlatform, ApiWechatCodeAuth, ApiWechatCodeBindPhone, ApiWechatCodeLogin, ApiWechatGetConfig, ApiWechatGetQrcode, ApiWechatLogout, ApiWechatMiniBindPhone, ApiWechatMiniLogin, ApiWechatUpdateInfo, ApiWechatUserRecords, ApiYyzGetSDKConfig, ApiYzyAuthVerify, ApiYzyCodeAuth, ApiYzyGetAuthUrl, ApiYzyLogin, ApiYzyLogout, ApiYzyRefreshToken, LrEnum, OperateEnum, init, sortType }; //# sourceMappingURL=index.js.map