| 123456789101112131415161718192021222324252627282930 |
- const API = require("../../../lib/API");
- const db = require("../../../plugin/DataBase/db");
- const { BaseStdResponse } = require("../../../BaseStdResponse");
- class GetDownloadCenter extends API {
- constructor() {
- super();
- this.setPath('/Public/GetDownloadCenter');
- this.setMethod('GET');
- }
- async onRequest(req, res) {
- const sql = `
- SELECT title, description, download_url, version, icon,
- button_text, button_color, platform, extract_code, changelog_html, sort_order
- FROM download_item
- WHERE is_active = 1
- ORDER BY sort_order ASC, id ASC
- `;
- try {
- const rows = await db.query(sql);
- res.json({ ...BaseStdResponse.OK, data: rows || [] });
- } catch (err) {
- this.logger.error(`获取下载中心失败!${err.stack}`);
- res.json({ ...BaseStdResponse.ERR, msg: '获取下载中心失败!' });
- }
- }
- }
- module.exports.GetDownloadCenter = GetDownloadCenter;
|