Commit d850fc68 authored by 高诸锋's avatar 高诸锋

fix

parent 9e426dc0
Pipeline #6340 passed with stage
in 3 seconds
......@@ -33,40 +33,12 @@ class PartnerService extends Service {
},
});
ctx.logger.info(`【Partner】 fetchTheme ${host + fetchTheme}/${appKey}`, ret.data);
if (ret.status === 200 && ret.data && ret.data.id === appKey) {
if (ret.status === 200 && ret.data && ret.data[0].appKey === appKey) {
await this.app.cache.set(redisThemePrefix + appKey, JSON.stringify(ret.data), 7200);
}
return ret.data;
}
async fetchScripts(appKey) {
const { ctx, partnerAPI: { fetchScripts, host, redisScriptsPrefix } } = this;
if (appKey) {
const data = await this.app.cache.get(redisScriptsPrefix + appKey);
if (data) {
try {
return JSON.parse(data);
} catch (err) {
ctx.logger.error('【Partner】 fetchScripts', redisScriptsPrefix + appKey, 'result:', JSON.stringify(data), err);
await this.app.cache.del(redisScriptsPrefix + appKey);
}
}
}
const url = `${host + fetchScripts}/${appKey}`;
const ret = await ctx.curl(url, {
charset: 'utf-8',
timeout: ['30s', '30s'],
dataType: 'json',
method: 'GET',
});
ctx.logger.info(`【Partner】 fetchTheme ${url}`, ret.data);
if (ret.status === 200 && ret.data && ret.data.id === appKey) {
await this.app.cache.set(redisScriptsPrefix + appKey, JSON.stringify(ret.data), 300);
}
return ret.data;
}
// 查询结束后回调通知合作方
// 对于状态已经是成功的订单号不会在做通知
// orderId/userId/status
......
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