MCPcopy Create free account
hub / github.com/develop202/migu_video / channelCache

Function channelCache

utils/appUtils.js:168–209  ·  view source on GitHub ↗
(pid, params)

Source from the content-addressed store, hash-verified

166}
167
168function channelCache(pid, params) {
169 let cache = {
170 haveCache: false,
171 code: 200,
172 pID: "",
173 playURL: "",
174 cacheDesc: ""
175 }
176 if (typeof urlCache[pid] === "object") {
177 const valTime = urlCache[pid].valTime - Date.now()
178 // 缓存是否有效
179 if (valTime >= 0) {
180 cache.haveCache = true
181 let playURL = urlCache[pid].url
182 let msg = "节目调整,暂不提供服务"
183 if (urlCache[pid].content != null) {
184 printLoginInfo(urlCache[pid])
185 msg = urlCache[pid].content.message
186 }
187 // 节目调整
188 if (playURL == "") {
189 cache.cacheDesc = `${pid} ${msg}`
190 return cache
191 }
192
193 // 添加回放参数
194 if (params != "") {
195 const resultParams = new URLSearchParams(params);
196 for (const [key, value] of resultParams) {
197 playURL = `${playURL}&${key}=${value}`
198 }
199 }
200 printGreen("使用缓存数据")
201 cache.code = 302
202 cache.cacheDesc = "缓存获取成功"
203 cache.playURL = playURL
204 return cache
205 }
206 }
207 cache.cacheDesc = "暂无缓存"
208 return cache
209}
210
211export { interfaceStr, channel, channelCache }

Callers 1

channelFunction · 0.85

Calls 2

printLoginInfoFunction · 0.90
printGreenFunction · 0.90

Tested by

no test coverage detected