updated response handle for admin and db - 1

This commit is contained in:
strawmanbobi
2016-12-07 21:29:11 +08:00
parent 4ec6f5e57a
commit 76a5a8155d
3 changed files with 7 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ exports.setupEnvironment = function () {
MYSQL_DB_PASSWORD = "root"; MYSQL_DB_PASSWORD = "root";
FILE_TEMP_PATH = "~/home/strawmanbobi/rc_extension"; FILE_TEMP_PATH = "~/home/strawmanbobi/rc_extension";
PYTHON_PATH = "/usr/bin/python"; PYTHON_PATH = "/usr/bin/python";
LISTEN_PORT = "8300"; LISTEN_PORT = "80";
SERVER_ADDRESS = "localhost"; SERVER_ADDRESS = "localhost";
REDIS_HOST = "localhost"; REDIS_HOST = "localhost";
REDIS_PORT = "6379"; REDIS_PORT = "6379";
@@ -35,13 +35,13 @@ exports.setupEnvironment = function () {
MYSQL_DB_PASSWORD = "root"; MYSQL_DB_PASSWORD = "root";
FILE_TEMP_PATH = "D:/rc_extension"; FILE_TEMP_PATH = "D:/rc_extension";
PYTHON_PATH = "C:/Python27/python.exe"; PYTHON_PATH = "C:/Python27/python.exe";
LISTEN_PORT = "8300"; LISTEN_PORT = "80";
SERVER_ADDRESS = "localhost"; SERVER_ADDRESS = "localhost";
REDIS_HOST = "localhost"; REDIS_HOST = "localhost";
REDIS_PORT = "6379"; REDIS_PORT = "6379";
REDIS_PASSWORD = ""; REDIS_PASSWORD = "";
EXTERNAL_SERVER_ADDRESS = "www.strawmanbobi.com"; EXTERNAL_SERVER_ADDRESS = "www.strawmanbobi.com";
EXTERNAL_SERVER_PORT = "8200" EXTERNAL_SERVER_PORT = "8300"
} else if (enums.APP_USERDEBUG_MODE == env) { } else if (enums.APP_USERDEBUG_MODE == env) {
MYSQL_DB_SERVER_ADDRESS = "localhost"; MYSQL_DB_SERVER_ADDRESS = "localhost";
MYSQL_DB_NAME = "irext"; MYSQL_DB_NAME = "irext";
@@ -49,12 +49,12 @@ exports.setupEnvironment = function () {
MYSQL_DB_PASSWORD = "root"; MYSQL_DB_PASSWORD = "root";
FILE_TEMP_PATH = "D:/rc_extension"; FILE_TEMP_PATH = "D:/rc_extension";
PYTHON_PATH = "/usr/bin/python"; PYTHON_PATH = "/usr/bin/python";
LISTEN_PORT = "8300"; LISTEN_PORT = "80";
SERVER_ADDRESS = "localhost"; SERVER_ADDRESS = "localhost";
REDIS_HOST = "localhost"; REDIS_HOST = "localhost";
REDIS_PORT = "6379"; REDIS_PORT = "6379";
REDIS_PASSWORD = ""; REDIS_PASSWORD = "";
EXTERNAL_SERVER_ADDRESS = "www.strawmanbobi.com"; EXTERNAL_SERVER_ADDRESS = "www.strawmanbobi.com";
EXTERNAL_SERVER_PORT = "8200" EXTERNAL_SERVER_PORT = "8300"
} }
}; };

View File

@@ -19,23 +19,6 @@ DROP database IF EXISTS `irext`;
CREATE database `irext`; CREATE database `irext`;
use `irext`; use `irext`;
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) NOT NULL,
`password` varchar(32) DEFAULT NULL,
`permissions` varchar(64) DEFAULT NULL,
`admin_type` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-- --
-- Dumping data for table `admin` -- Dumping data for table `admin`
-- --

View File

@@ -39,13 +39,12 @@ exports.adminLoginWorkUnit = function (userName, password, callback) {
requestSender.sendPostRequest(signinInfo, requestSender.sendPostRequest(signinInfo,
function(signInRequestErr, signInResponse) { function(signInRequestErr, signInResponse) {
if (signInRequestErr == errorCode.SUCCESS.code && null != signInResponse) { if (signInRequestErr == errorCode.SUCCESS.code && null != signInResponse) {
var admin = signInResponse; var admin = JSON.parse(signInResponse).entity;
var userID, var userID,
token, token,
key, key,
ttl = 24 * 60 * 60 * 14, ttl = 24 * 60 * 60 * 14,
timeStamp, timeStamp;
admin;
timeStamp = new Date().getTime(); timeStamp = new Date().getTime();
token = MD5.MD5(password + timeStamp); token = MD5.MD5(password + timeStamp);
token += "," + admin.permissions; token += "," + admin.permissions;