/*
 Navicat Premium Dump SQL

 Source Server         : 测试库
 Source Server Type    : MySQL
 Source Server Version : 80404 (8.4.4)
 Source Host           : 101.43.12.11:3306
 Source Schema         : cc_spa

 Target Server Type    : MySQL
 Target Server Version : 80404 (8.4.4)
 File Encoding         : 65001

 Date: 07/05/2025 14:54:10
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for categories
-- ----------------------------
DROP TABLE IF EXISTS `categories`;
CREATE TABLE `categories`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分类名称',
  `pid` int NOT NULL DEFAULT 0 COMMENT '父级分类',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '商品分类' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of categories
-- ----------------------------
INSERT INTO `categories` VALUES (1, 'Web 应用', 0, 0, 0, 0);
INSERT INTO `categories` VALUES (2, '移动端', 0, 0, 0, 0);
INSERT INTO `categories` VALUES (3, '微信小程序', 0, 0, 0, 0);

-- ----------------------------
-- Table structure for collection
-- ----------------------------
DROP TABLE IF EXISTS `collection`;
CREATE TABLE `collection`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '用户收藏表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of collection
-- ----------------------------

-- ----------------------------
-- Table structure for features
-- ----------------------------
DROP TABLE IF EXISTS `features`;
CREATE TABLE `features`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '说明',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '核心功能表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of features
-- ----------------------------

-- ----------------------------
-- Table structure for file
-- ----------------------------
DROP TABLE IF EXISTS `file`;
CREATE TABLE `file`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` int NOT NULL DEFAULT 0 COMMENT '上传者ID',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目截图地址',
  `type` int NOT NULL DEFAULT 0 COMMENT '类型 0：图片 1：视频 2：压缩包 3：excel 4：pdf',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '文件表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of file
-- ----------------------------

-- ----------------------------
-- Table structure for frameworks
-- ----------------------------
DROP TABLE IF EXISTS `frameworks`;
CREATE TABLE `frameworks`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '框架名称',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '框架表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of frameworks
-- ----------------------------
INSERT INTO `frameworks` VALUES (1, 'Laravel', 1745829979, 0, 0);

-- ----------------------------
-- Table structure for labels
-- ----------------------------
DROP TABLE IF EXISTS `labels`;
CREATE TABLE `labels`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '标签名称',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '标签表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of labels
-- ----------------------------
INSERT INTO `labels` VALUES (1, 'PHP', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (2, 'VUE', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (3, 'Golang', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (4, 'JAVA', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (5, 'HTML', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (6, 'Docker', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (7, 'Mysql', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (8, 'Redis', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (9, 'RabbitMQ', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (10, 'MongoDB', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (11, 'Javascript', 1746424986, 0, 0);
INSERT INTO `labels` VALUES (12, 'Type Javascript', 1746424986, 0, 0);

-- ----------------------------
-- Table structure for order_items
-- ----------------------------
DROP TABLE IF EXISTS `order_items`;
CREATE TABLE `order_items`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_id` int NOT NULL DEFAULT 0 COMMENT '订单ID',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `price` decimal(50, 3) NOT NULL DEFAULT 0.000 COMMENT '价格',
  `preferential_price` decimal(50, 2) NOT NULL DEFAULT 0.00 COMMENT '优惠价格',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '订单详情表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of order_items
-- ----------------------------

-- ----------------------------
-- Table structure for orders
-- ----------------------------
DROP TABLE IF EXISTS `orders`;
CREATE TABLE `orders`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_no` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '订单号',
  `user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
  `total_price` decimal(50, 3) NOT NULL DEFAULT 0.000 COMMENT '总价',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态 0：待支付 1：已支付 2：已交付 3：已完成 4：已取消',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of orders
-- ----------------------------

-- ----------------------------
-- Table structure for partners
-- ----------------------------
DROP TABLE IF EXISTS `partners`;
CREATE TABLE `partners`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '合作伙伴名称',
  `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'LOGO',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '合作伙伴表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of partners
-- ----------------------------

-- ----------------------------
-- Table structure for project_frameworks_relations
-- ----------------------------
DROP TABLE IF EXISTS `project_frameworks_relations`;
CREATE TABLE `project_frameworks_relations`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `framework_id` int NOT NULL COMMENT '框架ID',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目框架关联表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of project_frameworks_relations
-- ----------------------------

-- ----------------------------
-- Table structure for project_label_relations
-- ----------------------------
DROP TABLE IF EXISTS `project_label_relations`;
CREATE TABLE `project_label_relations`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `label_id` int NOT NULL COMMENT '标签ID',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 33 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '标签项目关联表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of project_label_relations
-- ----------------------------

-- ----------------------------
-- Table structure for projects
-- ----------------------------
DROP TABLE IF EXISTS `projects`;
CREATE TABLE `projects`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
  `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '项目标题',
  `cover` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '项目封面',
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目简介',
  `video_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '视频解说地址',
  `author_id` int NOT NULL DEFAULT 0 COMMENT '开发者',
  `category_id` int NOT NULL DEFAULT 0 COMMENT '项目分类',
  `price` decimal(50, 3) NOT NULL DEFAULT 0.000 COMMENT '价格',
  `preferential_price` decimal(50, 2) NOT NULL DEFAULT 0.00 COMMENT '优惠价格',
  `front` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '前端技术栈',
  `service` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '服务端',
  `deploy` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '部署',
  `is_selected` tinyint(1) NOT NULL DEFAULT 0 COMMENT '精选 0：否 1：是',
  `is_carousel` tinyint(1) NOT NULL DEFAULT 0 COMMENT '轮播图 0：否 1：是',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态 0：草稿 1：上架 2：下架 3：重构中',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of projects
-- ----------------------------

-- ----------------------------
-- Table structure for roles
-- ----------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '角色名称',
  `value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '角色值',
  `pid` int NOT NULL DEFAULT 0 COMMENT '上级角色',
  `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '角色说明',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of roles
-- ----------------------------
INSERT INTO `roles` VALUES (1, '超级管理员', 'admin', 0, '站长', 1745829979, 0, 0);
INSERT INTO `roles` VALUES (2, '用户', 'user', 0, '普通用户', 1745829980, 0, 0);

-- ----------------------------
-- Table structure for screenshots
-- ----------------------------
DROP TABLE IF EXISTS `screenshots`;
CREATE TABLE `screenshots`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目截图地址',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目截图表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of screenshots
-- ----------------------------

-- ----------------------------
-- Table structure for user_pay
-- ----------------------------
DROP TABLE IF EXISTS `user_pay`;
CREATE TABLE `user_pay`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `project_id` int NOT NULL DEFAULT 0 COMMENT '项目ID',
  `user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '用户购买表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user_pay
-- ----------------------------

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users`  (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `account` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '账号',
  `nick_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '昵称',
  `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '头像',
  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '邮箱',
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '登录密码',
  `balance` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '余额',
  `qr_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '微信二维码地址',
  `role_id` int NOT NULL DEFAULT 0 COMMENT '角色',
  `is_sys_notifications` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否接受邮件系统通知 0：不接受 1：接受',
  `is_collection_notifications` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否接受收藏的项目更新信息 0：不接受 1：接受',
  `is_marketing_notifications` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否接受营销信息 0：不接受 1：接受',
  `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '本次登录ip',
  `ip_table` json NOT NULL COMMENT '常用登录IP地址列表',
  `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态 0：正常 1：冻结 2：封号 3：注销',
  `last_reset_password_at` int NOT NULL DEFAULT 0 COMMENT '最后一次修改密码的时间',
  `created_at` int NOT NULL DEFAULT 0 COMMENT '注册时间',
  `updated_at` int NOT NULL DEFAULT 0 COMMENT '编辑时间',
  `deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '用户表' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of users
-- ----------------------------

SET FOREIGN_KEY_CHECKS = 1;
