UNPKG

@pisell/pisellos

Version:

一个可扩展的前端模块化SDK框架,支持插件系统

118 lines (116 loc) 3.56 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/solution/BookingTicket/utils/scan/cloudSearch.ts var cloudSearch_exports = {}; __export(cloudSearch_exports, { searchProduct: () => searchProduct, searchWallet: () => searchWallet, searchWalletPass: () => searchWalletPass }); module.exports = __toCommonJS(cloudSearch_exports); var searchWalletPass = async (request, code) => { const params = { code, translate_flag: 1, // 翻译识别码名称 0:不翻译 1:翻译 relation_product: 1, // 组装关联商品: 0不处理 1处理 with: ["customer"], tags: [ "point_card", // 积分卡 "gift_card", // 充值卡 "product_voucher", // 代金券 "product_discount_card", // 折扣卡 "good_pass", // 商品券 "session_ticket", // 场次票 "appointment_ticket" // 预约类门票 ] }; try { const res = await (request == null ? void 0 : request.get( "/machinecode/batch-search", params )); if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) { return { searchType: "walletPass", response: res }; } throw new Error("没有找到对应的识别码"); } catch (error) { throw error; } }; var searchWallet = async (request, code) => { const params = { code, with_customer: 1 }; try { const res = await (request == null ? void 0 : request.post( "/wallet/detail/search", params )); if ((res == null ? void 0 : res.code) == 200 && !!(res == null ? void 0 : res.data)) { return { searchType: "wallet", response: res }; } throw new Error("没有找到对应的识别码"); } catch (error) { throw error; } }; var searchProduct = async (request, code) => { var _a, _b; const params = { exact_search: code, open_bundle: 0, // 套餐子信息 open_quotation: 1, // 报价单 skip: 1, num: 20, status: "published", with: ["variantGroup"], with_count: ["bundleGroup", "optionGroup"], exclude_extension_type: [ "product_party", "product_event", "product_series_event", "product_package_ticket", "ticket", "event_item" ] }; try { const res = await (request == null ? void 0 : request.post("/product/query", params)); if ((res == null ? void 0 : res.code) == 200 && ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b.length) > 0) { return { searchType: "product", response: res }; } throw new Error("没有找到对应的识别码"); } catch (error) { throw error; } }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { searchProduct, searchWallet, searchWalletPass });