youzanyun-devtool-worker
Version:
- web - ws - proxy
38 lines (37 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const axios_1 = tslib_1.__importDefault(require("axios"));
let getMockCoupons;
class GetMockCoupons {
static getInstance() {
if (!getMockCoupons) {
getMockCoupons = new GetMockCoupons();
}
return getMockCoupons;
}
async run(ctx) {
const { appName, pageNo, pageSize } = ctx.query;
const res = await axios_1.default({
method: "GET",
url: "http://127.0.0.1:31240/api/design-platform/mock-data/list",
params: {
appName,
type: 'coupon',
pageNo,
pageSize
}
});
if (res.data && res.data.data) {
res.data.data.items = res.data.data.content || [];
res.data.data.paginator = {
page: res.data.data.pageNo,
pageSize,
totalCount: res.data.data.total
};
}
ctx.body = res.data;
}
}
exports.default = GetMockCoupons;
;