degrade.js 4.81 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: '【移除】购物车>>> 凑单商品'
    },
    {
        path: '/pc/clientService/new',
        name: '【开关】开启新客服系统'
    },
    {
        path: '/pc/qcloud_cdn',
        name: '【开关】启动腾讯云备份CDN'
    },
    {
        path: '/pc/user/removeStudentIdentification',
        name: '【移除】学生认证开关'
    },
    {
        path: '/pc/sys/noLimiter',
        name: '【开关】关闭请求限制'
    },
    {
        path: '/pc/pay/oldCart',
        name: '【开关】开启老版购物车'
    },
    {
        path: '/pc/geetest/validation',
        name: '【开关】关闭极验证验证码'
    },
    {
        path: '/pc/pay/newPay',
        name: '【开关】开启新版支付'
    },
    {
        path: '/pc/open/bughd',
        name: '【开关】打开JS错误收集功能'
    },
    {
        path: '/pc/ci/tdk',
        name: '【开关】打开TDK'
    },
    {
        path: '/pc/password/alwaysNeedCaptcha',
        name: '【开关】密码登录总是需要验证码'
    },
    {
        path: '/pc/login/closePasswordLogin',
        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: '【移除】购物车>>> 为您优选新品'
    },
    {
        path: '/wap/clientService/new',
        name: '【开关】开启新客服系统'
    },
    {
        path: '/wap/qcloud_cdn',
        name: '【开关】启动腾讯云备份CDN'
    },
    {
        path: '/wap/user/removeStudentIdentification',
        name: '【移除】学生认证开关'
    },
    {
        path: '/wap/sys/noLimiter',
        name: '【开关】关闭请求限制'
    },
    {
        path: '/wap/geetest/validation',
        name: '【开关】关闭极验证验证码'
    },
    {
        path: '/wap/close/passwordLogin',
        name: '【开关】关闭账号密码登录'
    },
    {
        path: '/wap/close/loginValidation',
        name: '【开关】关闭登录验证码'
    },
    {
        path: '/wap/close/firstLoginShowCaptcha',
        name: '【开关】账号密码首次登录无需图形验证码'
    },
    {
        path: '/wap/open/bughd',
        name: '【开关】打开JS错误收集功能'
    },
    {
        path: '/wap/close/buyNowButton',
        name: '【开关】关闭立即购买功能'
    },
    {
        path: '/wap/ci/tdk',
        name: '【开关】打开TDK'
    }
];

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;