Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanma/8656bb29f2d43fd6d32443574f554884 to your computer and use it in GitHub Desktop.
Save lanma/8656bb29f2d43fd6d32443574f554884 to your computer and use it in GitHub Desktop.
const express = require('express')
const parser = require('ua-parser-js')
const app = express()
const port = 3000
const code = '111121314151617'//場所代碼
var count=0//人次
app.get('/', (req, res) => {
let ua = parser(req.headers['user-agent'])
let sep = ua.os.name === 'iOS'? '&' : '?'
count = count+1
console.log("==人數:",count,'本次用戶OS為:',ua.os.name)
res.redirect(`sms:1922${sep}body=場所代碼:${code} 本簡訊是簡訊實聯制發送,限防疫目的使用(人次${count})`)
})
app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment