degrade.js 2.58 KB
'use strict';

const Model = require('./model');
const _ = require('lodash');

const defaultDegrades = [
    {
        path: '/pc/common/disMyYohoHover',
        name: '【禁止】公共头部>>> MY有货鼠标移入显示账户信息'
    },
    {
        path: '/pc/common/removeCartCount',
        name: '【移除】公共头部>>> 购物车图标显示的购物车商品数目'
    },
    {
        path: '/pc/common/disSearchAssociation',
        name: '【禁止】公共头部>>> 搜索框执行搜索联想'
    },
    {
        path: '/pc/common/disCartHover',
        name: '【禁止】公共头部>>> 购物车图标鼠标移入请求且不显示购物车商品列表'
    },
    {
        path: '/pc/brands/disBrandNameHover',
        name: '【禁止】品牌一览>>> 品牌名移入显示品牌简介Tip'
    },
    {
        path: '/pc/product/removeRecentView',
        name: '【移除】商品列表/商品详情>>> 最近浏览'
    },
    {
        path: '/pc/guang/removeHotTag',
        name: '【移除】逛>>> 热门标签'
    },
    {
        path: '/pc/guang/removeAd',
        name: '【移除】逛>>> 广告banner'
    },
    {
        path: '/pc/guang/removeItemComment',
        name: '【移除】逛>>> 详情页评论'
    },
    {
        path: '/pc/cart/removeFavStatus',
        name: '【移除】购物车>>> 商品收藏状态'
    },
    {
        path: '/pc/cart/removePrefer',
        name: '【移除】购物车>>> 为您优选'
    },
    {
        path: '/pc/cart/removeMerge',
        name: '【移除】购物车>>> 凑单商品'
    },
    //wap
    {
        path: '/wap/plustar/removeCollect',
        name: '【移除】Plustar>>> 品牌收藏'
    },
    {
        path: '/wap/plustar/removeRelatedPost',
        name: '【移除】Plustar>>> 相关资讯'
    },
    {
        path: '/wap/search/removeHotSearch',
        name: '【移除】搜索>>> 热门搜索'
    },
    {
        path: '/wap/ucenter/removePrefer',
        name: '【移除】个人中心>>> 为您优选'
    },
    {
        path: '/wap/common/removeCartCount',
        name: '【移除】公共>>> 购物车icon商品数目'
    },
    {
        path: '/wap/cart/removePrefer',
        name: '【移除】购物车>>> 为您优选新品'
    }
];

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);
            }
        }
    }
}

module.exports = Degrade;