12345678910111213141516171819202122232425262728293031323334 |
- const formatTime = date => {
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
- const hour = date.getHours()
- const minute = date.getMinutes()
- const second = date.getSeconds()
- return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
- }
- const formatNumber = n => {
- n = n.toString()
- return n[1] ? n : '0' + n
- }
- const getTypeSn = url => {
- let type_sn = ''
- if (url.indexOf('type_sn') != -1 && url.indexOf('bonusex') != -1) {
- let arr = url.split('&')
- arr.some(item => {
- if (item.indexOf('type_sn') != -1) {
- type_sn = item.split('=')[1]
- return true
- }
- })
- }
- return type_sn
- }
- module.exports = {
- getTypeSn: getTypeSn,
- formatTime: formatTime
- }
|