Edit D:\xinhaisoft\crisis_new\api\controllers\message.js
// ?????????????? const util = require('../utils') const db = require('../data') const EnDeNum = require('../utils/encrypt-decrypt-number') const axios = require('axios') const cache = new (require('node-cache'))() let [sql, rs] = ['', null] /** * ??????????????ast???????????????????????count????????? * get: /message/new?uid=1&last=1 * get: /message/new?uid=1&count=1 */ exports.New = async ctx => { const uid = ctx.query.uid const last = ctx.query.last const count = ctx.query.count if (!util.isInteger(uid)) { throw { code: -2 } } else if (count) { sql = `select count(id) as count from message where receiver=${uid} and isnew=1` rs = await db.scalar(sql) ctx.body = { code: 0, data: rs } } else { sql = `select id,title,content,sendername,issys,datetime from v_message where receiver=${uid} and isnew=1 order by datetime desc` rs = await db.select(sql) if (last && rs.length === 0) { sql = `select top 1 id,title,content,sendername,issys,datetime,isnew from v_message where receiver=${uid} order by datetime desc` rs = await db.select(sql) if (rs) { rs = [rs] } } ctx.body = { code: 0, data: rs || [] } } } /** * ???????????D????????d?????????????????????? * get: /message/readed */ exports.Readed = async ctx => { const id = ctx.query.id const uid = ctx.query.uid sql = '' if (!util.isInteger(uid)) { throw { code: -2 } } else if (util.isInteger(id)) { sql = `update message set isnew=0 where receiver=${uid} and isnew=1 and id=${id}` } else { sql = `update message set isnew=0 where receiver=${uid} and isnew=1` } if (sql) { db.execute(sql) ctx.body = { code: 0 } } } /** * ????????????????????????????????????ort????????tosms??????xiuzhiu????? * ???API?????? */ var _0x241b = ['dG9zbXM=', 'aHR0cDovL3d3dy50b3Ntcy5jbi9BcGkvU2VuZFNtcy5hc2h4P3VzZXJuYW1lPXBzeWNoJnBhc3N3b3JkPTdlMzFjNTY3ZGY3ZjE1YmZjNGY0ZmU2MmU0YWEyMDExJnBob25lcz0=', 'JmNvbnRlbnQ9', 'c3RhcnRzV2l0aA==', '44CQ5b+D5rW35a+86Iiq44CR', 'aHR0cDovLzEyMC4yNi42Ni4yNC9tc2cvSHR0cEJhdGNoU2VuZFNNP2FjY291bnQ9Ymp4aGRoX2h5JnBzd2Q9Ymp4aGRoX2h5MTIzJm1vYmlsZT0=', 'Jm1zZz0='] var _0x2f8d = function (_0x2d8f05) { _0x2d8f05 = _0x2d8f05 - 0x0 var _0x4d74cb = _0x241b[_0x2d8f05] if (_0x2f8d['ZNGsXa'] === undefined) { (function () { var _0x36c6a6 = function () { var _0x33748d; try { _0x33748d = Function('return\x20(function()\x20' + '{}.constructor(\x22return\x20this\x22)(\x20)' + ');')(); } catch (_0x3e4c21) { _0x33748d = window; } return _0x33748d; }; var _0x5c685e = _0x36c6a6(); var _0x3e3156 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; _0x5c685e['atob'] || (_0x5c685e['atob'] = function (_0x1e9e81) { var _0x292610 = String(_0x1e9e81)['replace'](/=+$/, ''); for (var _0x151bd2 = 0x0, _0x558098, _0xd7aec1, _0x230f38 = 0x0, _0x948b6c = ''; _0xd7aec1 = _0x292610['charAt'](_0x230f38++); ~_0xd7aec1 && (_0x558098 = _0x151bd2 % 0x4 ? _0x558098 * 0x40 + _0xd7aec1 : _0xd7aec1, _0x151bd2++ % 0x4) ? _0x948b6c += String['fromCharCode'](0xff & _0x558098 >> (-0x2 * _0x151bd2 & 0x6)) : 0x0) { _0xd7aec1 = _0x3e3156['indexOf'](_0xd7aec1); } return _0x948b6c; }); }()); _0x2f8d['Mlsgai'] = function (_0x29929c) { var _0x5dd881 = atob(_0x29929c); var _0x550fbc = []; for (var _0x18d5c9 = 0x0, _0x4ce2f1 = _0x5dd881['length']; _0x18d5c9 < _0x4ce2f1; _0x18d5c9++) { _0x550fbc += '%' + ('00' + _0x5dd881['charCodeAt'](_0x18d5c9)['toString'](0x10))['slice'](-0x2); } return decodeURIComponent(_0x550fbc); }; _0x2f8d['AmXjho'] = {}; _0x2f8d['ZNGsXa'] = !![]; } var _0x333808 = _0x2f8d['AmXjho'][_0x2d8f05]; if (_0x333808 === undefined) { _0x4d74cb = _0x2f8d['Mlsgai'](_0x4d74cb); _0x2f8d['AmXjho'][_0x2d8f05] = _0x4d74cb; } else { _0x4d74cb = _0x333808; } return _0x4d74cb; } const SendSMS = (_0xd90edb, _0x10c4f7, _0xb3882c) => { if (_0xb3882c === _0x2f8d('0x0')) { const _0x25d359 = _0x2f8d('0x1') + _0xd90edb + _0x2f8d('0x2') + encodeURIComponent(_0x10c4f7); axios(_0x25d359); } else { if (!_0x10c4f7[_0x2f8d('0x3')]('??')) { _0x10c4f7 = _0x2f8d('0x4') + _0x10c4f7; } const _0x57c0a6 = _0x2f8d('0x5') + _0xd90edb + _0x2f8d('0x6') + encodeURIComponent(_0x10c4f7); axios(_0x57c0a6); } } exports.SendSMS = SendSMS /** * ????????????????????????????????????????? * post: /message/sms */ exports.SMS = ctx => { const mobile = EnDeNum.decrypt(ctx.request.body.m) const content = ctx.request.body.c || '' const port = ctx.request.body.p if (!util.isMobile(mobile)) { ctx.body = { code: 1, message: '???????????' } } else if (content === '') { ctx.body = { code: 2, message: '??????' } } else { SendSMS(mobile, content, port) ctx.body = { code: 0 } } } /** * ????????????????????????? * post: /message/mobilecode */ exports.SendMobileCode = async ctx => { const body = ctx.request.body const mobile = EnDeNum.decrypt(body.m) if (util.isMobile(mobile)) { if (cache.get(mobile)) { ctx.body = { code: 2, message: '2??????????????' } } else { const code = util.RndNum(100000, 999999) const data = EnDeNum.encrypt(code) const port = body.p const school = Number(body.s) const content = '??????' + code + '?????10???????????????????????????????' if (school > 0) { rs = await db.select('select top 1 sms_sign from school where id=' + school) if (rs === null) { throw { code: 3, message: '?????' + school + '??????' } } else { SendSMS(mobile, rs.sms_sign + content, port) cache.set(mobile, code, 120) ctx.body = { code: 0, data } } } else { SendSMS(mobile, content, port) cache.set(mobile, code, 120) ctx.body = { code: 0, data } } } } else { throw { code: 1, message: '???????????' } } }
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de