/*
 Navicat Premium Data Transfer

 Source Server         : 1111
 Source Server Type    : MySQL
 Source Server Version : 80042
 Source Host           : localhost:3306
 Source Schema         : yishousup

 Target Server Type    : MySQL
 Target Server Version : 80042
 File Encoding         : 65001

 Date: 11/09/2025 21:03:28
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for banner
-- ----------------------------
DROP TABLE IF EXISTS `banner`;
CREATE TABLE `banner`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `substation_id` int NOT NULL COMMENT '分站ID',
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图片链接',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标题',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '跳转链接',
  `weight` int NOT NULL DEFAULT 99 COMMENT '显示顺序',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '轮播图' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of banner
-- ----------------------------

-- ----------------------------
-- Table structure for capital_flow
-- ----------------------------
DROP TABLE IF EXISTS `capital_flow`;
CREATE TABLE `capital_flow`  (
  `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` tinyint NOT NULL COMMENT '关联的类型',
  `type_id` int UNSIGNED NOT NULL COMMENT '关联的ID',
  `owner_type` tinyint(1) NULL DEFAULT NULL COMMENT '所属类型',
  `owner_id` int UNSIGNED NOT NULL COMMENT '所属ID',
  `create_time` int UNSIGNED NOT NULL,
  `balance` decimal(16, 6) NOT NULL COMMENT '余额',
  `transaction_amount` decimal(16, 6) UNSIGNED NOT NULL COMMENT '交易金额',
  `action` tinyint(1) NOT NULL COMMENT '加 或 减',
  `note` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `owner_type`(`owner_type` ASC, `create_time` ASC, `owner_id` ASC) USING BTREE,
  INDEX `type`(`type` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '资金流水' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of capital_flow
-- ----------------------------

-- ----------------------------
-- Table structure for card_code
-- ----------------------------
DROP TABLE IF EXISTS `card_code`;
CREATE TABLE `card_code`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `goods_id` int UNSIGNED NOT NULL,
  `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '卡密',
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '密码',
  `status` tinyint UNSIGNED NOT NULL DEFAULT 2 COMMENT '状态',
  `order_id` int NOT NULL DEFAULT 0 COMMENT '订单ID',
  `customer_id` int NOT NULL DEFAULT 0 COMMENT '会员ID',
  `create_time` int NULL DEFAULT NULL COMMENT '添加时间',
  `use_time` int NULL DEFAULT NULL COMMENT '使用时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `goods_id`(`goods_id` ASC, `status` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '卡密' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of card_code
-- ----------------------------

-- ----------------------------
-- Table structure for close_price_package
-- ----------------------------
DROP TABLE IF EXISTS `close_price_package`;
CREATE TABLE `close_price_package`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `substation_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '分站ID',
  `goods_ids` json NULL,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '密价包' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of close_price_package
-- ----------------------------

-- ----------------------------
-- Table structure for close_price_package_use
-- ----------------------------
DROP TABLE IF EXISTS `close_price_package_use`;
CREATE TABLE `close_price_package_use`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `customer_id` int SIGNED NOT NULL DEFAULT 0,
  `substation_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '分站ID',
  `close_price_package_id` int UNSIGNED NOT NULL DEFAULT 0,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `csAndPid`(`customer_id` ASC, `close_price_package_id` ASC) USING BTREE,
  INDEX `customer_id`(`customer_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '密价包使用' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of close_price_package_use
-- ----------------------------

-- ----------------------------
-- Table structure for close_price_use
-- ----------------------------
DROP TABLE IF EXISTS `close_price_use`;
CREATE TABLE `close_price_use`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `goods_id` int UNSIGNED NOT NULL,
  `customer_id` int SIGNED NOT NULL,
  `substation_id` int UNSIGNED NOT NULL COMMENT '分站ID',
  `type` tinyint UNSIGNED NOT NULL,
  `cost_price` decimal(16, 6) NULL DEFAULT NULL COMMENT '成本价',
  `mark_up` decimal(16, 6) UNSIGNED NULL DEFAULT NULL COMMENT '加价幅度',
  `create_time` int UNSIGNED NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE,
    INDEX `goods_id`(`goods_id` ASC, `customer_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '普通密价使用' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of close_price_use
-- ----------------------------

-- ----------------------------
-- Table structure for config
-- ----------------------------
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `key` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `key`(`key` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 107 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '配置' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of config
-- ----------------------------
INSERT INTO `config` VALUES (100, 'version', 'uXM7edDyY/hdcyCAoaHuWy9aah+jMfwEQCmNl867XQv3obNJJ2o4pZAsLq75+hxDwFuX5RCc8PBjKt8UihPO4jGV7LDiyyZhXSxLvK1ZkQ==');
INSERT INTO `config` VALUES (101, 'server', 'pcDIJlAW7Lgx0YGYt6Hb9fTVEYnjRQ3qYutnEasN1TOOJJeQsbPfdAi0Rz2nch9n4u0/X915OImf1vUAb0Tei/SioKEz+n4dPY8AYLju+kyaahyY9Cc5Mc28F4uL43uXk/iPPB5nXvlufl4B1yNvjtMkogBDDmGCLMyqFo+exyS9PxyQ0nnacStH/TdhAT7+kRd6FrNjgI148NRzqylOHLGIegDMHRlJavnLhAiNQlVuX4O26h67kCqXL7n2gnY3/2Kc5bgKKbv20nyZOib67HFogPZHEG+DBnAPIJ+RpoRYA1fWKAK3yD5yHYKUPbXxbmzZIkwtj6S2qezeruLceJUFNwQoANA1OcRvN5wWo4DOq+a51CkwUmntFARMUFd+');
INSERT INTO `config` VALUES (102, 'system', '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');
INSERT INTO `config` VALUES (103, 'head', '');
INSERT INTO `config` VALUES (104, 'domain', '7fLUqiNtdiWL46qKelQAP2HYYBCr0rXLXitgURoYgclgbejkoqHGd/dCy6u7tO/aE7KKgvekRXdIiRwgFHGwxGdFMkPDRl8vkbFWl5JKah3+KKJ+xk1Xgwb/UGUCjJ8WOjpOTcpMOfpoM2Way4ZnZmDCpd9XfiURp3gW4eCiw6k=');

-- ----------------------------
-- Table structure for console_account
-- ----------------------------
DROP TABLE IF EXISTS `console_account`;
CREATE TABLE `console_account`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `level` tinyint NOT NULL COMMENT '1：超级，0：系统级',
  `console_role_ids` json NULL,
  `account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `photo` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `mobile` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1：正常，2：禁用',
  `late_login_time` int UNSIGNED NULL DEFAULT NULL,
  `late_login_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `account`(`account` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '控制台帐号' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of console_account
-- ----------------------------

-- ----------------------------
-- Table structure for console_role
-- ----------------------------
DROP TABLE IF EXISTS `console_role`;
CREATE TABLE `console_role`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `explain` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
  `permission` json NULL COMMENT '权限集',
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `name`(`name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '控制台角色' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of console_role
-- ----------------------------

-- ----------------------------
-- Table structure for customer_account
-- ----------------------------
DROP TABLE IF EXISTS `customer_account`;
CREATE TABLE `customer_account`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '昵称',
  `substation_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '分站ID',
  `account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '账号',
  `level` tinyint NOT NULL DEFAULT 0 COMMENT '会员等级',
  `photo` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '头像',
  `balance` decimal(16, 6) NOT NULL COMMENT '余额',
  `password` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '密码',
  `mobile` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '手机',
  `qq` varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'QQ',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态码',
  `status_desc` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '状态描述',
  `app_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'AppID',
  `app_secret` char(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'AppSecret',
  `ip_white_list` json NULL COMMENT 'IP白名单',
  `late_login_time` int UNSIGNED NULL DEFAULT NULL COMMENT '上次登录时间',
  `late_login_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '上次登录IP',
  `force_social_login` tinyint NOT NULL DEFAULT 2 COMMENT '强制第三方登录',
  `config` json NULL COMMENT '强制第三方登录',
  `create_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC, `account` ASC) USING BTREE,
  INDEX `app_id`(`app_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户账户' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of customer_account
-- ----------------------------

-- ----------------------------
-- Table structure for customer_collect
-- ----------------------------
DROP TABLE IF EXISTS `customer_collect`;
CREATE TABLE `customer_collect`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `customer_id` int UNSIGNED NOT NULL,
  `goods_id` int UNSIGNED NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `customer_id`(`customer_id` ASC, `goods_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '客户收藏' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of customer_collect
-- ----------------------------

-- ----------------------------
-- Table structure for customer_rebate
-- ----------------------------
DROP TABLE IF EXISTS `customer_rebate`;
CREATE TABLE `customer_rebate`  (
                                    `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
                                    `customer_id` bigint UNSIGNED NOT NULL,
                                    `rebate_id` bigint UNSIGNED NOT NULL,
                                    `create_time` bigint NOT NULL DEFAULT 0,
                                    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for docking_site
-- ----------------------------
DROP TABLE IF EXISTS `docking_site`;
CREATE TABLE `docking_site`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '对接站点类型',
  `domain` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '网址',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `auth` json NOT NULL COMMENT '授权信息',
  `status` tinyint(1) NOT NULL DEFAULT 2 COMMENT '状态',
  `balance` decimal(10, 2) NOT NULL COMMENT '余额',
  `sync_params` json NOT NULL COMMENT '同步参数',
  `create_time` int UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '串货对接' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of docking_site
-- ----------------------------

-- ----------------------------
-- Table structure for docking_site_sync_log
-- ----------------------------
DROP TABLE IF EXISTS `docking_site_sync_log`;
CREATE TABLE `docking_site_sync_log`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` int NOT NULL,
  `docking_site_id` int NOT NULL,
  `related_id` int NOT NULL,
  `info` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `create_time` int NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of docking_site_sync_log
-- ----------------------------

-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `is_card_code` tinyint(1) NOT NULL DEFAULT 2 COMMENT '是否卡密商品',
  `type` tinyint(1) NOT NULL COMMENT '商品类型：自营、供应商',
  `type_id` int UNSIGNED NOT NULL COMMENT '商品所属，如：供应商ID',
  `is_docking_site` tinyint UNSIGNED NOT NULL COMMENT '是否串货商品',
  `docking_site_id` int UNSIGNED NOT NULL COMMENT '串货站点ID',
  `docking_site_goods_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '串货站点商品ID',
  `goods_category_id` int UNSIGNED NOT NULL COMMENT '商品分类',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `tag` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品属性',
  `weight` int UNSIGNED NULL DEFAULT 0 COMMENT '权重',
  `price` decimal(16, 8) UNSIGNED NOT NULL COMMENT '供货单价',
  `price_show_num` int NOT NULL DEFAULT 1 COMMENT '价格显示数量',
  `stock` int NOT NULL DEFAULT -1 COMMENT '商品库存',
  `unit` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '商品单位',
  `buy_rate` int UNSIGNED NOT NULL DEFAULT 1 COMMENT '购买基数',
  `buy_max_limit` int UNSIGNED NOT NULL DEFAULT 999999999 COMMENT '最大购买数量',
  `buy_min_limit` int UNSIGNED NOT NULL DEFAULT 1 COMMENT '最小购买数量',
  `buy_params` json NULL COMMENT '下单参数',
  `is_repeat` tinyint(1) NOT NULL DEFAULT 2 COMMENT '允许重复下单',
  `is_close` tinyint(1) NOT NULL DEFAULT 2 COMMENT '是否关闭下单',
  `is_batch` tinyint(1) NOT NULL DEFAULT 2 COMMENT '是否允许批量',
  `is_seckill` tinyint(1) NOT NULL DEFAULT 2 COMMENT '是否是秒杀',
  `refund_status` json NULL COMMENT '允许退单状态',
  `image_urls` json NULL COMMENT '商品展示图片',
  `particulars` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '商品详情介绍',
  `description` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '商品简介',
  `about_ordering` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '购买提醒',
  `status` tinyint(1) NOT NULL DEFAULT 2 COMMENT '状态',
  `remarks` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '备注/审批',
  `create_time` int UNSIGNED NULL DEFAULT 0 COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品列表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of goods
-- ----------------------------

-- ----------------------------
-- Table structure for goods_category
-- ----------------------------
DROP TABLE IF EXISTS `goods_category`;
CREATE TABLE `goods_category`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `parent_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级分类ID',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图标',
  `weight` int NOT NULL DEFAULT 0 COMMENT '权重',
  `show` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'all' COMMENT '显示模式',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '说明',
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `parent_id`(`parent_id` ASC, `name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品分类' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of goods_category
-- ----------------------------

-- ----------------------------
-- Table structure for goods_mark_up
-- ----------------------------
DROP TABLE IF EXISTS `goods_mark_up`;
CREATE TABLE `goods_mark_up`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '分站ID',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `type` tinyint NOT NULL COMMENT '加价方式 1/2',
  `sl1` decimal(16, 6) NOT NULL COMMENT '分站',
  `sl2` decimal(16, 6) NOT NULL,
  `sl3` decimal(16, 6) NOT NULL,
  `cl1` decimal(16, 6) NOT NULL COMMENT '会员',
  `cl2` decimal(16, 6) NOT NULL,
  `cl3` decimal(16, 6) NOT NULL,
  `cl4` decimal(16, 6) NOT NULL,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `substation_id`(`substation_id` ASC, `name` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品加价模板' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of goods_mark_up
-- ----------------------------

-- ----------------------------
-- Table structure for goods_mark_up_bind
-- ----------------------------
DROP TABLE IF EXISTS `goods_mark_up_bind`;
CREATE TABLE `goods_mark_up_bind`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NULL DEFAULT NULL,
  `goods_id` int UNSIGNED NULL DEFAULT NULL,
  `goods_mark_up_id` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `substation_id`(`substation_id` ASC, `goods_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品加价模板绑定' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of goods_mark_up_bind
-- ----------------------------

-- ----------------------------
-- Table structure for goods_price_log
-- ----------------------------
DROP TABLE IF EXISTS `goods_price_log`;
CREATE TABLE `goods_price_log`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `goods_id` int NOT NULL,
  `old_price` decimal(16, 6) NOT NULL,
  `new_price` decimal(16, 6) NOT NULL,
  `create_time` int NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品价格记录' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of goods_price_log
-- ----------------------------

-- ----------------------------
-- Table structure for goods_rebate
-- ----------------------------
DROP TABLE IF EXISTS `goods_rebate`;
CREATE TABLE `goods_rebate`  (
                                 `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
                                 `group_id` bigint UNSIGNED NOT NULL,
                                 `goods_id` bigint UNSIGNED NOT NULL,
                                 `ratio` decimal(10, 4) NOT NULL,
                                 `create_time` bigint NOT NULL DEFAULT 0,
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for invite_code
-- ----------------------------
DROP TABLE IF EXISTS `invite_code`;
CREATE TABLE `invite_code`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `customer_id` int NULL DEFAULT NULL COMMENT '客户ID',
  `substation_id` int NOT NULL DEFAULT '0' COMMENT '站点id',
  `status` tinyint NOT NULL COMMENT '状态码',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邀请码',
  `create_time` int NULL DEFAULT NULL COMMENT '添加时间',
  `use_time` int NULL DEFAULT NULL COMMENT '使用时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '注册邀请码' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of invite_code
-- ----------------------------

-- ----------------------------
-- Table structure for login_record
-- ----------------------------
DROP TABLE IF EXISTS `login_record`;
CREATE TABLE `login_record`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `ower_id` int NOT NULL COMMENT '会员编号',
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '登录方式',
  `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'IP',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  `ower_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户类型',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `customer_id`(`ower_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '登录记录' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of login_record
-- ----------------------------

-- ----------------------------
-- Table structure for lottery_prize
-- ----------------------------
DROP TABLE IF EXISTS `lottery_prize`;
CREATE TABLE `lottery_prize`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图片',
  `type` tinyint NOT NULL DEFAULT 0 COMMENT '类型',
  `status` tinyint NOT NULL DEFAULT 2 COMMENT '状态',
  `balance` decimal(10, 2) NOT NULL COMMENT '奖励余额',
  `goods_id` int NOT NULL DEFAULT 0 COMMENT '奖励商品编号',
  `goods_buy_number` int NOT NULL DEFAULT 0 COMMENT '奖励商品数量',
  `surplus` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '剩余份数',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '抽奖奖品' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of lottery_prize
-- ----------------------------

-- ----------------------------
-- Table structure for lottery_record
-- ----------------------------
DROP TABLE IF EXISTS `lottery_record`;
CREATE TABLE `lottery_record`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `customer_id` int NOT NULL COMMENT '会员ID',
  `lottery_prize_id` int NOT NULL COMMENT '奖品ID',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
  `exchange_time` int NULL DEFAULT NULL COMMENT '兑换时间',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '中奖记录' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of lottery_record
-- ----------------------------

-- ----------------------------
-- Table structure for notice
-- ----------------------------
DROP TABLE IF EXISTS `notice`;
CREATE TABLE `notice`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `substation_id` int NOT NULL COMMENT '分站ID',
  `type` tinyint NOT NULL COMMENT '类型',
  `always` tinyint(1) NOT NULL DEFAULT 2 COMMENT '总是弹窗',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标题',
  `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '内容',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC, `type` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '公告' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of notice
-- ----------------------------

-- ----------------------------
-- Table structure for order
-- ----------------------------
DROP TABLE IF EXISTS `order`;
CREATE TABLE `order`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NOT NULL,
  `goods_id` int UNSIGNED NOT NULL COMMENT '商品ID',
  `customer_id` int UNSIGNED NOT NULL COMMENT '客户ID',
  `selling_price` decimal(16, 6) UNSIGNED NOT NULL COMMENT '订单单价',
  `amount` decimal(16, 6) UNSIGNED NOT NULL COMMENT '订单金额',
  `buy_number` int UNSIGNED NOT NULL COMMENT '购买数量',
  `refund_amount` decimal(16, 6) NULL DEFAULT NULL COMMENT '退款购买金额',
  `bonus_params` json NULL COMMENT '分红参数',
  `buy_params` json NULL COMMENT '下单参数',
  `parameter` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '主要参数',
  `is_docking_site` tinyint NOT NULL DEFAULT 0 COMMENT '是否串货订单',
  `docking_site_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '串货站点ID',
  `start_num` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单执行开始数量',
  `current_num` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单执行当前数量',
  `callback_order_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '串货回调订单',
  `callback_error_msg` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '串货失败原因',
  `callback_error_times` int NOT NULL DEFAULT 0 COMMENT '串货失败次数',
  `is_card_code` tinyint(1) NOT NULL COMMENT '是否卡密订单',
  `card_code_ids` json NULL COMMENT '出售的卡密ID集合',
  `status_changes` json NULL COMMENT '记录订单状态修改时间',
  `status` tinyint(1) NOT NULL COMMENT '订单状态',
  `remark` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '备注',
  `extra` json NULL COMMENT '额外信息',
  `customer_order_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '客户订单号',
  `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '下单IP',
  `create_time` int UNSIGNED NULL DEFAULT 0 COMMENT '下单时间',
  `delay_syn_time` int NOT NULL DEFAULT -1 COMMENT '延迟同步时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC) USING BTREE,
  INDEX `customer_id`(`customer_id` ASC, `customer_order_id` ASC) USING BTREE,
  INDEX `docking_site_id`(`docking_site_id` ASC) USING BTREE,
  INDEX `is_docking_site`(`is_docking_site` ASC, `callback_order_id` ASC) USING BTREE,
  INDEX `parameter`(`parameter` ASC) USING BTREE,
  INDEX `status`(`status` ASC, `create_time` ASC) USING BTREE,
  INDEX `create_time`(`create_time` ASC) USING BTREE,
  INDEX `create_time_2`(`create_time` ASC) USING BTREE,
  INDEX `idx_delay_syn_time`(`delay_syn_time` ASC) USING BTREE,
  INDEX `goods_id`(`goods_id` ASC, `status` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '商品订单' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of order
-- ----------------------------

-- ----------------------------
-- Table structure for order_bonus
-- ----------------------------
DROP TABLE IF EXISTS `order_bonus`;
CREATE TABLE `order_bonus`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `order_id` int UNSIGNED NOT NULL COMMENT '订单ID',
  `type` tinyint(1) NOT NULL COMMENT '分红类型',
  `owner_type` tinyint(1) NOT NULL COMMENT '所属类型，如：客户、供应商、自营',
  `owner_id` int UNSIGNED NOT NULL COMMENT '所属ID',
  `note` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '描述',
  `amount` decimal(16, 6) UNSIGNED NOT NULL COMMENT '金额',
  `expire_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '到期时间',
  `status` tinyint(1) NOT NULL COMMENT '状态，是否到账',
  `create_time` int UNSIGNED NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `owner_type`(`owner_type` ASC, `owner_id` ASC) USING BTREE,
  INDEX `status`(`status` ASC, `expire_time` ASC) USING BTREE,
  INDEX `create_time`(`create_time` ASC) USING BTREE,
  INDEX `create_time_2`(`create_time` ASC) USING BTREE,
  INDEX `order_id`(`order_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '订单分红' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of order_bonus
-- ----------------------------

-- ----------------------------
-- Table structure for order_rebate
-- ----------------------------
DROP TABLE IF EXISTS `order_rebate`;
CREATE TABLE `order_rebate`  (
                                 `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
                                 `order_id` bigint UNSIGNED NOT NULL,
                                 `customer_id` bigint UNSIGNED NOT NULL,
                                 `rebate_amount` decimal(16, 6) NOT NULL,
                                 `status` tinyint NOT NULL DEFAULT 2,
                                 `rebate_time` bigint NOT NULL DEFAULT 0,
                                 `create_time` bigint NOT NULL DEFAULT 0,
                                 `note` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Table structure for pay_config
-- ----------------------------
DROP TABLE IF EXISTS `pay_config`;
CREATE TABLE `pay_config`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付平台',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `status` tinyint NOT NULL COMMENT '状态',
  `config` json NOT NULL COMMENT '配置',
  `methods` json NOT NULL COMMENT '支持支付方式',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  `rebate_rate` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '返利比率',
  `rebate_start_point` bigint NOT NULL DEFAULT '0' COMMENT '充值满xx元开始返利',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '支付配置' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of pay_config
-- ----------------------------
-- ----------------------------
-- Table structure for rebate_group
-- ----------------------------
DROP TABLE IF EXISTS `rebate_group`;
CREATE TABLE `rebate_group`  (
                                 `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
                                 `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
                                 `create_time` bigint NOT NULL DEFAULT 0,
                                 PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for recharge_record
-- ----------------------------
DROP TABLE IF EXISTS `recharge_record`;
CREATE TABLE `recharge_record`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NOT NULL COMMENT '分站ID',
  `customer_id` int UNSIGNED NOT NULL COMMENT '会员ID',
  `pay_config_id` int NOT NULL COMMENT '支付配置ID',
  `status` tinyint(1) NOT NULL COMMENT '充值状态',
  `type` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '充值类型',
  `amount` decimal(12, 2) UNSIGNED NOT NULL COMMENT '充值金额',
  `fee` decimal(12, 2) NOT NULL COMMENT '手续费',
  `method` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '支付方式',
  `out_trade_no` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '交易单号',
  `random` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '识别码',
  `trade_no` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '第三方交易单号',
  `return_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '访问域名',
  `create_time` int UNSIGNED NOT NULL COMMENT '创建时间',
  `end_time` int UNSIGNED NOT NULL COMMENT '支付时间',
  `rebate_rate` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '返利比率',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC) USING BTREE,
  INDEX `customer_id`(`customer_id` ASC) USING BTREE,
  INDEX `type`(`type` ASC) USING BTREE,
  INDEX `status`(`status` ASC) USING BTREE,
  INDEX `out_trade_no`(`out_trade_no` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '充值记录\r\n' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of recharge_record
-- ----------------------------

-- ----------------------------
-- Table structure for social_user
-- ----------------------------
DROP TABLE IF EXISTS `social_user`;
CREATE TABLE `social_user`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '登录方式',
  `platform` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '第三方平台',
  `customer_id` int NOT NULL DEFAULT 0 COMMENT '会员ID',
  `open_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'OpenID',
  `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Access Token',
  `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '昵称',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '头像',
  `gender` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '性别',
  `location` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '城市',
  `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '登录IP',
  `create_time` int NULL DEFAULT NULL COMMENT '添加时间',
  `update_time` int NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `customer_id_unique`(`type` ASC, `customer_id` ASC) USING BTREE,
  UNIQUE INDEX `openid`(`type` ASC, `open_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '第三方登录用户' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of social_user
-- ----------------------------

-- ----------------------------
-- Table structure for style
-- ----------------------------
DROP TABLE IF EXISTS `style`;
CREATE TABLE `style`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `substation_id` int NOT NULL COMMENT '分站ID',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '名称',
  `theme` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'default' COMMENT '主题风格',
  `config` json NOT NULL COMMENT '配置',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` int NULL DEFAULT NULL COMMENT '最后修改',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '样式风格' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of style
-- ----------------------------

-- ----------------------------
-- Table structure for substation
-- ----------------------------
DROP TABLE IF EXISTS `substation`;
CREATE TABLE `substation`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `parent_substation_id` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '上级站点ID',
  `customer_id` int UNSIGNED NOT NULL COMMENT '站长ID',
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '站点状态',
  `version` tinyint NOT NULL COMMENT '版本',
  `logo` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT 'LOGO',
  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '名称',
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '标题',
  `description` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '描述',
  `keywords` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '关键词',
  `qq` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '联系QQ',
  `footer` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '底部代码',
  `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT 'ico',
  `config` json NULL COMMENT '配置',
  `expire_time` int UNSIGNED NOT NULL COMMENT '到期时间',
  `create_time` int UNSIGNED NULL DEFAULT NULL COMMENT '开通时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `customer_id`(`customer_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 0 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '分站' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of substation
-- ----------------------------

-- ----------------------------
-- Table structure for substation_ban_goods
-- ----------------------------
DROP TABLE IF EXISTS `substation_ban_goods`;
CREATE TABLE `substation_ban_goods`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NOT NULL,
  `goods_id` int UNSIGNED NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `substation_id`(`substation_id` ASC, `goods_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '分站禁售商品' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of substation_ban_goods
-- ----------------------------

-- ----------------------------
-- Table structure for substation_domain
-- ----------------------------
DROP TABLE IF EXISTS `substation_domain`;
CREATE TABLE `substation_domain`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'customer' COMMENT '类型',
  `substation_id` int NOT NULL COMMENT '站点ID',
  `domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '域名',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `domain`(`domain` ASC) USING BTREE,
  INDEX `substation_id`(`substation_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '分站域名' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of substation_domain
-- ----------------------------

-- ----------------------------
-- Table structure for supplier_account
-- ----------------------------
DROP TABLE IF EXISTS `supplier_account`;
CREATE TABLE `supplier_account`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `password` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `balance` decimal(16, 6) NOT NULL,
  `mobile` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `status` tinyint NULL DEFAULT NULL,
  `app_id` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `app_secret` char(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `notify_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `notify_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `ip_white_list` json NULL,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `account`(`account` ASC) USING BTREE,
  UNIQUE INDEX `app_id`(`app_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '供货商帐号' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of supplier_account
-- ----------------------------

-- ----------------------------
-- Table structure for task
-- ----------------------------
DROP TABLE IF EXISTS `task`;
CREATE TABLE `task`  (
  `id` int NOT NULL AUTO_INCREMENT,
  `type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '类型',
  `config` json NOT NULL COMMENT '任务配置',
  `start_time` int NOT NULL COMMENT '开始时间',
  `create_time` int NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '任务队列' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of task
-- ----------------------------

-- ----------------------------
-- Table structure for withdraw_account
-- ----------------------------
DROP TABLE IF EXISTS `withdraw_account`;
CREATE TABLE `withdraw_account`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `owner_type` tinyint UNSIGNED NOT NULL DEFAULT 0,
  `owner_id` int UNSIGNED NOT NULL,
  `type` tinyint(1) NOT NULL,
  `account` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `qrcode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
  `create_time` int UNSIGNED NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '提现帐号' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of withdraw_account
-- ----------------------------

-- ----------------------------
-- Table structure for withdraw_record
-- ----------------------------
DROP TABLE IF EXISTS `withdraw_record`;
CREATE TABLE `withdraw_record`  (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `substation_id` int UNSIGNED NULL DEFAULT NULL,
  `owner_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '所属类型',
  `owner_id` int UNSIGNED NOT NULL COMMENT '所属ID',
  `amount` decimal(12, 2) UNSIGNED NOT NULL,
  `fee` decimal(12, 2) NOT NULL COMMENT '手续费',
  `withdraw_type` tinyint(1) NULL DEFAULT NULL COMMENT '提现类型',
  `withdraw_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '提现名',
  `withdraw_account` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '提现账号',
  `withdraw_qrcode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '收款二维码',
  `note` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '备注',
  `status` tinyint(1) NOT NULL COMMENT '提现状态',
  `status_description` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '提现状态描述',
  `handle_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '处理时间',
  `create_time` int UNSIGNED NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '提现记录' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of withdraw_record
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;
