@chuxingpay/hc-faas-base
Version:
FuXun Hotel Connector Base Objects
46 lines (45 loc) • 1.86 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.HotelBaseMapping = void 0;
const base_1 = require("./base");
class HotelBaseMapping extends base_1.default {
constructor(config) {
super(config);
}
/**
* 执行多个酒店匹配逻辑函数
*
* @param {*} hotels
* @param {boolean} [withRawData=true]
* @returns {Promise<HotelDto[]>}
* @memberof BaseHotelMapping
*/
doBatchMapping(hotels, withRawData = true) {
return __awaiter(this, void 0, void 0, function* () {
return yield Promise.all(hotels.map((hotel) => __awaiter(this, void 0, void 0, function* () { return yield this.mapping(hotel, withRawData); })));
});
}
/**
* 执行单个酒店匹配逻辑函数
*
* @param {*} hotel
* @param {boolean} [withRawData=true]
* @returns {Promise<HotelDto>}
* @memberof BaseHotelMapping
*/
doMapping(hotel, withRawData = true) {
return __awaiter(this, void 0, void 0, function* () {
return yield this.mapping(hotel, withRawData);
});
}
}
exports.HotelBaseMapping = HotelBaseMapping;