Commit d065091a by 宋毅

tj

parent 8fd06d73
......@@ -53,7 +53,7 @@ class APIBase {
async doexec(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID();
try {
if (["getTokenByHosts", "receiveCallBackNotify", "getAppInfo", "getPayInfo"].indexOf(methodname) < 0) {
if (["getTokenByHosts", "receiveCallBackNotify", "getAppInfo", "getPayInfo", "test"].indexOf(methodname) < 0) {
if (!pobj.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !");
}
......
......@@ -22,5 +22,10 @@ class ChannelAccessAuthAPI extends APIBase {
var opResult = await this.utilsuserSve.getDingJsApiAuthentication(pobj);
return opResult;
}
async test(pobj, qobj, req) {
var opResult = await this.utilsuserSve.getJsApiSingnature("ticket", "nonce", "timeStamp", "http://alitm.qifu.gongsibao.com");
return system.getResultSuccess(opResult);
}
}
module.exports = ChannelAccessAuthAPI;
\ No newline at end of file
......@@ -72,7 +72,7 @@ class UtilsUserSve extends AppServiceBase {
timeStamp: timeStamp.toString(),
nonceStr: nonceStr.toUpperCase()
};
var signature = await this.getJsApiSingnature(ticketResult.data.ticket, parameters.nonceStr, parameters.timeStamp, nowPageUrl);
var signature = await this.getJsApiSingnature(pobj, ticketResult.data.ticket, parameters.nonceStr, parameters.timeStamp, nowPageUrl);
parameters.signature = signature;
return system.getResultSuccess(parameters);
}
......@@ -134,17 +134,18 @@ class UtilsUserSve extends AppServiceBase {
* @param {*} timeStamp
* @param {*} url
*/
async getJsApiSingnature(ticket, nonce, timeStamp, url) {//获取JsApi鉴权签名信息----本类中调用
async getJsApiSingnature(pobj, ticket, nonce, timeStamp, url) {//获取JsApi鉴权签名信息----本类中调用
let plainTex = "jsapi_ticket=" + ticket + "&noncestr=" + nonce + "&timestamp=" + timeStamp + "&url=" + url;
// var BufferList= new Buffer(plainTex).toString("base64");
this.logCtl.info({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
// op: "https://oapi.dingtalk.com/get_jsapi_ticket",
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
op: "center-app/app/base/service/impl/utilsSve/utilsuserSve.js/getJsApiSingnature",
content: "参数:" + plainTex,
optitle: "记录钉钉鉴权签名信息参数",
});
let signature = cryptoJS.SHA1(plainTex).toString();
let signature = cryptoJS.SHA1(plainTex).toString(cryptoJS.enc.Hex); //cryptoJS.SHA1(plainTex).toString();
return signature;
}
}
......
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