Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
2ddb4e08
Commit
2ddb4e08
authored
May 13, 2020
by
王栋源
Browse files
Options
Browse Files
Download
Plain Diff
wdy
parents
3d271e9e
ad57b81f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
291 additions
and
99 deletions
+291
-99
center-channel/app/base/api/impl/action/tmTools.js
+4
-4
center-channel/app/base/db/cache/feishuAppAccessTokenCache.js
+5
-2
center-channel/app/base/db/cache/feishuAppTicketCache.js
+2
-2
center-channel/app/base/db/cache/feishuUserAccessTokenCache.js
+11
-1
center-channel/app/base/service/impl/common/centerorderSve.js
+3
-3
center-channel/app/base/service/impl/common/feishuLoginSve.js
+0
-47
center-channel/app/base/service/impl/trademark/toolSve.js
+10
-29
center-channel/app/base/service/impl/utilsSve/utilsFeishuSve.js
+158
-4
center-channel/app/base/utils/execClient.js
+28
-2
center-channel/app/base/utils/ossClient.js
+2
-2
center-channel/app/config/routes/api.js
+38
-1
center-channel/app/front/entry/public/apidoc/platform/tmOrder.md
+3
-1
center-channel/app/front/entry/public/apidoc/platform/user.md
+27
-1
No files found.
center-channel/app/base/api/impl/action/tmTools.js
View file @
2ddb4e08
...
...
@@ -18,10 +18,10 @@ class TmToolsAPI extends WEBBase {
if
(
!
pobj
.
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
;
}
async
opActionProcess
(
action_process
,
action_type
,
action_body
,
req
)
{
async
opActionProcess
(
pobj
,
action_type
,
action_body
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
// sy
...
...
@@ -34,8 +34,8 @@ class TmToolsAPI extends WEBBase {
case
"decryptStr"
:
//
opResult
=
await
this
.
toolSve
.
decryptStr
(
req
.
app
,
action_body
.
opStr
);
break
;
case
"getOssConfig"
:
//
opResult
=
await
this
.
toolSve
.
getOssConfig
();
case
"getOssConfig"
:
//
获取oss信息
opResult
=
await
this
.
toolSve
.
getOssConfig
(
pobj
);
break
;
case
"getNcl"
:
//尼斯查询(一)
opResult
=
await
this
.
toolSve
.
getNcl
(
action_body
,
req
);
...
...
center-channel/app/base/db/cache/feishuAppAccessTokenCache.js
View file @
2ddb4e08
...
...
@@ -21,10 +21,13 @@ class feishuAppAccessTokenCache extends CacheBase{
var
result
=
await
this
.
redisClient
.
get
(
key
);
return
result
;
}
async
set
(
accessToken
){
async
set
(
accessToken
,
expire
){
if
(
!
expire
){
expire
=
7100
;
}
var
key
=
this
.
prefix
;
if
(
accessToken
){
await
this
.
redisClient
.
setWithEx
(
key
,
accessToken
,
7100
);
await
this
.
redisClient
.
setWithEx
(
key
,
accessToken
,
expire
);
}
return
accessToken
;
}
...
...
center-channel/app/base/db/cache/feishuAppTicketCache.js
View file @
2ddb4e08
...
...
@@ -2,7 +2,7 @@ const CacheBase=require("../cache.base");
const
system
=
require
(
"../../system"
);
// const OpenplatformWxop = require("../../wxop/impl/openplatformWxop");
/**
* 飞书小程序--AppTicket缓存--有效时间
71
00s
* 飞书小程序--AppTicket缓存--有效时间
36
00s
*/
class
feishuAppTicketCache
extends
CacheBase
{
constructor
(){
...
...
@@ -24,7 +24,7 @@ class feishuAppTicketCache extends CacheBase{
async
set
(
appTicket
){
var
key
=
this
.
prefix
;
if
(
appTicket
){
await
this
.
redisClient
.
setWithEx
(
key
,
appTicket
,
71
00
);
await
this
.
redisClient
.
setWithEx
(
key
,
appTicket
,
36
00
);
}
return
appTicket
;
}
...
...
center-channel/app/base/db/cache/feishuUserAccessTokenCache.js
View file @
2ddb4e08
...
...
@@ -29,10 +29,20 @@ class feishuUserAccessTokenCache extends CacheBase{
return
null
;
}
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
;
if
(
obj
&&
obj
.
access_token
){
var
stringobj
=
JSON
.
stringify
(
obj
);
await
this
.
redisClient
.
setWithEx
(
key
,
stringobj
,
7100
);
await
this
.
redisClient
.
setWithEx
(
key
,
stringobj
,
expire
);
return
obj
;
}
return
null
;
...
...
center-channel/app/base/service/impl/common/centerorderSve.js
View file @
2ddb4e08
...
...
@@ -406,7 +406,7 @@ class CenterorderService extends AppServiceBase {
//--------------------------阿里ICP---end--------------------------------------------------------
//LOGO场景接口服务
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
;
if
(
!
obj
.
title
){
return
system
.
getResult
(
null
,
"品牌名称不能为空"
);
...
...
@@ -425,7 +425,7 @@ class CenterorderService extends AppServiceBase {
}
//换一批logo
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
;
if
(
!
obj
.
title
){
return
system
.
getResult
(
null
,
"品牌名称不能为空"
);
...
...
@@ -447,7 +447,7 @@ class CenterorderService extends AppServiceBase {
}
//生成logo
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
;
if
(
!
obj
.
title
){
return
system
.
getResult
(
null
,
"品牌名称不能为空"
);
...
...
center-channel/app/base/service/impl/common/feishuLoginSve.js
deleted
100644 → 0
View file @
3d271e9e
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
center-channel/app/base/service/impl/trademark/toolSve.js
View file @
2ddb4e08
const
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
crypto
=
require
(
'crypto'
);
const
cryptoJS
=
require
(
"crypto-js"
);
var
fs
=
require
(
"fs"
);
var
accesskey
=
'DHmRtFlw2Zr3KaRwUFeiu7FWATnmla'
;
var
accessKeyId
=
'LTAIyAUK8AD04P5S'
;
var
url
=
"https://gsb-zc.oss-cn-beijing.aliyuncs.com"
;
class
ToolService
{
class
ToolService
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
zcApiUrl
=
settings
.
reqZcApi
();
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
//
this.execClient = system.getObject("util.execClient");
}
async
getCropperPic
(
obj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/tool/toolApi/getCropperPic"
;
...
...
@@ -79,29 +78,11 @@ class ToolService {
return
data
;
}
async
getOssConfig
(
queryobj
,
req
)
{
var
policyText
=
{
"expiration"
:
"2119-12-31T16:00:00.000Z"
,
"conditions"
:
[
[
"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
getOssConfig
(
pobj
,
req
)
{
//获取oss信息
var
reqUrl
=
settings
.
centerAppUrl
()
+
"auth/accessAuth/getOssInfo"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
//加密信息
async
encryptStr
(
app
,
opStr
)
{
if
(
!
opStr
)
{
...
...
center-channel/app/base/service/impl/utilsSve/utilsFeishuSve.js
View file @
2ddb4e08
const
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
uuidv4
=
require
(
'uuid/v4'
);
// var crypto = require('crypto');
/**
* 飞书小程序相关接口
*/
...
...
@@ -7,11 +9,19 @@ class UtilsFeishuService{
constructor
()
{
this
.
execClient
=
system
.
getObject
(
"util.execClient"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
utilsAuthSve
=
system
.
getObject
(
"service.utilsSve.utilsAuthSve"
);
this
.
appConfig
=
{
app_id
:
"cli_9e28dcb1d637100d"
,
app_secret
:
"zL1uRrWFzwhFbLWZrmSuCh72JGjJXQg0"
}
};
//飞书事件消息通知解密
// async notifyDecrypt(str){
// var pobj = {};
// str = str.toString('utf8');
// return pobj;
// }
//飞书通知
async
notify
(
pobj
){
if
(
!
pobj
||
!
pobj
.
type
){
...
...
@@ -91,11 +101,14 @@ class UtilsFeishuService{
var
result
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
result
.
code
==
0
&&
result
.
app_access_token
){
//缓存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
.
getResultFail
(
"获取appAccessToken失败"
);
}
//------------------------飞书网页开发---------------------------------------------------------------
//获取登录用户身份
async
getUserAccessToken
(
obj
){
var
resData
=
{};
...
...
@@ -140,7 +153,7 @@ class UtilsFeishuService{
var
obj
=
{
user_access_token
:
pobj
.
user_access_token
};
var
rtn
=
await
this
.
execClient
.
execGet
(
obj
,
url
);
var
rtn
=
await
this
.
execClient
.
exec
Feishu
Get
(
obj
,
url
);
if
(
!
rtn
||
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"execPost data is empty"
);
}
...
...
@@ -150,10 +163,151 @@ class UtilsFeishuService{
}
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
;
// var task = new UtilsFeishuService();
// task.resendAppTicket().then(res=>{
// console.log(res,"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
// var pobj = {
// "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");
// })
center-channel/app/base/utils/execClient.js
View file @
2ddb4e08
...
...
@@ -7,7 +7,9 @@ class ExecClient {
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {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
.
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
()
{
var
uuid
=
uuidv4
();
...
...
@@ -33,6 +35,13 @@ class ExecClient {
console
.
log
(
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
)
{
var
requestId
=
requestId
||
this
.
getUUID
();
var
data
=
JSON
.
stringify
(
subData
);
...
...
@@ -46,6 +55,11 @@ class ExecClient {
var
result
=
await
this
.
exec
(
cmd
);
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
)
{
let
cmd
=
this
.
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
);
var
result
=
await
this
.
exec
(
cmd
);
...
...
@@ -63,7 +77,19 @@ class ExecClient {
console
.
log
(
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
)
{
let
cmd
=
this
.
FetchGetCmd
(
subData
,
url
);
console
.
log
(
cmd
);
...
...
center-channel/app/base/utils/ossClient.js
View file @
2ddb4e08
...
...
@@ -6,8 +6,8 @@ class OSSClient {
constructor
()
{
this
.
client
=
new
OSS
({
endpoint
:
'https://oss-cn-beijing.aliyuncs.com'
,
accessKeyId
:
'LTAI
yAUK8AD04P5S
'
,
accessKeySecret
:
'
DHmRtFlw2Zr3KaRwUFeiu7FWATnmla
'
accessKeyId
:
'LTAI
4GC5tSKvqsH2hMqj6pvd
'
,
accessKeySecret
:
'
3KV9nIwW8qkTGlrPmAe3HnR3fzM6r5
'
});
this
.
client
.
useBucket
(
'gsb-zc'
);
}
...
...
center-channel/app/config/routes/api.js
View file @
2ddb4e08
...
...
@@ -4,7 +4,6 @@ const utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
utilsOrderSve
=
system
.
getObject
(
"service.utilsSve.utilsOrderSve"
);
const
utilsFeishuSve
=
system
.
getObject
(
"service.utilsSve.utilsFeishuSve"
);
module
.
exports
=
function
(
app
)
{
//-----------------------新的模式---------web---------开始
...
...
@@ -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
||
""
});
}
});
//----------------------飞书小程序---------------------------------------------结束
};
center-channel/app/front/entry/public/apidoc/platform/tmOrder.md
View file @
2ddb4e08
...
...
@@ -273,7 +273,9 @@
#### 渠道执行的类型 actionType:getOssConfig
```
javascript
{}
{
"bucket"
:
"gsb-zc"
// N 桶的名称
}
```
...
...
center-channel/app/front/entry/public/apidoc/platform/user.md
View file @
2ddb4e08
...
...
@@ -6,7 +6,7 @@
1.
[
按照手机号和验证码修改密码
](
#putUserPwdByMobile
)
1.
[
获取用户登录信息
](
#getLoginInfo
)
1.
[
退出
](
#logout
)
1.
[
飞书登录
](
#feishuLogin
)
## **<a name="smsCode"> 短信验证码</a>**
[
返回到目录
](
#menu
)
...
...
@@ -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"
}
}
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment