Commit 1b1e1a18 by 庄冰

ossconfig

parent 1b3beb78
...@@ -4,6 +4,7 @@ var settings = require("../../../../config/settings"); ...@@ -4,6 +4,7 @@ var settings = require("../../../../config/settings");
class feishuLoginService{ class feishuLoginService{
constructor() { constructor() {
this.utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve"); this.utilsFeishuSve = system.getObject("service.utilsSve.utilsFeishuSve");
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
}; };
//用户登录 //用户登录
async checkAndLogin(pobj){ async checkAndLogin(pobj){
...@@ -28,6 +29,18 @@ class feishuLoginService{ ...@@ -28,6 +29,18 @@ class feishuLoginService{
} }
var userAccessTokenObj = userAccessTokenRes.data; var userAccessTokenObj = userAccessTokenRes.data;
//帐号登录---若用户信息已存在 则返回userpin 不存在则返回空
var loginByUserNameParams={
"actionType": "getLoginByUserName",
"actionBody": {
"open_id":userAccessTokenObj.open_id
}
};
var loginByUserNameRes = await this.getLoginByUserName(loginByUserNameParams);
if(loginByUserNameRes && loginByUserNameRes.status==0){
return loginByUserNameRes;//获取userpin直接返回
}
//获取飞书用户信息 //获取飞书用户信息
var userInfoParams={ var userInfoParams={
user_access_token:userAccessTokenObj.access_token user_access_token:userAccessTokenObj.access_token
...@@ -40,7 +53,38 @@ class feishuLoginService{ ...@@ -40,7 +53,38 @@ class feishuLoginService{
var createUserParams = { var createUserParams = {
// uapp_id,channel_userid,channel_username,channel_nickname,open_id,he // uapp_id,channel_userid,channel_username,channel_nickname,open_id,he
}; };
loginByUserNameParams={
"actionType": "getLoginByUserName",
"actionBody": {
"open_id":userAccessTokenObj.open_id,
"channelUserId":userInfoObj.mobile,// Y 渠道用户ID
"channelUserName":userInfoObj.name,// N 渠道用户名
"mobile":userInfoObj.mobile, // N 渠道用户手机号
"nickName":userInfoObj.name, // N 用户昵称
"email":userInfoObj.eamil,//邮箱
"head_url":userInfoObj.avatar_url //头像
}
};
loginByUserNameRes = await this.getLoginByUserName(loginByUserNameParams);
if(loginByUserNameRes && loginByUserNameRes.status==0){
return loginByUserNameRes;//获取userpin直接返回
}
return system.getResultFail("获取userpin失败");
}
//渠道通过账户进行登录,有则返回用户信息,没有则创建用户------>供后端调用
async getLoginByUserName(pobj){
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody);
if (tmpOpResult.status != 0 && tmpOpResult.status != 2060) {
return tmpOpResult;
}
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 = feishuLoginService; module.exports = feishuLoginService;
\ No newline at end of file
...@@ -80,8 +80,23 @@ class ToolService { ...@@ -80,8 +80,23 @@ class ToolService {
} }
async getOssConfig(queryobj, req) { async getOssConfig(queryobj, req) {
var date = new Date();
var month = date.getMonth()+1;
month=month.toString();
if(month<10){
month="0"+month;
}
var day = date.getDate().toString();
if(day<10){
day="0"+day;
}
var time = date.getFullYear().toString()+month+day;
let timestamp = date.getTime();//当前的时间戳
timestamp = timestamp + 6 * 60 * 60 * 1000;
//格式化时间获取年月日
var dateAfter = new Date(timestamp);
var policyText = { var policyText = {
"expiration": "2119-12-31T16:00:00.000Z", "expiration": dateAfter,
"conditions": [ "conditions": [
["content-length-range", 0, 1048576000], ["content-length-range", 0, 1048576000],
["starts-with", "$key", "zc"] ["starts-with", "$key", "zc"]
......
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