@chuxingpay/hc-faas-base
Version:
FuXun Hotel Connector Base Objects
48 lines (47 loc) • 2.18 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RatePriceBaseMapping = void 0;
const base_1 = require("./base");
class RatePriceBaseMapping extends base_1.default {
constructor(config) {
super(config);
}
/**
* 执行多个价格匹配逻辑函数
*
* @param {any[]} rateprices 待匹配数据
* @param {boolean} [withRawData=true] 是否保留元数据
* @param {*} [parameter] mapping 函数执行时的额外参数
* @returns {Promise<RatePlanDto[]>}
* @memberof RatePlanBaseMapping
*/
doBatchMapping(rateprices, withRawData = true, parameter) {
return __awaiter(this, void 0, void 0, function* () {
return yield Promise.all(rateprices.map((rateprice) => __awaiter(this, void 0, void 0, function* () { return yield this.mapping(rateprice, withRawData, parameter); })));
});
}
/**
* 执行单个价格匹配逻辑函数
*
* @param {*} rateprice 待匹配数据
* @param {boolean} [withRawData=true] 是否保留原数据
* @param {*} [parameter] mapping 函数执行时的额外参数
* @returns {Promise<RatePlanDto>}
* @memberof RatePlanBaseMapping
*/
doMapping(rateprice, withRawData = true, parameter) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mapping(rateprice, withRawData, parameter);
});
}
}
exports.RatePriceBaseMapping = RatePriceBaseMapping;