CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_user` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `user_headimg` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '会员头像',
    `nick_name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '用户昵称',
    `name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '姓名',
    `password` CHAR(60) NOT NULL DEFAULT '' COMMENT '密码（哈希存储）',
    `sex` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别：0未知 1男 2女',
    `openid` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '用户openid',
    `unionid` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '用户unionid',
    `district` varchar(100) DEFAULT NULL COMMENT '区',
    `address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
    `birthday` varchar(30) NOT NULL DEFAULT '' COMMENT '生日',
    `phone` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '手机号',
    `qq` VARCHAR(20) NOT NULL DEFAULT '' COMMENT 'qq号',
    `wechat` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '微信号',
    `idcard` CHAR(18) NOT NULL DEFAULT '' COMMENT '身份证号',
    `platform` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '所属平台: 0微信|1百度|2支付宝|3字节跳动|4公众号|5手机站|6QQ|7企业微信|8Android|9IOS|10PC|15企微客户',
    `level_id` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '级别ID',
    `groupid` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '组别ID',
    `growth_value` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '成长值',
    `integral` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分',
    `is_main` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否主账号 0否 1是',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1启用',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_openid` (`mch_id`, `shop_id`, `openid`),
    KEY `idx_phone` (`phone`),
    KEY `idx_shop` (`mch_id`, `shop_id`),
    KEY `idx_status` (`status`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_user_visit_logs` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `user_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户id',
    `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商家用户id',
    `op_type` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '操作类型：1查看 2转发 3复制 4保存 5拨打 6浏览（商品）',
    `op_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '操作名字',
    `page_flag` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '页面标识',
    `page_param` TEXT NOT NULL COMMENT '页面参数',
    `stay_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '停留时间（秒）',
    `ip` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '用户IP',
    `action_type` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '动作类型：0新增用户 1启动小程序 2进入页面 3退出 4页面内操作',
    `platform` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '平台: 0微信 1百度 2支付宝 3字节跳动 4公众号 5手机站 6QQ',
    `share_log_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享记录id',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户访问日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_config` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `config_key` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '配置项key',
    `config_value` TEXT NOT NULL COMMENT '配置项value',
    `description` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '配置描述',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_shop_config` (`mch_id`, `shop_id`, `config_key`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商城配置表';

INSERT INTO `YB_TABLE_PREFIX_sys_config` VALUES (1, 'site_config', '{\"site_name\":\"壹佰云招商系统8.0\",\"copyright\":\"© 2026 壹佰网络 版权所有\",\"site_record\":\"icp备案号\",\"site_link\":\"icp备案链接\",\"ploice_site_record\":\"公安备案号\",\"ploice_site_link\":\"公安备案链接\",\"icon\":\"https://moban-1256746889.cos.ap-chengdu.myqcloud.com/app/image/system_logo_8.0.png\",\"site_fav_icon\":\"https://moban-1256746889.cos.ap-chengdu.myqcloud.com/app/image/system_logo_8.0.png\",\"login_image\":\"https://moban-1256746889.cos.ap-chengdu.myqcloud.com/app/image/admin_login_banner_system_8.0.png\",\"index_icon\":\"https://moban-1256746889.cos.ap-chengdu.myqcloud.com/app/image/index_icon_system_8.0.png\",\"copyright_logo\":\"\",\"copyright_type\":0,\"is_open_register\":0,\"login_type\":{\"password\":true,\"phone\":false,\"scan\":false},\"copyright_miniapp\":\"\"}', '站点设置', 0, 0, 1759058276, 1759060706, 0);
INSERT INTO `YB_TABLE_PREFIX_sys_config` (`id`, `config_key`, `config_value`, `description`, `mch_id`, `shop_id`, `create_time`, `update_time`, `delete_time`) VALUES (2, 'site_copyright_backend', '{\"type\":1,\"copyright_logo\":\"\",\"copyright_type\":2,\"copyright_miniapp\":\"壹佰云8.0\\n© 2026 壹佰网络 版权所有\",\"is_jump\":0,\"content\":\"\",\"is_alone\":1}', '后台版权', 0, 0, 1780308426, 1780308486, 0);

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_file_group` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `name` VARCHAR(100) NOT NULL COMMENT '相册名称',
    `cover` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '相册封面URL',
    `is_default` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否为默认相册 0否 1是',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 0隐藏 1显示',
    `sort` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序值',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_mch_shop_name` (`mch_id`, `shop_id`, `name`),
    KEY `idx_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='附件分类表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_file` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '文件ID',
    `group_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类ID',
    `filename` VARCHAR(255) NOT NULL COMMENT '文件名',
    `type` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '文件类型 0其它 1图片 2音频 3视频',
    `url` VARCHAR(500) NOT NULL COMMENT '文件访问路径',
    `filesize` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '文件大小(字节)',
    `mimetype` VARCHAR(100) NOT NULL DEFAULT '' COMMENT 'MIME类型',
    `storage` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '存储位置 1本地 2远程',
    `uid` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上传用户ID',
    `user_type` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '1后台用户 2小程序用户 3商家助手后台 4商家助手小程序',
    `user_name` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '上传者用户名',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_group` (`group_id`),
    KEY `idx_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='上传附件表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_admin` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `account` VARCHAR(100) NOT NULL COMMENT '登录账号',
    `password` VARCHAR(255) NOT NULL COMMENT '登录密码（建议加密存储）',
    `user_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '用户名称',
    `avatar` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '用户头像',
    `phone` CHAR(11) NOT NULL DEFAULT '' COMMENT '手机号',
    `wx_num` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '微信号',
    `qq_num` VARCHAR(20) NOT NULL DEFAULT '' COMMENT 'QQ号',
    `position` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '职位',
    `email` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '邮箱',
    `token` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '登录token',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '账号状态 1开启 0关闭',
    `admin_type` VARCHAR(50) NOT NULL DEFAULT 'admin' COMMENT '账号归属 super 超管 admin 管理员 staff 员工',
    `is_default` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否默认 0否 1是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_account` (`mch_id`, `shop_id`,`account`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`),
    KEY `idx_admin_type` (`admin_type`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_admin_group` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
    `pid` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID',
    `name` VARCHAR(100) NOT NULL COMMENT '权限组名称',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '用户组状态 1正常 0隐藏',
    `menu_ids` TEXT NOT NULL COMMENT '系统模块ID组',
    `group_type` VARCHAR(50) NOT NULL DEFAULT 'admin' COMMENT '角色归属 admin/系统等',
    `remark` VARCHAR(500) DEFAULT '' COMMENT '权限描述',
    `is_default` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否默认权限组 0否 1是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY `idx_pid` (`pid`),
    KEY `idx_shop` (`mch_id`, `shop_id`),
    KEY `idx_group_type` (`group_type`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统管理员角色表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_admin_group_relation` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
    `admin_id` BIGINT UNSIGNED NOT NULL COMMENT '管理员ID',
    `group_id` BIGINT UNSIGNED NOT NULL COMMENT '权限组ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_admin_group` (`admin_id`,`group_id`),
    KEY `idx_admin` (`admin_id`),
    KEY `idx_group` (`group_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员与角色关系表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_department` (
    `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `name` VARCHAR(100) NOT NULL COMMENT '部门名称',
    `pid` INT(11) NOT NULL DEFAULT 0 COMMENT '上级ID',
    `level` INT(11) NOT NULL DEFAULT 1 COMMENT '级别',
    `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序',
    `status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用：0-否，1-是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商家员工部门表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_department_admin_relate` (
    `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `admin_id` INT(11) NOT NULL COMMENT '员工ID',
    `department_id` INT(11) NOT NULL COMMENT '部门ID',
    `sort` INT(11) NOT NULL DEFAULT 0 COMMENT '部门内排序值，数值越大排序越前面',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工-部门关联表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_department_leader` (
    `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `department_id` INT(11) NOT NULL COMMENT '部门ID',
    `leader_id` INT(11) NOT NULL COMMENT '负责人ID',
    `leader_type` TINYINT(2) NOT NULL DEFAULT 1 COMMENT '负责人类型：1-主负责人，2-副负责人',
    `status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用：0-否，1-是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='部门负责人关联表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_admin_log` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
    `admin_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '管理员名称（冗余字段，便于查询）',
    `url` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '操作页面URL',
    `title` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '日志标题',
    `content` TEXT NOT NULL COMMENT '操作内容',
    `ip` VARCHAR(45) NOT NULL DEFAULT '' COMMENT 'IP地址（兼容IPv6）',
    `user_agent` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT 'User-Agent',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    PRIMARY KEY (`id`),
    KEY `idx_admin` (`admin_id`),
    KEY `idx_mch_shop_time` (`mch_id`, `shop_id`, `create_time`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='管理员操作日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_addons` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '插件ID',
    `name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件名称',
    `icon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '插件图标URL',
    `plugin_flag` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件标识（唯一）',
    `plugin_file` varchar(100) NOT NULL DEFAULT '' COMMENT '插件文件名',
    `plugin_type` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '插件类型，如payment、marketing',
    `excludes` varchar(255) NOT NULL DEFAULT '' COMMENT '互斥插件',
    `description` TEXT NOT NULL COMMENT '插件描述',
    `version` VARCHAR(50) NOT NULL DEFAULT '1.0.0' COMMENT '版本号，遵循SemVer',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '启用状态 0禁用 1启用',
    `is_default` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否默认安装 0否 1是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_plugin_flag` (`plugin_flag`, `mch_id`, `shop_id`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='已安装插件表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_addons_switch` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `module_key` varchar(100) NOT NULL DEFAULT '' COMMENT '模块标识',
    `is_open` tinyint(1) DEFAULT '0' COMMENT '模块是否可用 0关闭不可用，1打开可用',
    `remark` varchar(300) DEFAULT NULL COMMENT '备注信息',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_module_mch_shop` (`module_key`, `mch_id`, `shop_id`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='安装插件开关配置表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_addons_operation_log` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `operation_no` CHAR(32) NOT NULL DEFAULT '' COMMENT '操作流水号',
    `plugin_file` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件目录',
    `plugin_flag` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件标识',
    `plugin_version` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '插件版本',
    `operation` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '操作类型 install/update/uninstall',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态 0执行中 1成功 2失败 3已回滚',
    `operator_type` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '操作者类型',
    `operator_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '操作者ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `backup_path` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '备份目录',
    `detail_json` MEDIUMTEXT NULL COMMENT '执行详情',
    `error_message` TEXT NULL COMMENT '错误信息',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_operation_no` (`operation_no`),
    KEY `idx_plugin_operation` (`plugin_flag`, `operation`, `status`),
    KEY `idx_create_time` (`create_time`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='插件操作日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_addons_locks` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `lock_key` VARCHAR(191) NOT NULL DEFAULT '' COMMENT '锁key',
    `owner_token` CHAR(64) NOT NULL DEFAULT '' COMMENT '锁持有令牌',
    `driver` VARCHAR(20) NOT NULL DEFAULT 'db' COMMENT '锁驱动',
    `expire_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '过期时间',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_lock_key` (`lock_key`),
    KEY `idx_expire_time` (`expire_time`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='插件互斥锁表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_addons_migrations` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `operation_no` CHAR(32) NOT NULL DEFAULT '' COMMENT '操作流水号',
    `plugin_file` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件目录',
    `plugin_flag` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件标识',
    `plugin_version` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '插件版本',
    `operation` VARCHAR(30) NOT NULL DEFAULT '' COMMENT '迁移操作 install/update/uninstall',
    `migration_file` VARCHAR(191) NOT NULL DEFAULT '' COMMENT 'SQL文件',
    `migration_hash` CHAR(40) NOT NULL DEFAULT '' COMMENT 'SQL文件hash',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 1成功 2失败',
    `error_message` TEXT NULL COMMENT '错误信息',
    `executed_at` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行时间',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_addon_migration` (`plugin_flag`, `operation`, `migration_file`, `migration_hash`),
    KEY `idx_operation_no` (`operation_no`),
    KEY `idx_plugin_file` (`plugin_file`, `operation`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='插件SQL迁移记录表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_task` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `task_type` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '事件类型:hook,sql,url,shell',
    `task_key` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '任务标识',
    `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '任务名称',
    `content` TEXT NOT NULL COMMENT '事件内容',
    `instruction` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '说明',
    `time_type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '周期状态 1秒 2分 3时 4天 5每天定时 6每周定时 7每月定时',
    `week` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '周',
    `day` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '日',
    `hour` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '时',
    `minute` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分',
    `second` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '秒',
    `schedule` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Crontab表达式',
    `sleep` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '延迟秒数执行',
    `maximums` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大执行次数 0不限',
    `executes` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '已执行次数',
    `start_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间',
    `end_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间',
    `execute_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '最后执行时间',
    `sort` INT NOT NULL DEFAULT 0 COMMENT '排序',
    `status` ENUM('normal','completed','expired','hidden') NOT NULL DEFAULT 'normal' COMMENT '状态',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_task_key` (`mch_id`, `shop_id`, `task_key`),
    KEY `idx_status_time` (`status`, `execute_time`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_task_log` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `task_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '任务ID',
    `execute_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '执行时间',
    `complete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '完成时间',
    `content` TEXT COMMENT '执行结果',
    `process_id` INT NOT NULL DEFAULT 0 COMMENT '进程ID',
    `status` ENUM('success','failure','inprogress') NOT NULL DEFAULT 'failure' COMMENT '状态',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    PRIMARY KEY (`id`),
    KEY `idx_task` (`task_id`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='定时任务日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_api_account` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `secret_key` VARCHAR(100) NOT NULL COMMENT '接口秘钥',
    `description` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '描述',
    `permission` text COMMENT '接口权限',
    `interface_name` text COMMENT '选择接口名称',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1启用',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_secret_key` (`secret_key`),
    KEY `idx_mch_shop_status` (`mch_id`, `shop_id`, `status`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='接口账号表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_menus` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '模块ID',
    `name` VARCHAR(100) NOT NULL COMMENT '模块名称',
    `plugin_flag` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '插件标识',
    `path` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '前端路径',
    `component` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '前端组件',
    `pid` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级ID 0为顶级',
    `level` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '等级',
    `url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '链接地址',
    `is_menu` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否菜单栏 0否 1是',
    `is_page` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否组件菜单 0否 1是',
    `menu_type` VARCHAR(50) NOT NULL DEFAULT 'admin' COMMENT '账号归属 super 超管 admin 管理员',
    `collapse` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '展开状态: 0收起 1展开',
    `sort` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
    `info` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '模块描述',
    `logo` text COMMENT '模块小图标',
    `is_show` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否显示 0否 1是',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1启用',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    KEY `idx_mch_shop` (`mch_id`, `shop_id`),
    KEY `idx_plugin` (`plugin_flag`),
    KEY `idx_menu_type` (`menu_type`),
    KEY `idx_pid_level` (`pid`, `level`)
    ) ENGINE=InnoDB AUTO_INCREMENT=5000 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统菜单表';

INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (1, '首页', 'yb_plugin_system', 'home', 'Layout', 0, 1, '', 1, 0, 'admin', 1, 0, '系统首页', '<svg t=\"1692154424333\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"7832\" width=\"200\" height=\"200\"><path d=\"M828.952381 146.285714a73.142857 73.142857 0 0 1 73.142857 73.142857v463.238096a73.142857 73.142857 0 0 1-73.142857 73.142857H195.047619a73.142857 73.142857 0 0 1-73.142857-73.142857V219.428571a73.142857 73.142857 0 0 1 73.142857-73.142857h633.904762z m0 73.142857H195.047619v463.238096h633.904762V219.428571z m-487.619048 219.428572h73.142857v170.666667h-73.142857z m134.095238-73.142857h73.142858v243.809524h-73.142858z m134.095239-73.142857h73.142857v316.952381h-73.142857zM268.190476 804.571429h487.619048v73.142857H268.190476z\" p-id=\"7833\" fill=\"#ffffff\"></path></svg>', 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (2, '会员', 'yb_plugin_system', 'user', 'Layout', 0, 1, '', 1, 0, 'admin', 1, 1, '会员管理', '<svg t=\"1692155059672\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"8584\" width=\"200\" height=\"200\"><path d=\"M663.771429 591.506286l183.588571 214.235428A73.142857 73.142857 0 0 1 791.82019 926.47619H232.17981a73.142857 73.142857 0 0 1-55.53981-120.734476l183.612952-214.211047c21.625905 13.165714 45.104762 23.576381 69.948953 30.793143L232.17981 853.333333H475.428571v-146.285714h73.142858v146.285714h243.248761l-198.022095-231.009523a290.986667 290.986667 0 0 0 69.973334-30.817524zM512 97.52381c134.656 0 243.809524 109.153524 243.809524 243.809523s-109.153524 243.809524-243.809524 243.809524-243.809524-109.153524-243.809524-243.809524S377.344 97.52381 512 97.52381z m0 73.142857a170.666667 170.666667 0 1 0 0 341.333333 170.666667 170.666667 0 0 0 0-341.333333z\" p-id=\"8585\" fill=\"#ffffff\"></path></svg>', 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (3, '插件', 'yb_plugin_system', 'addons', 'Layout', 0, 1, '', 1, 0, 'admin', 1, 2, '插件管理', '<svg t=\"1668043746667\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"7599\" width=\"200\" height=\"200\"><path d=\"M537.984 139.52l277.333333 123.178667A64 64 0 0 1 853.333333 321.194667v381.610666a64 64 0 0 1-38.016 58.496l-277.333333 123.157334a64 64 0 0 1-51.968 0l-277.333333-123.157334A64 64 0 0 1 170.666667 702.805333V321.194667a64 64 0 0 1 38.016-58.496l277.333333-123.157334a64 64 0 0 1 51.968 0zM234.666667 381.44v321.365333l250.666666 111.317334V488.853333L234.666667 381.44z m554.666666 2.304l-240 102.826667V809.386667L789.333333 702.805333V383.744zM512 198.037333l-266.581333 118.378667 269.290666 115.413333 266.517334-114.24L512 198.037333z\" p-id=\"7600\" fill=\"#ffffff\"></path></svg>', 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (4, '系统', 'yb_plugin_system', 'system', 'Layout', 0, 1, '', 1, 0, 'admin', 1, 3, '系统管理', '<svg t=\"1668043508826\" class=\"icon\" viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"7111\" width=\"200\" height=\"200\"><path d=\"M448.362667 166.826667l113.6 0.170666a64 64 0 0 1 63.893333 63.914667l0.042667 18.517333a301.461333 301.461333 0 0 1 62.101333 34.88l15.210667-8.746666a64 64 0 0 1 87.296 23.381333l56.938666 98.304a64 64 0 0 1-19.989333 85.397333l-3.477333 2.133334-15.274667 8.810666c2.624 24.234667 2.304 48.853333-1.130667 73.322667l10.794667 6.250667a64 64 0 0 1 25.216 84.117333l-1.770667 3.306667-53.333333 92.373333a64 64 0 0 1-84.117333 25.216l-3.328-1.792-14.741334-8.533333a298.538667 298.538667 0 0 1-59.626666 33.28v25.386666a64 64 0 0 1-59.989334 63.957334l-4.074666 0.128-113.6-0.170667a64 64 0 0 1-63.893334-63.893333l-0.064-30.613334a302.613333 302.613333 0 0 1-50.069333-29.696l-27.221333 15.658667a64 64 0 0 1-87.296-23.402667l-56.938667-98.282666a64 64 0 0 1 19.989333-85.418667l3.477334-2.133333 27.690666-15.936c-2.133333-20.266667-2.24-40.768-0.192-61.226667l-30.741333-17.770667A64 64 0 0 1 158.506667 393.6l1.792-3.306667 53.333333-92.373333a64 64 0 0 1 84.117333-25.216l3.306667 1.792 26.794667 15.466667a297.984 297.984 0 0 1 56.426666-34.666667v-24.362667a64 64 0 0 1 59.989334-63.978666l4.074666-0.128z m-0.085334 64l0.064 65.066666-36.778666 17.301334c-15.744 7.402667-30.613333 16.533333-44.309334 27.221333l-34.005333 26.538667-62.570667-36.138667-1.6-0.896-53.333333 92.373333 66.56 38.421334-4.138667 41.152c-1.6 15.978667-1.536 32.106667 0.149334 48.085333l4.394666 41.429333-63.786666 36.736 56.917333 98.282667 63.338667-36.416 33.6 24.597333a237.994667 237.994667 0 0 0 39.466666 23.424l36.736 17.258667 0.128 71.168 113.578667 0.170667-0.064-68.16 39.466667-16.426667a234.538667 234.538667 0 0 0 46.826666-26.112l33.578667-24.128 50.56 29.184 53.290667-92.394667-48.128-27.818666 5.973333-42.688c2.666667-19.093333 2.965333-38.421333 0.896-57.6l-4.48-41.450667 51.456-29.696-56.938667-98.282667-51.2 29.504-33.621333-24.512a238.037333 238.037333 0 0 0-48.938667-27.498666l-39.381333-16.341334-0.128-61.184-113.578667-0.170666z m127.381334 183.722666a128.170667 128.170667 0 0 1 46.890666 174.933334 127.829333 127.829333 0 0 1-174.762666 46.848 128.170667 128.170667 0 0 1-46.869334-174.933334 127.829333 127.829333 0 0 1 174.741334-46.848z m-119.317334 78.805334a64.170667 64.170667 0 0 0 23.466667 87.573333 63.829333 63.829333 0 0 0 87.296-23.402667 64.170667 64.170667 0 0 0-20.266667-85.589333l-3.2-1.984-3.306666-1.770667a63.829333 63.829333 0 0 0-83.989334 25.173334z\" p-id=\"7112\"></path></svg>', 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (100, '首页', 'yb_plugin_system', 'home_index', 'HomeIndex', 1, 2, '', 1, 1, 'admin', 1, 0, '系统首页', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (200, '会员列表', 'yb_plugin_system', 'user_index', 'UserIndex', 2, 2, '', 1, 1, 'admin', 1, 0, '会员列表管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (201, '添加会员', 'yb_plugin_system', '', '', 200, 3, 'user/add', 0, 0, 'admin', 1, 0, '添加会员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (202, '编辑会员', 'yb_plugin_system', '', '', 200, 3, 'user/edit', 0, 0, 'admin', 1, 0, '编辑会员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (203, '删除会员', 'yb_plugin_system', '', '', 200, 3, 'user/del', 0, 0, 'admin', 1, 0, '删除会员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (204, '会员状态切换', 'yb_plugin_system', '', '', 200, 3, 'user/valswitch', 0, 0, 'admin', 1, 0, '会员状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (300, '插件管理', 'yb_plugin_system', 'addons_index', 'AddonsIndex', 3, 2, '', 1, 1, 'admin', 1, 0, '插件市场和本地插件管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (301, '插件配置', 'yb_plugin_system', '', '', 300, 3, 'addons/setting', 0, 0, 'admin', 1, 0, '插件配置', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (302, '插件安装', 'yb_plugin_system', '', '', 300, 3, 'addons/install', 0, 0, 'admin', 1, 0, '安装插件', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (303, '插件更新', 'yb_plugin_system', '', '', 300, 3, 'addons/update', 0, 0, 'admin', 1, 0, '更新插件', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (304, '插件卸载', 'yb_plugin_system', '', '', 300, 3, 'addons/uninstall', 0, 0, 'admin', 1, 0, '卸载插件', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (305, '插件状态切换', 'yb_plugin_system', '', '', 300, 3, 'addons/valswitch', 0, 0, 'admin', 1, 0, '插件状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (400, '站点管理', 'yb_plugin_system', 'site', 'Empty', 4, 2, '', 1, 0, 'admin', 1, 0, '站点配置管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (410, '站点设置', 'yb_plugin_system', 'site_config', 'SiteConfigIndex', 400, 3, '', 1, 1, 'admin', 1, 0, '站点基本信息设置', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (420, '资源管理', 'yb_plugin_system', 'file_tab_index', 'FileTabIndex', 400, 3, '', 1, 1, 'admin', 1, 1, '文件资源管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (421, '文件编辑', 'yb_plugin_system', '', '', 420, 4, 'file/edit', 0, 0, 'admin', 1, 0, '编辑文件信息', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (422, '文件删除', 'yb_plugin_system', '', '', 420, 4, 'file/del', 0, 0, 'admin', 1, 0, '删除文件', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (423, '分组添加', 'yb_plugin_system', '', '', 420, 4, 'file/add', 0, 0, 'admin', 1, 0, '添加文件分组', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (424, '分组状态切换', 'yb_plugin_system', '', '', 420, 4, 'file/valswitch', 0, 0, 'admin', 1, 0, '文件分组状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (500, '权限管理', 'yb_plugin_system', 'admin', 'Empty', 4, 2, '', 1, 0, 'admin', 1, 1, '管理员和角色权限管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (510, '角色管理', 'yb_plugin_system', 'admin_group', 'AdminGroupIndex', 500, 3, '', 1, 1, 'admin', 1, 0, '管理员角色管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (511, '角色编辑', 'yb_plugin_system', '', '', 510, 4, 'admingroup/edit', 0, 0, 'admin', 1, 0, '编辑角色', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (512, '角色删除', 'yb_plugin_system', '', '', 510, 4, 'admingroup/del', 0, 0, 'admin', 1, 0, '删除角色', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (513, '角色状态切换', 'yb_plugin_system', '', '', 510, 4, 'admingroup/valswitch', 0, 0, 'admin', 1, 0, '角色状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (514, '角色添加', 'yb_plugin_system', '', '', 510, 4, 'admingroup/add', 0, 0, 'admin', 1, 0, '角色添加', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (520, '管理员', 'yb_plugin_system', 'admin_index', 'AdminIndex', 500, 3, '', 1, 1, 'admin', 1, 1, '管理员账号管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (521, '添加管理员', 'yb_plugin_system', '', '', 520, 4, 'admin/add', 0, 0, 'admin', 1, 0, '添加管理员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (522, '编辑管理员', 'yb_plugin_system', '', '', 520, 4, 'admin/edit', 0, 0, 'admin', 1, 0, '编辑管理员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (523, '删除管理员', 'yb_plugin_system', '', '', 520, 4, 'admin/del', 0, 0, 'admin', 1, 0, '删除管理员', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (524, '管理员状态切换', 'yb_plugin_system', '', '', 520, 4, 'admin/valswitch', 0, 0, 'admin', 1, 0, '管理员状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (530, '操作日志', 'yb_plugin_system', 'admin_log', 'AdminLogIndex', 500, 3, '', 1, 1, 'admin', 1, 2, '管理员操作日志', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (531, '日志删除', 'yb_plugin_system', '', '', 530, 4, 'adminlog/del', 0, 0, 'admin', 1, 0, '删除操作日志', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (532, '日志详情', 'yb_plugin_system', '', '', 530, 4, 'adminlog/detail', 0, 0, 'admin', 1, 0, '查看日志详情', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (600, '开发工具', 'yb_plugin_system', 'tools', 'Empty', 4, 2, '', 1, 0, 'admin', 1, 2, '开发相关工具', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (610, '菜单管理', 'yb_plugin_system', 'menu', 'MenuIndex', 600, 3, '', 1, 1, 'admin', 1, 0, '系统菜单管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (611, '添加菜单', 'yb_plugin_system', '', '', 610, 4, 'menu/add', 0, 0, 'admin', 1, 0, '添加菜单', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (612, '编辑菜单', 'yb_plugin_system', '', '', 610, 4, 'menu/edit', 0, 0, 'admin', 1, 0, '编辑菜单', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (613, '删除菜单', 'yb_plugin_system', '', '', 610, 4, 'menu/del', 0, 0, 'admin', 1, 0, '删除菜单', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (615, '插件开发', 'yb_plugin_system', 'addons_local_index', 'AddonsLocalIndex', 600, 3, '', 1, 1, 'admin', 1, 0, '插件开发管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (620, '数据库', 'yb_plugin_system', 'databack', 'DatabackIndex', 600, 3, '', 1, 1, 'admin', 1, 1, '数据库备份管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (630, '接口账号', 'yb_plugin_system', 'api_account_index', 'ApiAccountIndex', 600, 3, '', 1, 1, 'admin', 1, 2, 'API接口账号管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (631, '添加接口账号', 'yb_plugin_system', '', '', 630, 4, 'interfaceaccount/add', 0, 0, 'admin', 1, 0, '添加接口账号', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (632, '编辑接口账号', 'yb_plugin_system', '', '', 630, 4, 'interfaceaccount/edit', 0, 0, 'admin', 1, 0, '编辑接口账号', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (633, '删除接口账号', 'yb_plugin_system', '', '', 630, 4, 'interfaceaccount/del', 0, 0, 'admin', 1, 0, '删除接口账号', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (634, '接口账号状态切换', 'yb_plugin_system', '', '', 630, 4, 'interfaceaccount/valswitch', 0, 0, 'admin', 1, 0, '接口账号状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (640, '多语言', 'yb_plugin_system', 'lang_tab_index', 'LangTabIndex', 600, 3, '', 1, 1, 'admin', 1, 3, '多语言配置管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (650, '定时任务', 'yb_plugin_system', 'task_index', 'TaskIndex', 600, 3, '', 1, 1, 'admin', 1, 0, '定时任务管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (651, '添加任务', 'yb_plugin_system', '', '', 650, 4, 'crontab/add', 0, 0, 'admin', 1, 0, '添加定时任务', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (652, '编辑任务', 'yb_plugin_system', '', '', 650, 4, 'crontab/edit', 0, 0, 'admin', 1, 0, '编辑定时任务', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (653, '删除任务', 'yb_plugin_system', '', '', 650, 4, 'crontab/del', 0, 0, 'admin', 1, 0, '删除定时任务', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (654, '任务状态切换', 'yb_plugin_system', '', '', 650, 4, 'crontab/valswitch', 0, 0, 'admin', 1, 0, '定时任务状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (655, '执行任务', 'yb_plugin_system', '', '', 650, 4, 'crontab/execute', 0, 0, 'admin', 1, 0, '立即执行定时任务', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (656, '查看日志', 'yb_plugin_system', '', '', 650, 4, 'crontab/log', 0, 0, 'admin', 1, 0, '查看任务执行日志', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (660, '自建模块', 'yb_plugin_system', 'builder', 'Empty', 4, 3, '', 1, 1, 'admin', 1, 0, '自建模块', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (661, '模块管理', 'yb_plugin_system', 'builder_group_index', 'BuilderGroupIndex', 660, 3, '', 1, 1, 'admin', 1, 0, '模块管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (662, '添加模块', 'yb_plugin_system', '', '', 661, 4, 'builder/add', 0, 0, 'admin', 1, 0, '添加模块', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (663, '修改模块', 'yb_plugin_system', '', '', 661, 4, 'builder/add', 0, 0, 'admin', 1, 0, '修改模块', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (664, '删除模块', 'yb_plugin_system', '', '', 661, 4, 'builder/add', 0, 0, 'admin', 1, 0, '删除模块', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (665, '页面管理', 'yb_plugin_system', 'builder_index', 'BuilderIndex', 660, 3, '', 1, 1, 'admin', 1, 0, '页面管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (666, '添加页面', 'yb_plugin_system', '', '', 665, 4, 'builder/add', 0, 0, 'admin', 1, 0, '添加页面', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (667, '修改页面', 'yb_plugin_system', '', '', 665, 4, 'builder/edit', 0, 0, 'admin', 1, 0, '修改页面', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (668, '删除页面', 'yb_plugin_system', '', '', 665, 4, 'builder/del', 0, 0, 'admin', 1, 0, '删除页面', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (669, '应用详情', 'yb_plugin_system', '', '', 665, 4, 'builder/detail', 0, 0, 'admin', 1, 0, '查看应用详情', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (670, '表单设计', 'yb_plugin_system', '', '', 665, 4, 'builder/editbuilderdata', 0, 0, 'admin', 1, 0, '设计应用表单', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (671, '审批设置', 'yb_plugin_system', 'approval_index', 'ApprovalIndex', 660, 3, '', 1, 1, 'admin', 1, 0, '审批设置', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (672, '办公审批', 'yb_plugin_system', 'office_approval_index', 'OfficeApprovalIndex', 660, 3, '', 1, 1, 'admin', 1, 0, '办公审批', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (680, '系统通知', 'yb_plugin_system', 'message_index', 'MessageIndex', 600, 3, '', 1, 1, 'admin', 1, 0, '系统通知管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (681, '删除通知', 'yb_plugin_system', '', '', 680, 4, 'message/del', 0, 0, 'admin', 1, 0, '删除系统通知', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (682, '标记已读', 'yb_plugin_system', '', '', 680, 4, 'message/updread', 0, 0, 'admin', 1, 0, '标记通知已读', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (683, '批量已读', 'yb_plugin_system', '', '', 680, 4, 'message/batchread', 0, 0, 'admin', 1, 0, '批量标记已读', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (690, '站点预警', 'yb_plugin_system', 'warning_tab_index', 'WarningTabIndex', 600, 3, '', 1, 1, 'admin', 1, 0, '敏感词预警管理', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (691, '添加敏感词', 'yb_plugin_system', '', '', 690, 4, 'warning/add', 0, 0, 'admin', 1, 0, '添加敏感词', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (692, '编辑敏感词', 'yb_plugin_system', '', '', 690, 4, 'warning/edit', 0, 0, 'admin', 1, 0, '编辑敏感词', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (693, '删除敏感词', 'yb_plugin_system', '', '', 690, 4, 'warning/del', 0, 0, 'admin', 1, 0, '删除敏感词', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (694, '敏感词状态切换', 'yb_plugin_system', '', '', 690, 4, 'warning/valswitch', 0, 0, 'admin', 1, 0, '敏感词状态切换', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (695, '批量导入敏感词', 'yb_plugin_system', '', '', 690, 4, 'warning/batchimport', 0, 0, 'admin', 1, 0, '批量导入敏感词', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (696, '删除预警日志', 'yb_plugin_system', '', '', 690, 4, 'warning/logdel', 0, 0, 'admin', 1, 0, '删除预警日志', NULL, 1, 1, 0, 0, 1665627652, 1665627652);
INSERT INTO `YB_TABLE_PREFIX_sys_menus` VALUES (697, '预警日志详情', 'yb_plugin_system', '', '', 690, 4, 'warning/logdetail', 0, 0, 'admin', 1, 0, '查看预警日志详情', NULL, 1, 1, 0, 0, 1665627652, 1665627652);

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_lang` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '语言ID',
    `name` VARCHAR(100) NOT NULL COMMENT '语言名称，如 English, 中文',
    `lang_code` VARCHAR(20) NOT NULL COMMENT '语言代码，如 en, zh',
    `country_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '地区ID，关联 YB_TABLE_PREFIX_sys_lang_country',
    `sort` INT NOT NULL DEFAULT 0 COMMENT '排序',
    `is_default` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否默认 1是 0否',
    `status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '状态 1启用 0禁用',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_lang_code` (`lang_code`),
    KEY `idx_status` (`status`, `is_default`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='语言表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_lang_detail` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id',
    `lang_id` BIGINT UNSIGNED NOT NULL COMMENT '语言ID，关联 YB_TABLE_PREFIX_sys_lang',
    `lang_key` VARCHAR(191) NOT NULL COMMENT '词条key',
    `lang_value` VARCHAR(500) NOT NULL COMMENT '词条翻译值',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_lang_key` (`lang_id`, `lang_key`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='语言词条表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_lang_country` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键id',
    `name` VARCHAR(100) NOT NULL COMMENT '地区名称，如 美国，中国',
    `region_code` VARCHAR(20) NOT NULL COMMENT '地区代码，如 US, CN, TW',
    `sort` INT NOT NULL DEFAULT 0 COMMENT '排序值',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_region_code` (`region_code`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='语言地区表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_warning_word` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `sensitive_word` VARCHAR(255) NOT NULL COMMENT '敏感词',
    `status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用 0否 1是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_status` (`status`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='敏感词表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_warning_log` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `word_list` TEXT COMMENT '命中的敏感词数组',
    `title` VARCHAR(200) NOT NULL DEFAULT '' COMMENT '日志标题',
    `url` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '操作页面',
    `user_id` BIGINT UNSIGNED NOT NULL COMMENT '管理员ID',
    `user_name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '管理员姓名',
    `content` TEXT NOT NULL COMMENT '内容',
    `ip` VARBINARY(16) NOT NULL COMMENT 'IP地址（支持IPv4/IPv6）',
    `type` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '来源：0后台提交 1小程序提交',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_mch_shop_time` (`mch_id`, `shop_id`, `create_time`),
    KEY `idx_user` (`user_id`, `type`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='违规词过滤与预警日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_message` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '消息ID',
    `source` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '消息来源(模块/页面标识)',
    `title` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '消息标题',
    `type` VARCHAR(50) NOT NULL DEFAULT 'system' COMMENT '消息类型: system公告, remind提醒, warning预警等',
    `content` MEDIUMTEXT COMMENT '消息内容',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态: 0未读 1已读 2已删除',
    `receiver_type` VARCHAR(20) NOT NULL DEFAULT 'admin' COMMENT '接收对象类型: admin/管理员 user/用户',
    `receiver_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '接收对象ID',
    `is_remind` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否提醒 0否 1是',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_receiver_status` (`receiver_type`, `receiver_id`, `status`),
    KEY `idx_mch_shop_time` (`mch_id`, `shop_id`, `create_time`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统通知表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_dict` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `key` VARCHAR(100) NOT NULL COMMENT '字典Key',
    `name` VARCHAR(50) NOT NULL COMMENT '字典名称',
    `value` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '字典值',
    `pid` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '父级ID',
    `status` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态：0-禁用，1-正常',
    `sort` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序',
    `mark` TEXT COMMENT '说明',
    `is_value` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否最终使用值，0-否，1-是（多级字典中用于标识最终层）',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_key` (`key`),
    KEY `idx_pid` (`pid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统字典表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_area` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `code` VARCHAR(100) NOT NULL COMMENT '地区编码',
    `name` VARCHAR(100) NOT NULL COMMENT '地区名称',
    `pid` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级地区ID',
    `level` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '地区层级：1省/直辖市，2市，3区县等',
    PRIMARY KEY (`id`),
    KEY `idx_pid` (`pid`),
    KEY `idx_code` (`code`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统地区表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_share_param` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `user_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户ID',
    `param_key` VARCHAR(191) NOT NULL DEFAULT '' COMMENT '参数Key',
    `param` VARCHAR(500) NOT NULL DEFAULT '' COMMENT '参数内容',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_user_key` (`user_id`, `param_key`),
    KEY `idx_mch_shop` (`mch_id`, `shop_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统分享参数表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_goods` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '商品ID',
    `goods_name` VARCHAR(255) NOT NULL COMMENT '商品名称',
    `pic` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品主图',
    `price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '销售价',
    `market_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '市场价',
    `cost_price` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '成本价',
    `stock` INT NOT NULL DEFAULT 0 COMMENT '库存数量',
    `goods_type` VARCHAR(50) NOT NULL DEFAULT 'normal' COMMENT '商品类型: normal实物, inquiry询价, product产品, recharge会员储值, warehouse仓储商品, member_card会员卡',
    `sales_volume` INT NOT NULL DEFAULT 0 COMMENT '基础销量',
    `real_sales_volume` INT NOT NULL DEFAULT 0 COMMENT '实际销量',
    `promote_word` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '促销语',
    `click` INT NOT NULL DEFAULT 0 COMMENT '浏览量',
    `share_times` INT NOT NULL DEFAULT 0 COMMENT '分享次数',
    `sort` INT NOT NULL DEFAULT 0 COMMENT '商品排序',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态: 0下架 1上架',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_shop_status` (`shop_id`, `status`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统商品表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_goods_sku` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
    `sys_goods_id` int(11) NOT NULL COMMENT '商品id',
    `sku_id` int(11) NOT NULL DEFAULT 0 COMMENT '子表skuid',
    `spec_id_group` varchar(255) NOT NULL COMMENT '规格组合，格式为规格1id:规格值1id；规格2id:规格值2id；...',
    `sku_name` varchar(500) NOT NULL COMMENT '',
    `market_price` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '市场价',
    `price` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '销售价',
    `stock` int(11) NOT NULL DEFAULT 0 COMMENT '库存',
    `sku_img` varchar(255) DEFAULT '' COMMENT 'sku图片',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='系统商品sku信息表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_goods_activity` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `sys_goods_id` int(11) NOT NULL COMMENT '系统商品表id',
    `sys_sku_id` int(11) NOT NULL DEFAULT 0 COMMENT '系统商品sku id',
    `activity_type` varchar(100) NOT NULL DEFAULT '' COMMENT '活动类型：1-赠送积分，2-赠送成长值，3-会员价，4-达人佣金,5-员工佣金，6-分销佣金，7-区域限购',
    `content` text COMMENT '活动内容',
    `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态:0-关闭；1-开启；',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `create_time` int(11) NOT NULL COMMENT '创建时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='商品活动表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order_activity` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `sys_order_id` int(11) NOT NULL COMMENT '系统订单id',
    `type` varchar(100) NOT NULL DEFAULT '' COMMENT '优惠活动类型，1-优惠券；2-满减；3-会员折扣，4：砍价；5：秒杀；6：拼团；7：积分；10：拼团返利，11：商品卡,12:优惠活动',
    `act_id` int(11) NOT NULL COMMENT '优惠活动id',
    `act_detail` varchar(5000) NOT NULL COMMENT '优惠活动详情',
    `money` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '最终优惠金额',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `create_time` int(11) NOT NULL COMMENT '创建时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单-优惠活动关联表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_goods_view_log` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `user_id` int(11) NOT NULL COMMENT '用户id',
    `sys_goods_id` int(11) NOT NULL COMMENT '系统商品id',
    `goods_type`  varchar(100) NOT NULL DEFAULT '' COMMENT '商品类型: normal实物, inquiry询价, product产品, recharge会员储值, warehouse仓储商品, member_card会员卡',
    `times` int(11) NOT NULL DEFAULT 0 COMMENT '商品被访问次数',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `create_time` int(11) NOT NULL COMMENT '创建时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='系统商品浏览记录表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '订单ID',
    `order_no` VARCHAR(50) NOT NULL COMMENT '系统订单编号(唯一)',
    `out_trade_no` VARCHAR(50) NOT NULL COMMENT '商户内部交易号',
    `transaction_id` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '第三方支付流水号',
    `buyer_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '买家ID',
    `sub_buyer_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '子买家id',
    `order_money` DECIMAL(10,2) NOT NULL COMMENT '订单总金额',
    `pay_money` DECIMAL(10,2) NOT NULL COMMENT '实付金额',
    `balance_money` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '余额抵扣金额',
    `integral` int(11) NOT NULL DEFAULT 0 COMMENT '使用积分',
    `refund_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '已退款金额',
    `refund_status` TINYINT NOT NULL DEFAULT 0 COMMENT '退款状态: 0无退款 1部分退款 2全额退款',
    `order_type` VARCHAR(50) NOT NULL DEFAULT 'normal' COMMENT '订单类型 normal：普通订单；activity_bargain：砍价订单；activity_seckill：秒杀订单；activity_group：拼团订单；activity_integral：积分订单；',
    `order_status` TINYINT NOT NULL DEFAULT 0 COMMENT '订单状态: 0待支付 1已支付 2已发货 3已完成 4退款中 5已退款 6已取消 7已关闭',
    `order_goods_type` VARCHAR(50) NOT NULL DEFAULT 'normal' COMMENT '商品类型: normal-普通, member_charge-储值, electron_coupon-电子卡券, reservation_service-预约服务, micro_pay-当面付, member_card-会员卡',
    `pay_status` TINYINT NOT NULL DEFAULT 0 COMMENT '付款状态: 0未付款 1已付款',
    `pay_type` VARCHAR(50) NOT NULL DEFAULT '0' COMMENT '支付类型，0-微信，1-百度，2-支付宝，3-字节跳动，4-QQ，7-货到付款，8-银行卡支付，11-储值余额，12-激励视频，13-兑换码，15-现金支付，16-积分兑换',
    `pay_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '支付时间',
    `notify_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '异步通知URL',
    `return_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '支付完成回跳URL',
    `finish_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '完成时间',
    `is_comment` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否已评价，1:未评价；2:已评价',
    `buyer_remarks` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '买家备注',
    `platform` TINYINT NOT NULL DEFAULT 0 COMMENT '所属平台: 0微信|1百度|2支付宝|3字节跳动|4公众号|5手机站|6QQ',
    `is_help_pay` TINYINT NOT NULL DEFAULT 0 COMMENT '是否代付',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uniq_order_no` (`order_no`),
    KEY `idx_buyer_status` (`buyer_id`, `order_status`),
    KEY `idx_shop_time` (`shop_id`, `create_time`),
    KEY `idx_pay_status` (`pay_status`, `pay_type`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统订单表（含支付信息）';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order_goods` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `sys_order_id` BIGINT UNSIGNED NOT NULL COMMENT '订单ID',
    `sys_goods_id` BIGINT UNSIGNED NOT NULL COMMENT '商品ID',
    `goods_name` VARCHAR(255) NOT NULL COMMENT '商品名称(下单快照)',
    `goods_price` DECIMAL(10,2) NOT NULL COMMENT '商品单价(快照)',
    `num` INT NOT NULL DEFAULT 1 COMMENT '购买数量',
    `pic_url` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品图片(快照)',
    `pay_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '实际支付金额',
    `modify_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '后台改价金额',
    `freight` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '运费',
    `discount_info` TEXT COMMENT '折扣信息(JSON)',
    `goods_info` TEXT COMMENT '商品扩展信息(JSON，如规格属性)',
    `order_goods_type` VARCHAR(50) NOT NULL DEFAULT 'normal' COMMENT '商品类型: normal普通, inquiry询价, product产品, recharge储值, member_card会员卡',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_order_goods` (`sys_order_id`, `sys_goods_id`),
    KEY `idx_shop_goods` (`shop_id`, `sys_goods_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统订单商品表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order_refund` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `sys_order_id` int(11) NOT NULL COMMENT '系统订单id',
    `user_id` int(11) NOT NULL COMMENT '用户id',
    `refund_id` varchar(50) NOT NULL DEFAULT '' COMMENT '第三方退款单号',
    `out_refund_no` varchar(50) NOT NULL DEFAULT '' COMMENT '系统退款单号',
    `order_type` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '订单类型 normal：普通订单；activity_bargain：砍价订单；activity_seckill：秒杀订单；activity_group：拼团订单；activity_integralmall：积分订单；',
    `refund_reason` varchar(500) NOT NULL DEFAULT '' COMMENT '退款原因',
    `reject_reason` varchar(500) NOT NULL DEFAULT '' COMMENT '拒绝退款原因',
    `remark` varchar(500) NOT NULL DEFAULT '' COMMENT '备注',
    `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '退款状态，0：待退款；1：同意；2：拒绝；3：取消退款',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `platform` tinyint(3) NOT NULL DEFAULT 0 COMMENT '所属平台: 0微信|1百度|2支付宝|3字节跳动|4公众号|5手机站|6QQ',
    `create_time` int(11) NOT NULL COMMENT '申请时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单退款表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order_express` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `sys_order_id` int(11) NOT NULL COMMENT '系统订单id',
    `express_type` tinyint(2) NOT NULL DEFAULT 1 COMMENT '发货方式，1-常用物流；2-无需物流；3-达达配送；4-微信物流；7-蜂鸟；8-裹小递',
    `express_name` varchar(100) NOT NULL DEFAULT '' COMMENT '快递公司名称',
    `express_code` varchar(50) NOT NULL DEFAULT '' COMMENT '快递公司编码',
    `express_no` varchar(50) NOT NULL DEFAULT '' COMMENT '运单编号',
    `delivery_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '物流类型，0-默认，1-快递鸟 2-快递100 3-阿里云物流',
    `remarks` varchar(100) NOT NULL DEFAULT '' COMMENT '备注信息',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `create_time` int(11) NOT NULL COMMENT '发货时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单物流表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_order_price_modify_log` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `sys_order_id` int(11) NOT NULL COMMENT '系统订单id',
    `admin_id` int(11) NOT NULL COMMENT '操作人id',
    `admin_name` varchar(50) NOT NULL DEFAULT '' COMMENT '操作人名称',
    `admin_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '操作人类型：1 后台,2 商家端',
    `old_price` decimal(10,2) NOT NULL COMMENT '修改前的金额',
    `new_price` decimal(10,2) NOT NULL COMMENT '修改后的金额',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `create_time` int(11) NOT NULL COMMENT '修改时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单价格修改日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_builder` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
    `group_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '分组ID',
    `builder_type` VARCHAR(50) NOT NULL DEFAULT 'builder' COMMENT '类型：system/系统 builder/自建',
    `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '应用名称',
    `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `icon` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '应用图标',
    `image` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '应用图片',
    `is_approval` TINYINT NOT NULL DEFAULT 0 COMMENT '是否审批: 0否 1是',
    `is_edit` TINYINT NOT NULL DEFAULT 1 COMMENT '是否可修改: 0否 1是',
    `sys_menu_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '菜单ID',
    `desc` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '应用描述',
    `data` LONGTEXT NOT NULL COMMENT '表单配置信息(JSON)',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_shop_admin` (`shop_id`, `admin_id`),
    KEY `idx_menu` (`sys_menu_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='界面构建模块表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_builder_group` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
  `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
  `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
  `builder_type` VARCHAR(50) NOT NULL DEFAULT 'builder' COMMENT '类型：system/系统 builder/自建',
    `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '应用名称',
    `is_edit` TINYINT NOT NULL DEFAULT 1 COMMENT '是否可修改: 0否 1是',
    `sys_menu_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '菜单ID',
    `desc` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '应用描述',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_shop_admin` (`shop_id`, `admin_id`),
    KEY `idx_menu` (`sys_menu_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='界面构建分组表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_builder_scenes` (
   `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
   `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
   `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
   `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
   `sys_builder_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联应用ID',
   `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
   `scene_flag` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '场景值标识',
    `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '场景名称',
    `data` LONGTEXT NOT NULL COMMENT '场景数据(JSON)',
    `default_sort` VARCHAR(2000) NOT NULL DEFAULT '' COMMENT '默认排序规则',
    `is_default` TINYINT NOT NULL DEFAULT 0 COMMENT '是否默认: 0否 1是',
    `is_edit` TINYINT NOT NULL DEFAULT 0 COMMENT '是否可修改: 0否 1是',
    `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态: 0隐藏 1显示',
    `sort` INT NOT NULL DEFAULT 0 COMMENT '显示排序',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_builder_scene` (`sys_builder_id`, `sort`),
    KEY `idx_shop_admin` (`shop_id`, `admin_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='界面构建模块场景表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_builder_searchs` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
    `sys_builder_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联应用ID',
    `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `data` LONGTEXT NOT NULL COMMENT '搜索条件配置(JSON)',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_builder_search` (`sys_builder_id`),
    KEY `idx_shop_admin` (`shop_id`, `admin_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='界面构建模块搜索表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_builder_columns` (
    `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
    `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户ID',
    `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
    `sys_builder_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联应用ID',
    `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `data` LONGTEXT NOT NULL COMMENT '字段配置(JSON)',
    `extend` TEXT COMMENT '扩展信息(JSON)',
    `create_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_builder_column` (`sys_builder_id`),
    KEY `idx_shop_admin` (`shop_id`, `admin_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='界面构建模块字段配置表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_approval_setting` (
     `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
     `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
     `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
     `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '审批项名称',
    `flag` VARCHAR(191) NOT NULL DEFAULT '' COMMENT '审批项标识',
    `mark` TEXT COMMENT '备注',
    `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `setting` LONGTEXT COMMENT '服务配置',
    `type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型: 0固定审批 | 1授权审批人 | 2无需审批',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_flag` (`flag`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='审批设置表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_approval_log` (
     `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
     `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
     `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
     `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建管理员ID',
     `approval_setting_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批设置ID',
     `relation_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联ID',
     `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型: 0固定审批 | 1授权审批人 | 2无需审批',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态: 0未审批 | 1通过 | 2不通过',
    `flag` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '审批项标识',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_setting_relation` (`approval_setting_id`, `relation_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='审批记录表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_approval_admin_log` (
   `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
   `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
   `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
   `approval_setting_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批设置ID',
   `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
   `relation_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联ID',
   `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型: 0固定审批 | 1授权审批人 | 2无需审批',
    `level` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '层级',
    `approval_type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批类型: 0任意一人 | 1多人会签 | 2直属上级',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态: 0未审批 | 1通过 | 2不通过 | 3等待上级审批',
    `is_chaosong` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否抄送: 0否 | 1是',
    `mark` TEXT COMMENT '备注',
    `flag` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '审批项标识',
    `approval_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核时间',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_admin_relation` (`admin_id`, `relation_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='审批人员日志表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_approval_admin_action_log` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  `mch_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用ID',
  `shop_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
  `approval_setting_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批设置ID',
  `admin_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '管理员ID',
  `relation_id` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '关联ID',
  `relation_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '关联表名',
    `type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '类型: 0固定审批 | 1授权审批人 | 2无需审批',
    `level` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '层级',
    `approval_type` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审批类型: 0任意一人 | 1多人会签 | 2直属上级',
    `status` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '状态: 0未审批 | 1通过 | 2不通过 | 3等待上级审批',
    `is_chaosong` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否抄送: 0否 | 1是',
    `mark` TEXT COMMENT '备注',
    `flag` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '审批项标识',
    `approval_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '审核时间',
    `create_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
    `delete_time` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT '删除时间',
    PRIMARY KEY (`id`),
    KEY `idx_admin_action` (`admin_id`, `relation_id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='审批人员操作记录表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_access_token` (
    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
    `appid` varchar(255) NOT NULL COMMENT 'appid',
    `access_token` varchar(255) NOT NULL COMMENT 'access_token',
    `refresh_token` varchar(255) DEFAULT '' COMMENT 'refresh_token',
    `expire_time` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间',
    `token_type` varchar(255) DEFAULT 'default' COMMENT 'default/默认 customer_contact_token/企业微信客户  address_book_token/企业通讯录',
    `platform` tinyint(3) NOT NULL DEFAULT 0 COMMENT '所属平台: 0微信|1百度|2支付宝|3字节跳动|4公众号|5手机站|6QQ',
    `mch_id` int(11) NOT NULL COMMENT '应用id',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `create_time` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='access_token表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_pay_notify` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `mch_id` int(11) NOT NULL COMMENT '应用ID',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
    `order_number` varchar(50) DEFAULT NULL COMMENT '订单号',
    `notify_message` varchar(2000) NOT NULL COMMENT '回调内容',
    `create_time` int(11) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='支付通知表';

CREATE TABLE IF NOT EXISTS `YB_TABLE_PREFIX_sys_transfer_log` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `mch_id` int(11) NOT NULL COMMENT '应用ID',
    `shop_id` int(11) NOT NULL DEFAULT 0 COMMENT '店铺ID',
    `relate_type` tinyint(2) NOT NULL DEFAULT 1 COMMENT '关联类型 1/分销 2/股东分红 3/区域代理 4/团队分红 5/门店佣金 6/积分提现 7/社区团购 8/代理股东',
    `relate_ids` varchar(1000) NOT NULL DEFAULT '' COMMENT '关联id组',
    `out_batch_no` varchar(50) NOT NULL DEFAULT '' COMMENT '商家批次单号',
    `request_message` varchar(2000) NOT NULL COMMENT '请求信息',
    `return_message` varchar(2000) NOT NULL DEFAULT '' COMMENT '返回信息',
    `create_time` int(11) NOT NULL COMMENT '记录创建时间',
    `update_time` int(11) NOT NULL DEFAULT 0 COMMENT '记录修改时间',
    PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='提现记录表';

