degrade.js 1.51 KB
'use strict';

import Model from './model';
import _ from 'lodash';

const defaultDegrades = [
    {
        path: '/pc/common/myYohoHover',
        name: '【公共头部】MY有货鼠标移入显示账户信息'
    },
    {
        path: '/pc/common/cartCountShow',
        name: '【公共头部】购物车图标显示购物车商品数目'
    },
    {
        path: '/pc/common/cartHover',
        name: '【公共头部】购物车图标鼠标移入请求、显示购物车商品列表'
    },
    {
        path: '/pc/brandInfoTipSHow',
        name: '【品牌一览】品牌名移入显示品牌简介Tip'
    },
    {
        path: '/pc/recentViewShow',
        name: '【商品列表/商品详情】显示最近浏览'
    },
    {
        path: '/pc/guang/hotTagShow',
        name: '【逛】显示热门标签'
    },
    {
        path: '/pc/guang/adShow',
        name: '【逛】显示广告banner'
    },
    {
        path: '/pc/guang/itemCommentShow',
        name: '【逛】详情页显示评论'
    },
    {
        path: '/wap/plustar/collect',
        name: '【Plustar】品牌收藏'
    }
];

class Degrade extends Model {

    constructor() {
        super('degrade');
    }

    async init() {
        for (let i of defaultDegrades) {
            let count = await this.count({
                path: i.path
            });

            if (count === 0) {
                await this.insert(i);
            }
        }
    }
}

export default Degrade;