Commit dc1a8c2e by 庄冰

api.js

parent 5a907b45
......@@ -351,13 +351,29 @@ module.exports = function (app) {
});
app.use('/feishu/login', async function (req, res) {
try {
var result = system.getResult(null, "login fail");
// console.log(req,"/feishu/login++++++++++++++++++++++++++++++++++++++");
var client_ip = system.get_client_ip(req);
var result = await feishuLoginSve.checkAndLogin(req.query);
var pobj = req.query;
var token = pobj.state || "";
if (!token) {
result.msg = "req headers token can not be empty";
result.data = null;
res.end(JSON.stringify(result));
return;
}
var cacheManager = system.getObject("db.common.cacheManager");
var result = await cacheManager["AppTokenByHostsCache"].getCache(token, system.exTime);
if (result.status != 0) {
res.end(JSON.stringify(result));
return;
}
pobj.appInfo = result.data;
result = await feishuLoginSve.checkAndLogin(pobj);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "飞书小程序记录回调处理结果,method=login",
op: "app/config/routes/api.js/feishu/notify",
content: "回调参数:" + JSON.stringify(req.query) + "回调结果:" + JSON.stringify(result),
content: "回调参数:" + JSON.stringify(pobj) + "回调结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
var returnObj = JSON.stringify(result);
......
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