'use strict'; const { Controller } = require('egg'); /** * @controller ExternalPrintPlatformController 外部打单平台(平台字典) * 平台基础资料由开发者维护,前端只读展示;是否回平台取号由 fetch_waybill_no 固化 */ class ExternalPrintPlatformController extends Controller { /** * @summary 外部打单平台列表 * @description 返回全部外部打单平台(按 sort 升序),供「店铺管理 → 外部打单平台」页面展示与账号表单选择 * @router get /api/external-print-platforms * @apikey * @request query integer status 状态:1启用 0禁用,不传则返回全部 * @response 200 externalPrintPlatformListResponse success */ async index() { const { ctx } = this; const { status } = ctx.query; const where = {}; if (status !== undefined && status !== '') where.status = Number(status); const rows = await ctx.model.ExternalPrintPlatform.findAll({ where, order: [[ 'sort', 'ASC' ], [ 'id', 'ASC' ]], }); ctx.body = { code: 0, message: 'success', data: rows }; } } module.exports = ExternalPrintPlatformController;