degrade.js 4.67 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/clientService/new',
        name: '【开关】开启新客服系统'
    },
    {
        path: '/pc/qcloud_cdn',
        name: '【开关】启动腾讯云备份CDN'
    },
    {
        path: '/pc/user/removeStudentIdentification',
        name: '【移除】学生认证开关'
    },
    {
        path: '/pc/sys/noLimiter',
        name: '【开关】关闭请求限制'
    },
    {
        path: '/pc/open/bughd',
        name: '【开关】打开JS错误收集功能'
    },
    {
        path: '/pc/ci/tdk',
        name: '【开关】打开TDK'
    },
    {
        path: '/pc/login/closePasswordLogin',
        name: '【开关】关闭账号密码登录'
    },
    {
        path: '/pc/close/risk',
        name: '【开关】关闭 风控中间件'
    },
    {
        path: '/pc/open/apmrisk',
        name: '【开关】启用 apm 风控中间件'
    },

    //wap
    {
        path: '/wap/webapp/degrade',
        name: '【开关】APP内嵌SSR页面是否降级'
    },
    {
        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: '【移除】购物车>>> 为您优选新品'
    },
    {
        path: '/wap/qcloud_cdn',
        name: '【开关】启动腾讯云备份CDN'
    },
    {
        path: '/wap/user/removeStudentIdentification',
        name: '【移除】学生认证开关'
    },
    {
        path: '/wap/sys/noLimiter',
        name: '【开关】关闭请求限制'
    },
    {
        path: '/wap/close/passwordLogin',
        name: '【开关】关闭账号密码登录'
    },
    {
        path: '/wap/open/bughd',
        name: '【开关】打开JS错误收集功能'
    },
    {
        path: '/wap/close/buyNowButton',
        name: '【开关】关闭立即购买功能'
    },
    {
        path: '/wap/ci/tdk',
        name: '【开关】打开TDK'
    },
    {
        path: '/wap/shop/removeCollect',
        name: '【移除】店铺品牌收藏'
    },
    {
        path: '/wap/wechat/miniPathOpen',
        name: '【开关】微信>>> 进入小程序弹框'
    },
    {
        path: '/wap/wechat/backDownload',
        name: '【开关】微信>>> 返回跳转下载页面'
    },
    {
        path: '/wap/close/usePwa',
        name: '【开关】关闭 PWA 模式'
    },
    {
        path: '/wap/close/risk',
        name: '【开关】关闭 风控中间件'
    },
    {
        path: '/wap/open/apmrisk',
        name: '【开关】启用 apm 风控中间件'
    },
];

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;