fix var dup

This commit is contained in:
Jay 2018-08-28 23:45:31 +08:00
parent fb4474b44e
commit a8a3f595ec

View File

@ -35,9 +35,9 @@ const textMessage = async (evt) => {
}
}
const saveToLog = async (source, text = '') => {
const saveToLog = async (source, msg = '') => {
if (!source || typeof source !== 'object') return null
if (typeof text !== 'string' || text.length === 0) return null
if (typeof msg !== 'string' || msg.length === 0) return null
let {groupId, userId} = source
if (typeof groupId !== 'string' || groupId.length === 0) return null
if (typeof userId !== 'string' || userId.length === 0) return null
@ -61,7 +61,7 @@ const saveToLog = async (source, text = '') => {
await db.query({text, values})
}
text = `insert into "public"."line_message_log" ("group", "user", "message") values ($1, $2, $3)`
values = [groupId, userId, text]
values = [groupId, userId, msg]
await db.query({text, values})
} catch (err) {
console.log('save log error :::: ', err)