{"id":27075981,"url":"https://github.com/chanmeng666/douyin-mall","last_synced_at":"2025-04-06T00:19:18.491Z","repository":{"id":280663529,"uuid":"917632380","full_name":"ChanMeng666/douyin-mall","owner":"ChanMeng666","description":"📦 基于Spring Boot + Redis + RabbitMQ的抖音电商平台系统，提供完整的用户管理、商品管理、购物车、订单处理等功能 | Full-featured Douyin E-commerce platform based on Spring Boot, Redis and RabbitMQ","archived":false,"fork":false,"pushed_at":"2025-03-04T16:11:09.000Z","size":741,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T17:24:55.901Z","etag":null,"topics":["alibaba-cloud","authentication","chinese","docker","douyin-mall","e-commerce","jwt","microservices","payment-system","rabbitmq","redis","shopping-cart","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChanMeng666.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-16T11:04:16.000Z","updated_at":"2025-03-04T16:11:13.000Z","dependencies_parsed_at":"2025-03-04T17:24:59.133Z","dependency_job_id":"8bd2a8eb-b848-4d52-a211-50f7698fd385","html_url":"https://github.com/ChanMeng666/douyin-mall","commit_stats":null,"previous_names":["chanmeng666/douyin-mall"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanMeng666%2Fdouyin-mall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanMeng666%2Fdouyin-mall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanMeng666%2Fdouyin-mall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanMeng666%2Fdouyin-mall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChanMeng666","download_url":"https://codeload.github.com/ChanMeng666/douyin-mall/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247416785,"owners_count":20935529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alibaba-cloud","authentication","chinese","docker","douyin-mall","e-commerce","jwt","microservices","payment-system","rabbitmq","redis","shopping-cart","spring-boot","spring-security"],"created_at":"2025-04-06T00:19:17.921Z","updated_at":"2025-04-06T00:19:18.474Z","avatar_url":"https://github.com/ChanMeng666.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 抖音商城项目(后端)\n\n\u003e [!IMPORTANT]\n\u003e 本项目是由\"重生之我在青训营敲代码\"团队（队伍编号：115）开发\n\n## 项目简介\n抖音商城是一个基于Spring Boot的电商平台后端系统,采用前后端分离架构。后端提供RESTful API接口,前端使用Vue3进行开发。本项目实现了完整的电商业务流程,包括用户管理、商品管理、购物车、订单处理等核心功能。\n\n## 系统架构\n### 技术选型\n- 开发语言：Java 8\n- 项目框架：Spring Boot 2.7.12\n- 数据存储：MySQL 8.0 + Redis 6.0\n- 项目管理：Maven 3.6+\n- 数据库连接池：HikariCP\n- ORM框架：MyBatis\n- 安全框架：Spring Security + JWT\n- 分布式缓存：Redisson\n- 定时任务：Spring Task\n\n### 数据库设计\n#### 主要数据表\n1. 用户表(users)\n```sql\nCREATE TABLE users (\n    user_id INT AUTO_INCREMENT PRIMARY KEY,\n    username VARCHAR(255) NOT NULL UNIQUE,\n    password VARCHAR(255) NOT NULL,\n    email VARCHAR(255) UNIQUE,\n    phone VARCHAR(20),\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    status ENUM('active', 'inactive') DEFAULT 'active'\n);\n```\n\n2. 商品表(products)\n```sql\nCREATE TABLE products (\n    product_id INT AUTO_INCREMENT PRIMARY KEY,\n    name VARCHAR(255) NOT NULL,\n    description TEXT,\n    price DECIMAL(10, 2) NOT NULL,\n    stock INT NOT NULL,\n    image_url varchar(2048) DEFAULT NULL COMMENT '商品展示图',\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    status ENUM('active', 'inactive') DEFAULT 'active'\n);\n```\n\n3. 购物车表(carts)\n```sql\nCREATE TABLE carts (\n    cart_id INT AUTO_INCREMENT PRIMARY KEY,\n    user_id INT NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    INDEX (user_id)\n);\n```\n\n4. 购物车商品表(cart_items)\n```sql\nCREATE TABLE cart_items (\n    cart_item_id INT AUTO_INCREMENT PRIMARY KEY,\n    cart_id INT NOT NULL,\n    product_id INT NOT NULL,\n    quantity INT NOT NULL,\n    total_price DECIMAL(10, 2) NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n    INDEX (cart_id),\n    INDEX (product_id)\n);\n```\n\n5. 订单表(orders)\n```sql\nCREATE TABLE orders (\n    order_id INT AUTO_INCREMENT PRIMARY KEY,\n    user_id INT NOT NULL,\n    total_amount DECIMAL(10, 2) NOT NULL,\n    status ENUM('PAY_WAIT', 'HAVE_PAID', 'CANCELLED') DEFAULT 'PAY_WAIT',\n    pay_type VARCHAR(20),\n    pay_time TIMESTAMP NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n);\n```\n\n## 核心功能模块\n\n### 1. 商品管理模块\n#### 主要接口\n- 创建商品: POST `/api/product/create`\n- 修改商品: PUT `/api/product/update`\n- 删除商品: DELETE `/api/product/delete`\n- 查询商品: GET `/api/product/get`\n- 商品图片上传: POST `/api/product/pic/upload`\n\n#### 示例请求\n创建商品:\n```json\nPOST /api/product/create\nContent-Type: multipart/form-data\n\nparam: {\n    \"name\": \"测试商品\",\n    \"description\": \"商品描述\",\n    \"price\": \"99.99\",\n    \"stock\": \"100\"\n}\nproductPic: [文件]\n```\n\n### 2. 购物车模块\n#### 主要接口\n- 添加商品: POST `/api/cart/add`\n- 移除商品: DELETE `/api/cart/items/{cartItemId}`\n- 查询购物车: GET `/api/cart/user/{userId}`\n\n#### 示例请求\n添加商品到购物车:\n```json\nPOST /api/cart/add\n{\n    \"userId\": 1,\n    \"productId\": 1,\n    \"quantity\": 2\n}\n```\n\n### 3. 订单模块\n#### 主要接口\n- 创建订单: POST `/api/order/create`\n- 查询历史订单: GET `/api/order/history`\n- 取消订单: POST `/api/order/cancel`\n\n#### 示例请求\n创建订单:\n```json\nPOST /api/order/create\n{\n    \"userId\": 1,\n    \"cartId\": 1,\n    \"cartItemDtos\": [{\n        \"cartItemId\": 1,\n        \"productId\": 1,\n        \"quantity\": 2,\n        \"totalPrice\": 199.98\n    }],\n    \"payType\": \"ALIPAY\"\n}\n```\n\n## 项目配置与部署\n\n### 1. 环境要求\n- JDK 1.8+\n- Maven 3.6+\n- MySQL 8.0+\n- Redis 6.0+\n- IDE推荐：IntelliJ IDEA\n\n### 2. 数据库配置\n1. 创建数据库:\n```sql\nCREATE DATABASE douyin_mall DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;\n```\n\n2. 执行初始化SQL脚本:\n- 表结构: `/public/docs/mysql/douyin-mall-V1.1.0.sql`\n- 测试数据: `/public/docs/mysql/250124_douyin_mall_data_injection.sql`\n\n### 3. Redis配置\n修改`application-dev.yml`:\n```yaml\nspring:\n  redis:\n    host: localhost\n    port: 6379\n    password: your_password\n    database: 0\n```\n\n### 4. 前后端连接配置\n1. 后端跨域配置(已在WebConfig中配置):\n```java\n@Configuration\npublic class WebConfig implements WebMvcConfigurer {\n    @Override\n    public void addCorsMappings(CorsRegistry registry) {\n        registry.addMapping(\"/**\")\n                .allowedOrigins(\"http://localhost:5173\")\n                .allowedMethods(\"GET\", \"POST\", \"PUT\", \"DELETE\", \"OPTIONS\")\n                .allowedHeaders(\"*\")\n                .allowCredentials(true);\n    }\n}\n```\n\n2. 前端API配置:\n在前端项目的`.env`文件中配置后端接口地址:\n```\nVITE_API_BASE_URL=http://localhost:8080/api\n```\n\n### 5. 项目启动\n1. 克隆项目:\n```bash\ngit clone https://github.com/ChanMeng666/douyin-mall.git\ncd douyin-mall\n```\n\n2. 修改配置:\n编辑`src/main/resources/application-dev.yml`,配置数据库连接:\n```yaml\nspring:\n  datasource:\n    username: your_username\n    password: your_password\n    url: jdbc:mysql://localhost:3306/douyin_mall?useUnicode=true\u0026characterEncoding=utf8\n```\n\n3. 启动项目:\n```bash\nmvn spring-boot:run\n```\n\n4. 启动前端项目:\n```bash\ncd ../douyin-mall-frontend\nnpm install\nnpm run dev\n```\n\n### 6. 部署说明\n#### 开发环境部署\n直接使用IDE运行或使用Maven命令:\n```bash\nmvn spring-boot:run -Dspring.profiles.active=dev\n```\n\n#### 生产环境部署\n1. 打包:\n```bash\nmvn clean package -Dmaven.test.skip=true\n```\n\n2. 运行:\n```bash\njava -jar -Dspring.profiles.active=prod target/douyin-mall-1.0-SNAPSHOT.jar\n```\n\n#### Docker部署\n1. 构建镜像:\n```bash\ndocker build -t douyin-mall .\n```\n\n2. 运行容器:\n```bash\ndocker run -d -p 8080:8080 \\\n-e SPRING_PROFILES_ACTIVE=prod \\\n-e MYSQL_HOST=your_mysql_host \\\n-e REDIS_HOST=your_redis_host \\\ndouyin-mall\n```\n\n## 开发规范\n- 代码规范参考：`public/docs/仿抖音商城项目代码风格规范书-water-free.md`\n- API接口文档：`public/docs/仿抖音商城项目开发文档-water-free.md`\n- 数据流规范：`public/docs/数据流规范示例图/数据流规范示意图.md`\n\n## 项目成员及分工\n\n| **模块** | **功能** | **负责人** |\n|---|---|---|\n| **写文档，数据库表设计，接入 AI 大模型** |  | water |\n| **认证中心** | 实现身份令牌的分发、续期和校验功能 | 苏泰宇 |\n| **用户信息模块** | 注册、登录（验证码登录、密码登录）、删除用户信息等 | 苏泰宇 |\n| **商品信息模块** | 创建、删除、修改、查询、展示等 | 5 |\n| **购物车模块** | 创建、删除、添加、查询等 | chan |\n| **订单模块** | 创建订单、取消订单、超时取消功能，将订单分为已完成、待支付等 | 邓申桐 |\n| **结算与支付** | 结算、支付和取消支付功能 | 魏鑫 |\n\n## 开源协议\n本项目采用Apache-2.0协议开源，详情请参阅LICENSE文件。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanmeng666%2Fdouyin-mall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchanmeng666%2Fdouyin-mall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanmeng666%2Fdouyin-mall/lists"}