fix api body parser

This commit is contained in:
Jay 2018-08-21 23:32:43 +08:00
parent 8224c444c1
commit 063b7e277f

View File

@ -67,7 +67,7 @@ r.get('/channel/:chid', checkSession, getChannelList, hasChannel('chid'), async
c.obj = resObject('Success', {channel: c.state.channel}) c.obj = resObject('Success', {channel: c.state.channel})
}) })
r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid'), async (c, n) => { r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid'), koaBody(), async (c, n) => {
if (!c.chkBody('join', 'number')) throw genError('DataFormat') if (!c.chkBody('join', 'number')) throw genError('DataFormat')
let join = toInt(c.request.body.join, 0, 0, 1) let join = toInt(c.request.body.join, 0, 0, 1)
let text = `update "public"."twitch_channel" set "join" = $1 where "id" = $2` let text = `update "public"."twitch_channel" set "join" = $1 where "id" = $2`
@ -82,7 +82,7 @@ r.put('/channel/:chid/botjoin', checkSession, getChannelList, hasChannel('chid')
c.obj = resObject('Success') c.obj = resObject('Success')
}) })
r.put('/channel/:chid/opay', checkSession, getChannelList, hasChannel('chid'), async (c, n) => { r.put('/channel/:chid/opay', checkSession, getChannelList, hasChannel('chid'), koaBody(), async (c, n) => {
if (!c.chkBody('opay', 'string', true)) throw genError('DataFormat') if (!c.chkBody('opay', 'string', true)) throw genError('DataFormat')
let text = `update "public"."twitch_channel" set "opayid" = $1 where "id" = $2` let text = `update "public"."twitch_channel" set "opayid" = $1 where "id" = $2`