function getTimestamp() {
return Date.parse(new Date()) / 1000;
};
if(!ctx.post.code){
throw new Error("参数code不存在");
}
const config = {
appid: "f4e8138a***********408667",
appkey: "873fc2c***********4b868c",
code: ctx.post.code,
timestamp: getTimestamp()
};
let code = config.code;
const res = await module.axios({
method: 'post',
url: 'https://baas.ooooooyun.com/class/public/function/JCZVehCode',
data: {
appid: config.appid,
appkey: config.appkey,
code: config.code,
timestamp: config.timestamp,
sign: module.md5(config.appid + config.appkey + code.substr(code.length - 10, 10) + config.timestamp)
}
}).catch(err => {
throw new Error("网络错误,请联系管理员");
});
let data=res.data
if(data.success==true){
await ctx.model("vehcode").forge({ mw: config.code, result: JSON.stringify(res.data) }).save();
ctx.body = data;
}else{
ctx.body = {success:false,message:data.message};
}
版权归属:
Administrator
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区