text: /**
   * 数据操作记录
   *
   * @format
   */
  
  module.exports = (app) => {
     const mongoose = app.mongoose;
     var shortid = require("shortid");
     var Schema = mongoose.Schema;
     var CryptoJS = require("crypto-js");
  
     var SystemConfigSchema = new Schema({
        _id: {
           type: String,
  
           default: shortid.generate,
        },
        date: {
           type: Date,
           default: Date.now,
        },
        siteName: {
           type: String,
           default: "LioncMS",
        },
        ogTitle: {
           type: String,
           default: "",
        },
        siteLogo: {
           type: String,
           default: "/static/themes/dorawhite/images/logo.png",
        }, // 站点logo
  
        siteDomain: {
           type: String,
           default: "https://www.html-js.cn",
        },
        cdn: {
           //cdn域名
           type: String,
           default: "",
        },
        /**
         * 下载缓冲图片
         */
        loadImage: {
           type: String,
           default: "/images/ph.png",
        }, // 站点logo
        /**
         * 默认图片
         */
        defaultImage: {
           type: String,
           default: "/images/ph.png",
        }, // 站点logo
        adminPath: {
           //管理后台域名
           type: String,
           default: "admin",
        },
        siteDiscription: {
           type: String,
           default: "前端开发",
        },
        siteKeywords: String,
        siteAltKeywords: String, // 标签内的alt关键字
        siteEmailServer: String,
        siteEmail: String,
        siteEmailPwd: {
           type: String,
           set(data) {
              return CryptoJS.AES.encrypt(data, app.config.encrypt_key).toString();
           },
        },
        registrationNo: {
           type: String,
           default: "",
        },
        /** 是否开放用户注册 */
        openUserRegister: {
           type: Boolean,
           default: false,
        },
        /** 是否开放用户登录 */
        openUserLogin: {
           type: Boolean,
           default: false,
        },
        mongodbInstallPath: String,
        databackForderPath: String,
        showImgCode: {
           type: Boolean,
           default: false,
        }, // 是否显示验证码
        bakDatabyTime: {
           type: Boolean,
           default: false,
        }, // 是否自动备份数据
        bakDataRate: {
           type: String,
           default: "1",
        }, // 数据备份频率
        statisticalCode: {
           type: String,
           default: "",
        }, // 百度统计链接
     });
     SystemConfigSchema.path("adminPath").get(function (v) {
        v = String(v).trim();
        if (/^\/?manage$/.test(v)) v = "/admin";
        return !v || v == "undefind" || v == "null" ? "/admin" : ("/" + v).replace(/[\/]{2,}/g, "/");
     });
     SystemConfigSchema.path("loadImage").get(function (v) {
        return v || "/images/ph.png";
     });
     SystemConfigSchema.path("defaultImage").get(function (v) {
        return v || "/images/ph.png";
     });
     return mongoose.model("SystemConfig", SystemConfigSchema, "systemconfigs");
  };
  