Edit D:\xinhaisoft\crisis_new\api\controllers\scale.js
// ??? const util = require('../utils') const db = require('../data') let [sql, rs] = ['', null] /** * ??????ID???????????? * get: /lb/:id */ exports.Info = async ctx => { const id = ctx.params.id if (!util.isInteger(id)) { throw { code: -2 } } else { const act = ctx.query.act if (act === 'age') { sql = 'select top 1 age_min as min,age_max as max from lb where available=1 and id=' + id } else { sql = `select top 1 name_ch,name_en,name_fr,testtip,questcount,age_min,age_max,intro1,intro2,intro3,picture,money,factor1,chart from lb where available=1 and id=${id}` } rs = await db.select(sql) if (rs) { ctx.body = { code: 0, data: rs } } else { throw { code: 1, message: `?????${id}??????` } } } } /** * ????????? * get /lb/:id/question */ exports.Question = async ctx => { const id = ctx.params.id if (!util.isInteger(id)) { throw { code: -2 } } else { sql = `select sort as no,question from lbquestion where lb=${id} order by sort` rs = await db.select(sql) ctx.body = { code: 0, data: rs || [] } } }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de