matchJson.js
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMatchJson = void 0;
/**
* Created by sunney on 7/3/17.
*/
const Model = require("../model");
const cache_1 = require("../../../cache");
async function getMatchJson({ type, match }) {
try {
let match_team_info_key = `${config.CachePrefix}match:match_json:v1_${match.Id}_${type}`;
let t = await cache_1.redis.get(match_team_info_key);
if (t && t.length > 0 && !match.isUpdateCache) {
return t;
}
else {
t = await Model.MatchJson.findOne({
where: {
Type: type,
LotteryId: match.LotteryId,
IssueName: match.IssueName,
MatchNumber: match.MatchNumber
}
});
cache_1.redis.set(match_team_info_key, t.Json);
cache_1.redis.expire(match_team_info_key, 60 * 60 * 24);
}
if (t == null)
return '{}';
return t.Json;
}
catch (e) {
return '{}';
}
}
exports.getMatchJson = getMatchJson;
//# sourceMappingURL=matchJson.js.map