product_cache.js 628 Bytes
/**
 *
 * @author: chenfeng<feng.chen@yoho.cn>
 * @date: 16/10/19
 */

'use strict';

import Router from 'koa-router';
import {
    ProductCache
} from '../../models'

const r = new Router();

const productCache = {
    async query(ctx) {
        await ctx.render('action/product_cache');
    },
    async clear(ctx) {
        let type = ctx.request.body.type;
        if (type) {
            ProductCache.removePriceCache([51068877, 51068893, 51117073])
        }
        return ctx.body = {
            code: 200
        };
    }
}

r.get('/query', productCache.query);
r.post('/clear', productCache.clear);

export default r;