diff --git a/route/api/twitch/index.js b/route/api/twitch/index.js index 9e39961..b5707a8 100644 --- a/route/api/twitch/index.js +++ b/route/api/twitch/index.js @@ -140,4 +140,26 @@ r.put('/channel/:chid/opay/setting', checkSession, getChannelList, hasChannel('c c.obj = resObject('Success') }) +r.get('/channel/:chid/opay/bar', async (c, n) => { + let chid = c.params.chid || '' + if (typeof chid !== 'string' || chid.trim().length === 0) throw genError('DataFormat') + let text = `select ds.* from "public"."donate_setting" ds + left join "public"."twitch_channel" tw + on tw.id = ds.twitch + where + tw.opayid != '' + and tw.id = $1` + let values = [chid] + + let result = await c.db.query({ + text, + values + }) + let setting = {} + if (result.rowCount === 0) setting = {} + setting = result.rows[0] + + c.obj = resObject('Success', {setting}) +}) + module.exports = r