const dayjs = require("dayjs"); const db = require("../../middleware/db"); const Sequelize = require("sequelize"); module.exports = sys_project_config = db.define("sys_project_config", { project_id: { comment: "项目id", type: Sequelize.INTEGER(11), allowNull: false, defaultValue: "0", }, config_env_type: { comment: "环境类型", type: Sequelize.INTEGER(2), allowNull: false, defaultValue: "0", }, db: { comment: "db配置", type: Sequelize.JSON, allowNull: false, set(value) { this.setDataValue("db", { value }); }, get() { let jsonValue = this.getDataValue("db"); if (jsonValue && jsonValue.value !== undefined) { return jsonValue.value; } else { return jsonValue; } }, defaultValue: { username: "", password: "", database: "", host: "", port: 3306, dialect: "mysql", }, }, aliyun: { comment: "阿里云配置", type: Sequelize.JSON, allowNull: false, set(value) { this.setDataValue("aliyun", { value }); }, get() { let jsonValue = this.getDataValue("aliyun"); if (jsonValue && jsonValue.value !== undefined) { return jsonValue.value; } else { return jsonValue; } }, defaultValue: { accessKeyId: "", accessKeySecret: "", ossUrl: "", }, }, redis: { comment: "redis配置", type: Sequelize.JSON, allowNull: false, set(value) { this.setDataValue("redis", { value }); }, get() { let jsonValue = this.getDataValue("redis"); if (jsonValue && jsonValue.value !== undefined) { return jsonValue.value; } else { return jsonValue; } }, defaultValue: { host: "", port: "", pwd: "", opt: {}, }, }, file: { comment: "文件配置", type: Sequelize.JSON, allowNull: false, set(value) { this.setDataValue("file", { value }); }, get() { let jsonValue = this.getDataValue("file"); if (jsonValue && jsonValue.value !== undefined) { return jsonValue.value; } else { return jsonValue; } }, defaultValue: { vue: { api: "../../admin/src/api/", view: "../../admin/src/view/", }, node: { controller: "../controller_admin/", model: "../model/", }, }, }, wechat: { comment: "微信配置", type: Sequelize.JSON, allowNull: false, set(value) { this.setDataValue("wechat", { value }); }, get() { let jsonValue = this.getDataValue("wechat"); if (jsonValue && jsonValue.value !== undefined) { return jsonValue.value; } else { return jsonValue; } }, defaultValue: { appid: "", secret: "", mch_id: "", partner_key: "", partnerV3_key: "", notify_url: "", refund_notify_url: "", }, }, }); // sys_project_config.sync({ force: true });