cdn_cache.js
916 Bytes
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
38
39
40
41
42
43
/**
*
* @author: chenfeng<feng.chen@yoho.cn>
* @date: 16/10/19
*/
'use strict';
import Router from 'koa-router';
import {
CdnCache
} from '../../models'
const r = new Router();
const cdnCache = {
async query(ctx) {
let date = {
typeList: [{
name: '文件',
typeName: 'File',
}, {
name: '目录',
typeName: 'Directory',
}]
}
await ctx.render('action/cdn_cache', date);
},
async clear(ctx) {
let queryUris = ctx.request.body.query_uri;
let objectType = ctx.request.body.object_type;
if (queryUris.trim() && objectType) {
CdnCache.removeCache(queryUris, objectType);
}
return ctx.body = {
code: 200
};
}
}
r.get('/query', cdnCache.query);
r.post('/clear', cdnCache.clear);
export default r;