UNPKG

youzanyun-devtool-worker

Version:

- web - ws - proxy

39 lines (38 loc) 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const axios_1 = tslib_1.__importDefault(require("axios")); let getMockGoods; class GetMockGoods { static getInstance() { if (!getMockGoods) { getMockGoods = new GetMockGoods(); } return getMockGoods; } async run(ctx) { const { appName, p } = ctx.query; const pageSize = 8; const res = await axios_1.default({ method: "GET", url: "http://127.0.0.1:31240/api/design-platform/mock-data/list", params: { appName, type: 'goods', pageNo: p, pageSize, } }); if (res.data && res.data.data) { res.data.data.data_list = res.data.data.content || []; res.data.data.page_view = ` 每页 ${pageSize} 条 <a class="num active">${p}</a> `; res.data.data.total_items = res.data.data.total || 0; } ctx.body = res.data; } } exports.default = GetMockGoods; ;