Commit 3e30c458 by 王昆

gsb

parent 7edc4c55
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"name": "Launch Program", "name": "Launch Program",
"program": "${workspaceFolder}/bigdata/main.js" "program": "${workspaceFolder}/xgg-admin/main.js"
} }
] ]
} }
\ No newline at end of file
...@@ -13,6 +13,8 @@ class UserCtl extends CtlBase { ...@@ -13,6 +13,8 @@ class UserCtl extends CtlBase {
super("auth", CtlBase.getServiceName(UserCtl)); super("auth", CtlBase.getServiceName(UserCtl));
this.redisClient = system.getObject("util.redisClient"); this.redisClient = system.getObject("util.redisClient");
this.captchaSve = system.getObject("service.common.captchaSve");
this.platformUtils = system.getObject("util.businessManager.opPlatformUtils");
} }
async smsCode(qobj, pobj, req) { async smsCode(qobj, pobj, req) {
...@@ -37,40 +39,52 @@ class UserCtl extends CtlBase { ...@@ -37,40 +39,52 @@ class UserCtl extends CtlBase {
var captchaCode = this.trim(pobj.captchaCode); var captchaCode = this.trim(pobj.captchaCode);
try { try {
var vrs = await this.captchaSve.valid({
key: captchaKey,
code: captchaCode,
});
if (vrs.status !== 0) {
// return vrs;
}
// TODO 验证图片验证码 // 查用户
// var code = await await this.redisClient.get(this.captchaPrev + captchaKey) || ""; var loginrs = await this.platformUtils.login(loginName, password);
if(loginrs.status !== 0) {
return loginrs;
}
var puser = loginrs.Data;
// if (!code) { return system.getResultSuccess(puser);
// return system.getResult(null, "图片验证码过期,请点击重试");
// }
// if (code.toLowerCase() != captchaCode.toLowerCase()) {
// await this.redisClient.delete(this.captchaPrev + pobj.emailKey);
// return system.getResult(null, "图片验证码不一致,请点击重试");
// }
var adminUser = await this.service.findOne({ucname: loginName}); // this.service.getUserByUserNamePwd({
// var adminUser = await this.service.findById(1); // userName: loginName,
if(!adminUser) { // password: password,
return system.getResult(null, "用户名或密码错误"); // app_id: settings.app_id
} // });
var passwdMD5 = md5(password);
if(passwdMD5 != adminUser.passwd) {
return system.getResult(null, "用户名或密码错误");
}
adminUser.lastLoginTime = new Date(); // var adminUser = await this.service.findOne({
await adminUser.save(); // ucname: loginName
// });
// // var adminUser = await this.service.findById(1);
// if (!adminUser) {
// return system.getResult(null, "用户名或密码错误");
// }
// var passwdMD5 = md5(password);
// if (passwdMD5 != adminUser.passwd) {
// return system.getResult(null, "用户名或密码错误");
// }
var xggadminsid = uuidv4(); // adminUser.lastLoginTime = new Date();
xggadminsid = "3cb49932-fa02-44f0-90db-9f06fe02e5c7"; // await adminUser.save();
await this.redisClient.setWithEx(xggadminsid, JSON.stringify(adminUser), 60 * 60 * 2);
// 处理登录逻辑
var result = {
xggadminsid: xggadminsid,
}
return system.getResultSuccess(result);
// var xggadminsid = uuidv4();
// xggadminsid = "3cb49932-fa02-44f0-90db-9f06fe02e5c7";
// await this.redisClient.setWithEx(xggadminsid, JSON.stringify(adminUser), 60 * 60 * 2);
// // 处理登录逻辑
// var result = {
// xggadminsid: xggadminsid,
// }
// return system.getResultSuccess(result);
} catch (error) { } catch (error) {
return system.getResultFail(500, "接口异常:" + error.message); return system.getResultFail(500, "接口异常:" + error.message);
} }
......
module.exports = { module.exports = {
"appid": "40d64e586551405c9bcafab87266bb04", "appid": "728b979f7afd4413ac683344cd4a97fa",
"label": "研发开放平台", "label": "研发开放平台",
"config": { "config": {
"rstree": { "rstree": {
......
...@@ -173,8 +173,8 @@ class System { ...@@ -173,8 +173,8 @@ class System {
// var domain = "http://127.0.0.1"; // var domain = "http://127.0.0.1";
return { return {
// 公共服务 // 公共服务
common: domain + ":3102" + path, // common: domain + ":3102" + path,
// common: "http://127.0.0.1:3102" + path, common: "http://127.0.0.1:3102" + path,
// 商户服务 // 商户服务
merchant: domain + ":3101" + path, merchant: domain + ":3101" + path,
......
...@@ -110,7 +110,7 @@ class OpPlatformUtils { ...@@ -110,7 +110,7 @@ class OpPlatformUtils {
this.loginUrl, reqApiAccessKey.accessKey); this.loginUrl, reqApiAccessKey.accessKey);
if (restResult.status != 0 || !restResult.data) { if (restResult.status != 0 || !restResult.data) {
return system.getResult(restResult.status, restResult.msg); return system.getResultFail(-1, restResult.msg, restResult.status);
} }
return system.getResultSuccess(restResult.data); return system.getResultSuccess(restResult.data);
} }
......
...@@ -67,6 +67,7 @@ module.exports = function (app) { ...@@ -67,6 +67,7 @@ module.exports = function (app) {
res.end(JSON.stringify(r)); res.end(JSON.stringify(r));
}); });
}); });
app.post('/web/:gname/:qname/:method', function (req, res) { app.post('/web/:gname/:qname/:method', function (req, res) {
var classPath = req.params["qname"]; var classPath = req.params["qname"];
var methodName = req.params["method"]; var methodName = req.params["method"];
......
...@@ -19,12 +19,12 @@ var settings = { ...@@ -19,12 +19,12 @@ var settings = {
passroleid: 2, passroleid: 2,
tanentroleid: 1, tanentroleid: 1,
protocalPrefix: "http://", protocalPrefix: "http://",
appKey: "40d64e586551405c9bcafab87266bb04", appKey: "728b979f7afd4413ac683344cd4a97fa",
secret: "f99d413b767f09b5dff0b3610366cc46", secret: "f8891fcf37574f5a9f21b3030c302f4a",
salt: "%iatpD1gcxz7iF#B", salt: "%iatpD1gcxz7iF#B",
defaultpwd: "987456", defaultpwd: "987456",
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4001, port: process.env.NODE_PORT || 3002,
reqEsAddr: function () { reqEsAddr: function () {
if (this.env == "dev") { if (this.env == "dev") {
var localsettings = require("./localsettings"); var localsettings = require("./localsettings");
...@@ -33,6 +33,13 @@ var settings = { ...@@ -33,6 +33,13 @@ var settings = {
return "http://43.247.184.94:7200/"; return "http://43.247.184.94:7200/";
} }
}, },
paasUrl: function () {
if (this.env == "dev") {
return "http://open.gongsibao.com/";
} else {
return "http://open.gongsibao.com/";
}
},
apiconfig: { apiconfig: {
opLogUrl: function () { opLogUrl: function () {
return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty"; return settings.reqEsAddr() + "bigdata_zc_op_log/_doc?pretty";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment