diff --git a/route/api/twitch/index.js b/route/api/twitch/index.js index b5707a8..1fdd90a 100644 --- a/route/api/twitch/index.js +++ b/route/api/twitch/index.js @@ -159,6 +159,26 @@ r.get('/channel/:chid/opay/bar', async (c, n) => { if (result.rowCount === 0) setting = {} setting = result.rows[0] + if (result.rowCount > 0) { + text = `select sum(list.price) as total from "public"."opay_donate_list" list + left join "public"."twitch" tw + on tw.opayid = list.opayid + where + tw.opayid != '' + and tw.id = $1 + and ctime >= $2 + group by list.opayid` + values = [chid, setting.start_date] + let priceResult = await c.db.query({ + text, values + }) + if (priceResult.rowCount > 0) { + setting.total = priceResult.row[0].price + } else { + setting.total = 0 + } + } + c.obj = resObject('Success', {setting}) })