Commit 2ddb4e08 by 王栋源

wdy

parents 3d271e9e ad57b81f
...@@ -18,10 +18,10 @@ class TmToolsAPI extends WEBBase { ...@@ -18,10 +18,10 @@ class TmToolsAPI extends WEBBase {
if (!pobj.actionType) { if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
} }
var result = await this.opActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody, req); var result = await this.opActionProcess(pobj, pobj.actionType, pobj.actionBody, req);
return result; return result;
} }
async opActionProcess(action_process, action_type, action_body, req) { async opActionProcess(pobj, action_type, action_body, req) {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
// sy // sy
...@@ -34,8 +34,8 @@ class TmToolsAPI extends WEBBase { ...@@ -34,8 +34,8 @@ class TmToolsAPI extends WEBBase {
case "decryptStr":// case "decryptStr"://
opResult = await this.toolSve.decryptStr(req.app, action_body.opStr); opResult = await this.toolSve.decryptStr(req.app, action_body.opStr);
break; break;
case "getOssConfig":// case "getOssConfig"://获取oss信息
opResult = await this.toolSve.getOssConfig(); opResult = await this.toolSve.getOssConfig(pobj);
break; break;
case "getNcl"://尼斯查询(一) case "getNcl"://尼斯查询(一)
opResult = await this.toolSve.getNcl(action_body, req); opResult = await this.toolSve.getNcl(action_body, req);
......
...@@ -21,10 +21,13 @@ class feishuAppAccessTokenCache extends CacheBase{ ...@@ -21,10 +21,13 @@ class feishuAppAccessTokenCache extends CacheBase{
var result = await this.redisClient.get(key); var result = await this.redisClient.get(key);
return result; return result;
} }
async set(accessToken){ async set(accessToken,expire){
if(!expire){
expire=7100;
}
var key = this.prefix; var key = this.prefix;
if(accessToken){ if(accessToken){
await this.redisClient.setWithEx(key,accessToken,7100); await this.redisClient.setWithEx(key,accessToken,expire);
} }
return accessToken; return accessToken;
} }
......
...@@ -2,7 +2,7 @@ const CacheBase=require("../cache.base"); ...@@ -2,7 +2,7 @@ const CacheBase=require("../cache.base");
const system=require("../../system"); const system=require("../../system");
// const OpenplatformWxop = require("../../wxop/impl/openplatformWxop"); // const OpenplatformWxop = require("../../wxop/impl/openplatformWxop");
/** /**
* 飞书小程序--AppTicket缓存--有效时间7100s * 飞书小程序--AppTicket缓存--有效时间3600s
*/ */
class feishuAppTicketCache extends CacheBase{ class feishuAppTicketCache extends CacheBase{
constructor(){ constructor(){
...@@ -24,7 +24,7 @@ class feishuAppTicketCache extends CacheBase{ ...@@ -24,7 +24,7 @@ class feishuAppTicketCache extends CacheBase{
async set(appTicket){ async set(appTicket){
var key = this.prefix; var key = this.prefix;
if(appTicket){ if(appTicket){
await this.redisClient.setWithEx(key,appTicket,7100); await this.redisClient.setWithEx(key,appTicket,3600);
} }
return appTicket; return appTicket;
} }
......
...@@ -29,10 +29,20 @@ class feishuUserAccessTokenCache extends CacheBase{ ...@@ -29,10 +29,20 @@ class feishuUserAccessTokenCache extends CacheBase{
return null; return null;
} }
async set(obj,openid){ async set(obj,openid){
var expire = 7100;
if(obj.expires_in){
var time = obj.expires_in;
var now = Date.parse(new Date())/1000;
if(now<time){
expire = time - now;
}else{
return null;
}
}
var key = this.prefix+"_"+openid; var key = this.prefix+"_"+openid;
if(obj && obj.access_token){ if(obj && obj.access_token){
var stringobj = JSON.stringify(obj); var stringobj = JSON.stringify(obj);
await this.redisClient.setWithEx(key,stringobj,7100); await this.redisClient.setWithEx(key,stringobj,expire);
return obj; return obj;
} }
return null; return null;
......
...@@ -406,7 +406,7 @@ class CenterorderService extends AppServiceBase { ...@@ -406,7 +406,7 @@ class CenterorderService extends AppServiceBase {
//--------------------------阿里ICP---end-------------------------------------------------------- //--------------------------阿里ICP---end--------------------------------------------------------
//LOGO场景接口服务 //LOGO场景接口服务
async downloadlogoscene(pobj){ async downloadlogoscene(pobj){
var reqUrl = "http://43.247.184.92:15501/api/downloadscene"; var reqUrl = "http://123.57.217.203:4724/api/downloadscene";//"http://ailogo-service/api/downloadscene";
var obj = pobj.actionBody; var obj = pobj.actionBody;
if(!obj.title){ if(!obj.title){
return system.getResult(null,"品牌名称不能为空"); return system.getResult(null,"品牌名称不能为空");
...@@ -425,7 +425,7 @@ class CenterorderService extends AppServiceBase { ...@@ -425,7 +425,7 @@ class CenterorderService extends AppServiceBase {
} }
//换一批logo //换一批logo
async changelogo(pobj){ async changelogo(pobj){
var reqUrl = "http://43.247.184.92:15501/api/changelogo"; var reqUrl = "http://123.57.217.203:4724/api/changelogo";
var obj = pobj.actionBody; var obj = pobj.actionBody;
if(!obj.title){ if(!obj.title){
return system.getResult(null,"品牌名称不能为空"); return system.getResult(null,"品牌名称不能为空");
...@@ -447,7 +447,7 @@ class CenterorderService extends AppServiceBase { ...@@ -447,7 +447,7 @@ class CenterorderService extends AppServiceBase {
} }
//生成logo //生成logo
async singlelogo(pobj){ async singlelogo(pobj){
var reqUrl = "http://43.247.184.92:15501/api/singlelogo"; var reqUrl = "http://123.57.217.203:4724/api/singlelogo";
var obj = pobj.actionBody; var obj = pobj.actionBody;
if(!obj.title){ if(!obj.title){
return system.getResult(null,"品牌名称不能为空"); return system.getResult(null,"品牌名称不能为空");
......
const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings");
class feishuLoginService{
constructor() {
this.utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
};
//用户登录
async checkAndLogin(pobj){
if(!pobj.code){
return system.getResultFail(-100, "code参数不能为空");
}
//获取 app_access_token(应用商店应用)
var appAccessTokenRes = await this.utilsFeishuSve.getAppAccessToken();
if(appAccessTokenRes.status!=0){
return appAccessTokenRes;
}
var app_access_token = appAccessTokenRes.data;
//获取飞书登录用户身份
var userAccessTokenParams = {
"code":pobj.code,"app_access_token":app_access_token,"open_id":pobj.open_id || ""
};
var userAccessTokenRes = await this.utilsFeishuSve.getUserAccessToken(userAccessTokenParams);
if(userAccessTokenRes.status!=0){
return userAccessTokenRes;
}
var userAccessTokenObj = userAccessTokenRes.data;
//获取飞书用户信息
var userInfoParams={
user_access_token:userAccessTokenObj.access_token
};
var userInfoRes = await this.utilsFeishuSve.getUserInfo(userInfoParams);
if(userInfoRes.status!=0){
return userInfoRes;
}
var userInfoObj = userInfoRes.data;
var createUserParams = {
// uapp_id,channel_userid,channel_username,channel_nickname,open_id,he
};
}
}
module.exports = feishuLoginService;
\ No newline at end of file
const system = require("../../../system"); const system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const AppServiceBase = require("../../app.base");
const crypto = require('crypto'); const crypto = require('crypto');
const cryptoJS = require("crypto-js"); const cryptoJS = require("crypto-js");
var fs = require("fs");
var accesskey = 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla'; class ToolService extends AppServiceBase {
var accessKeyId = 'LTAIyAUK8AD04P5S';
var url = "https://gsb-zc.oss-cn-beijing.aliyuncs.com";
class ToolService {
constructor() { constructor() {
super();
this.zcApiUrl = settings.reqZcApi(); this.zcApiUrl = settings.reqZcApi();
this.execClient = system.getObject("util.execClient"); // this.execClient = system.getObject("util.execClient");
} }
async getCropperPic(obj, req) { async getCropperPic(obj, req) {
var url = this.zcApiUrl + "api/tool/toolApi/getCropperPic"; var url = this.zcApiUrl + "api/tool/toolApi/getCropperPic";
...@@ -79,29 +78,11 @@ class ToolService { ...@@ -79,29 +78,11 @@ class ToolService {
return data; return data;
} }
async getOssConfig(queryobj, req) { async getOssConfig(pobj, req) {//获取oss信息
var policyText = { var reqUrl = settings.centerAppUrl() + "auth/accessAuth/getOssInfo";
"expiration": "2119-12-31T16:00:00.000Z", var result = await this.restPostUrl(pobj, reqUrl);
"conditions": [ return result;
["content-length-range", 0, 1048576000], }
["starts-with", "$key", "zc"]
]
};
var b = new Buffer(JSON.stringify(policyText));
var policyBase64 = b.toString('base64');
var signature = crypto.createHmac('sha1', accesskey).update(policyBase64).digest().toString('base64'); //base64
var data = {
OSSAccessKeyId: accessKeyId,
policy: policyBase64,
Signature: signature,
Bucket: 'gsb-zc',
success_action_status: 201,
url: url
};
return system.getResultSuccess(data);
};
//加密信息 //加密信息
async encryptStr(app, opStr) { async encryptStr(app, opStr) {
if (!opStr) { if (!opStr) {
......
const system = require("../../../system"); const system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
const uuidv4 = require('uuid/v4');
// var crypto = require('crypto');
/** /**
* 飞书小程序相关接口 * 飞书小程序相关接口
*/ */
...@@ -7,11 +9,19 @@ class UtilsFeishuService{ ...@@ -7,11 +9,19 @@ class UtilsFeishuService{
constructor() { constructor() {
this.execClient = system.getObject("util.execClient"); this.execClient = system.getObject("util.execClient");
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
this.appConfig={ this.appConfig={
app_id:"cli_9e28dcb1d637100d", app_id:"cli_9e28dcb1d637100d",
app_secret:"zL1uRrWFzwhFbLWZrmSuCh72JGjJXQg0" app_secret:"zL1uRrWFzwhFbLWZrmSuCh72JGjJXQg0"
} }
}; };
//飞书事件消息通知解密
// async notifyDecrypt(str){
// var pobj = {};
// str = str.toString('utf8');
// return pobj;
// }
//飞书通知 //飞书通知
async notify(pobj){ async notify(pobj){
if(!pobj || !pobj.type){ if(!pobj || !pobj.type){
...@@ -91,11 +101,14 @@ class UtilsFeishuService{ ...@@ -91,11 +101,14 @@ class UtilsFeishuService{
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if(result.code==0 && result.app_access_token){ if(result.code==0 && result.app_access_token){
//缓存AppAccessToken //缓存AppAccessToken
await this.cacheManager["feishuAppAccessTokenCache"].set(result.app_access_token); await this.cacheManager["feishuAppAccessTokenCache"].set(result.app_access_token,result.expire);
return system.getResultSuccess(result.app_access_token); return system.getResultSuccess(result.app_access_token);
} }
return system.getResultFail("获取appAccessToken失败"); return system.getResultFail("获取appAccessToken失败");
} }
//------------------------飞书网页开发---------------------------------------------------------------
//获取登录用户身份 //获取登录用户身份
async getUserAccessToken(obj){ async getUserAccessToken(obj){
var resData = {}; var resData = {};
...@@ -140,7 +153,7 @@ class UtilsFeishuService{ ...@@ -140,7 +153,7 @@ class UtilsFeishuService{
var obj = { var obj = {
user_access_token:pobj.user_access_token user_access_token:pobj.user_access_token
}; };
var rtn = await this.execClient.execGet(obj, url); var rtn = await this.execClient.execFeishuGet(obj, url);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty"); return system.getResult(null, "execPost data is empty");
} }
...@@ -150,10 +163,151 @@ class UtilsFeishuService{ ...@@ -150,10 +163,151 @@ class UtilsFeishuService{
} }
return system.getResult(null, "获取飞书用户信息失败"); return system.getResult(null, "获取飞书用户信息失败");
} }
//------------------------飞书网页开发-------结束--------------------------------------------------------
//------------------------飞书小程序开发---------------------------------------------------------------
//获取登录用户身份 session_key 和 openId
async tokenLoginValidate(obj){
var resData = {};
if(obj.open_id){
//缓存中获取登录用户身份
resData = await this.cacheManager["feishuUserAccessTokenCache"].get(obj.open_id);
}
//缓存中存在 直接返回
if(resData && resData.access_token){
return system.getResultSuccess(resData);
}
if(!obj.code){
return system.getResultFail("code参数不能为空");
}
if(!obj.app_access_token){
return system.getResultFail("app_access_token参数不能为空");
}
var url = "https://open.feishu.cn/open-apis/mina/v2/tokenLoginValidate";
var fsObj={
token:obj.app_access_token,//应用的 app_access_token,必须与请求身份验证中的应用保持一致
code:obj.code //来自请求身份验证(新)流程,用户扫码登录后会自动302到redirect_uri并带上此参数
};
var rtn = await this.execClient.execFeishuPost(fsObj, url);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var result = JSON.parse(rtn.stdout);
if(result.code==0 && result.data){
//缓存AppAccessToken
await this.cacheManager["feishuUserAccessTokenCache"].set(result.data,result.data.open_id);
return system.getResultSuccess(result.data);
}
return system.getResult(null, "获取飞书登录用户身份失败");
}
//------------------------飞书小程序开发------结束---------------------------------------------------------
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
}
//用户登录/获取userpin
async checkAndLogin(pobj){
// return system.getResultSuccess(null,"测试");
try {
if(!pobj.code){
return system.getResultFail(-100, "code参数不能为空");
}
//获取 app_access_token(应用商店应用)
var appAccessTokenRes = await this.getAppAccessToken();
if(appAccessTokenRes.status!=0){
return appAccessTokenRes;
}
var app_access_token = appAccessTokenRes.data;
//获取飞书登录用户身份
var userAccessTokenParams = {
"code":pobj.code,"app_access_token":app_access_token,"open_id":pobj.open_id || ""
};
// var userAccessTokenRes = await this.getUserAccessToken(userAccessTokenParams);
var userAccessTokenRes = await this.tokenLoginValidate(userAccessTokenParams);
if(userAccessTokenRes.status!=0){
return userAccessTokenRes;
}
var userAccessTokenObj = userAccessTokenRes.data;
//帐号登录---若用户信息已存在 则返回userpin 不存在则返回空
var loginByUserNameParams={
"appInfo":pobj.appInfo,
"actionType": "getLoginByUserName",
"actionBody": {
"openId":userAccessTokenObj.open_id,
"channelUserId":userAccessTokenObj.open_id,// Y 渠道用户ID
}
};
var loginByUserNameRes = await this.getLoginByUserName(loginByUserNameParams);
if(loginByUserNameRes && loginByUserNameRes.status==0){
loginByUserNameRes.data.open_id = userAccessTokenObj.open_id;
return loginByUserNameRes;//获取userpin直接返回
}
// // 获取飞书用户信息
// var userInfoParams={
// user_access_token:userAccessTokenObj.access_token
// };
// var userInfoRes = await this.utilsFeishuSve.getUserInfo(userInfoParams);
// if(userInfoRes.status!=0){
// return userInfoRes;
// }
// var userInfoObj = userInfoRes.data;
} catch (e) {
return system.getResultFail(-200,e.stack);
}
return system.getResultFail(-100,"获取userpin失败");
}
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户------>供后端调用
async getLoginByUserName(pobj){
pobj.actionBody.userpin = this.getUUID();
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody);
if (tmpOpResult.status != 0 && tmpOpResult.status != 2060) {
return tmpOpResult;
}
var opResult = system.getResultSuccess({ userpin: pobj.actionBody.userpin });
if (tmpOpResult.status == 2060) {
opResult.msg = tmpOpResult.msg;
opResult.data.userpin = tmpOpResult.data.userpin;
}
return opResult;
}
} }
module.exports = UtilsFeishuService; module.exports = UtilsFeishuService;
// var task = new UtilsFeishuService(); // var task = new UtilsFeishuService();
// task.resendAppTicket().then(res=>{ // var pobj = {
// console.log(res,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); // "appInfo":{
// "id":17,
// "app_hosts":"gsbweb.qifu.gongsibao.com",
// "app_code":"gsbweb",
// "app_name":"公司宝官网web应用",
// "uapp_id":"22",
// "uapp_key":"201912141625",
// "uapp_secret":"8cbb846776874167b5c7e01cd0116c66",
// "contact_name":"宋毅",
// "contact_mobile":"15010929366",
// "contact_email":null,
// "is_enabled":1,
// "is_sign":0,
// "pay_type":"10",
// "delivery_type":"10",
// "created_at":"2020-03-11T22:13:48.000Z",
// "version":0,
// "token":"4ea34fccd85b442da189d0086849c0e2"
// },
// "actionType": "getLoginByUserName",
// "actionBody": {
// "openId":"ou_ed97ab357af62082e54c972051888229",
// "channelUserId":"ou_ed97ab357af62082e54c972051888229",
// "channelUserName":"庄冰",
// "nickName":"庄冰"
// }
// };
// task.getLoginByUserName(pobj).then(res=>{
// console.log(res,"ddddddddddddddddddddddddddddddd");
// }) // })
...@@ -7,6 +7,8 @@ class ExecClient { ...@@ -7,6 +7,8 @@ class ExecClient {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"; this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'"; this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"; this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
this.cmdFeishuGetPattern = "curl -X GET -k -H 'Content-Type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url} ";
this.cmdFeishuPostPattern = "curl -k -H 'Content-type: application/json' -H 'Authorization: {Authorization}' -d '{data}' {url}";
} }
getUUID() { getUUID() {
...@@ -33,6 +35,13 @@ class ExecClient { ...@@ -33,6 +35,13 @@ class ExecClient {
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
FetchFeishuPostCmd(subData, url) {
var data = JSON.stringify(subData);
var cmd = this.cmdFeishuPostPattern.replace(/\{data\}/g,
data).replace(/\{url\}/g, url).replace(/\{Authorization\}/g, "Bearer "+subData.token);
console.log(cmd);
return cmd;
}
FetchPushDataPostCmd(subData, url, token, requestId) { FetchPushDataPostCmd(subData, url, token, requestId) {
var requestId = requestId || this.getUUID(); var requestId = requestId || this.getUUID();
var data = JSON.stringify(subData); var data = JSON.stringify(subData);
...@@ -46,6 +55,11 @@ class ExecClient { ...@@ -46,6 +55,11 @@ class ExecClient {
var result = await this.exec(cmd); var result = await this.exec(cmd);
return result; return result;
} }
async execFeishuPost(subData, url) {
let cmd = this.FetchFeishuPostCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
async execPushDataPost(subData, url, token, requestId) { async execPushDataPost(subData, url, token, requestId) {
let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId); let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId);
var result = await this.exec(cmd); var result = await this.exec(cmd);
...@@ -63,7 +77,19 @@ class ExecClient { ...@@ -63,7 +77,19 @@ class ExecClient {
console.log(cmd); console.log(cmd);
return cmd; return cmd;
} }
//飞书小程序GET请求
FetchFeishuGetCmd(subData, url) {
var cmd = this.cmdFeishuGetPattern.replace(
/\{data\}/g, subData).replace(/\{url\}/g, url).replace(/\{Authorization\}/g, "Bearer "+subData.user_access_token);
console.log(cmd);
return cmd;
}
async execFeishuGet(subData, url) {
let cmd = this.FetchFeishuGetCmd(subData, url);
console.log(cmd);
var result = await this.exec(cmd);
return result;
}
async execGet(subData, url) { async execGet(subData, url) {
let cmd = this.FetchGetCmd(subData, url); let cmd = this.FetchGetCmd(subData, url);
console.log(cmd); console.log(cmd);
......
...@@ -6,8 +6,8 @@ class OSSClient { ...@@ -6,8 +6,8 @@ class OSSClient {
constructor() { constructor() {
this.client = new OSS({ this.client = new OSS({
endpoint: 'https://oss-cn-beijing.aliyuncs.com', endpoint: 'https://oss-cn-beijing.aliyuncs.com',
accessKeyId: 'LTAIyAUK8AD04P5S', accessKeyId: 'LTAI4GC5tSKvqsH2hMqj6pvd',
accessKeySecret: 'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla' accessKeySecret: '3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5'
}); });
this.client.useBucket('gsb-zc'); this.client.useBucket('gsb-zc');
} }
......
...@@ -4,7 +4,6 @@ const utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve"); ...@@ -4,7 +4,6 @@ const utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
const logCtl = system.getObject("service.common.oplogSve"); const logCtl = system.getObject("service.common.oplogSve");
const utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); const utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
const utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve"); const utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
module.exports = function (app) { module.exports = function (app) {
//-----------------------新的模式---------web---------开始 //-----------------------新的模式---------web---------开始
...@@ -349,6 +348,44 @@ module.exports = function (app) { ...@@ -349,6 +348,44 @@ 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 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 utilsFeishuSve.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(pobj) + "回调结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
var returnObj = JSON.stringify(result);
return res.end(returnObj);
} catch (error) {
logCtl.error({
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) + "error:" + error.stack,
clientIp: client_ip || ""
});
}
});
//----------------------飞书小程序---------------------------------------------结束 //----------------------飞书小程序---------------------------------------------结束
}; };
...@@ -273,7 +273,9 @@ ...@@ -273,7 +273,9 @@
#### 渠道执行的类型 actionType:getOssConfig #### 渠道执行的类型 actionType:getOssConfig
``` javascript ``` javascript
{} {
"bucket":"gsb-zc"// N 桶的名称
}
``` ```
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
1. [按照手机号和验证码修改密码](#putUserPwdByMobile) 1. [按照手机号和验证码修改密码](#putUserPwdByMobile)
1. [获取用户登录信息](#getLoginInfo) 1. [获取用户登录信息](#getLoginInfo)
1. [退出](#logout) 1. [退出](#logout)
1. [飞书登录](#feishuLogin)
## **<a name="smsCode"> 短信验证码</a>** ## **<a name="smsCode"> 短信验证码</a>**
[返回到目录](#menu) [返回到目录](#menu)
...@@ -253,3 +253,29 @@ ...@@ -253,3 +253,29 @@
} }
``` ```
## **<a name="feishuLogin"> 飞书登录</a>**
[返回到目录](#menu)
##### URL
[http://feishu.qifu.gongsibao.com:4012/feishu/login?code={code}&state={state}&open_id={open_id}]
#### HTTP请求方式 `GET`
``` javascript
请求参数说明 :
code:用户飞书登录预授权码 必填
state:前端获取的token信息 必填
open_id:用户openid 非必填
```
#### 返回结果
``` javascript
{
"status":0,
"msg":"success",
"data":{
"userpin":"1508e7f73efd49cda8d2bc7d2552b09b"
}
}
```
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