Browse Source
Merge branch 'milestone-20250710-jhp' of http://39.101.133.168:8807/qimaohong/ActivityProject into lottery
milestone-20250731-积分频道身份标识
Merge branch 'milestone-20250710-jhp' of http://39.101.133.168:8807/qimaohong/ActivityProject into lottery
milestone-20250731-积分频道身份标识
20 changed files with 619 additions and 38 deletions
-
38lottery-system/.gitignore
-
8lottery-system/.idea/.gitignore
-
10lottery-system/.idea/encodings.xml
-
14lottery-system/.idea/misc.xml
-
6lottery-system/.idea/vcs.xml
-
20lottery-system/lottery-common/pom.xml
-
80lottery-system/lottery-common/src/main/java/com/lottery/utils/Result.java
-
20lottery-system/lottery-pojo/pom.xml
-
46lottery-system/lottery-pojo/src/main/java/com/lottery/dto/Prize.java
-
29lottery-system/lottery-service/pom.xml
-
14lottery-system/lottery-service/src/main/java/com/lottery/LotteryApplication.java
-
44lottery-system/lottery-service/src/main/java/com/lottery/controller/admin/Test.java
-
22lottery-system/lottery-service/src/main/java/com/lottery/mapper/IPrizeMapper.java
-
17lottery-system/lottery-service/src/main/java/com/lottery/service/IPrizeService.java
-
39lottery-system/lottery-service/src/main/java/com/lottery/service/Impl/PrizeServiceImpl.java
-
41lottery-system/lottery-service/src/main/resources/application.yml
-
5lottery-system/lottery-service/src/main/resources/mapper/prizeMapper.xml
-
14lottery-system/lottery-service/src/test/java/Tset.java
-
84lottery-system/pom.xml
-
106lottery_system.sql
@ -0,0 +1,38 @@ |
|||
target/ |
|||
!.mvn/wrapper/maven-wrapper.jar |
|||
!**/src/main/**/target/ |
|||
!**/src/test/**/target/ |
|||
|
|||
### IntelliJ IDEA ### |
|||
.idea/modules.xml |
|||
.idea/jarRepositories.xml |
|||
.idea/compiler.xml |
|||
.idea/libraries/ |
|||
*.iws |
|||
*.iml |
|||
*.ipr |
|||
|
|||
### Eclipse ### |
|||
.apt_generated |
|||
.classpath |
|||
.factorypath |
|||
.project |
|||
.settings |
|||
.springBeans |
|||
.sts4-cache |
|||
|
|||
### NetBeans ### |
|||
/nbproject/private/ |
|||
/nbbuild/ |
|||
/dist/ |
|||
/nbdist/ |
|||
/.nb-gradle/ |
|||
build/ |
|||
!**/src/main/**/build/ |
|||
!**/src/test/**/build/ |
|||
|
|||
### VS Code ### |
|||
.vscode/ |
|||
|
|||
### Mac OS ### |
|||
.DS_Store |
@ -0,0 +1,8 @@ |
|||
# Default ignored files |
|||
/shelf/ |
|||
/workspace.xml |
|||
# Editor-based HTTP Client requests |
|||
/httpRequests/ |
|||
# Datasource local storage ignored files |
|||
/dataSources/ |
|||
/dataSources.local.xml |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="Encoding"> |
|||
<file url="file://$PROJECT_DIR$/lottery-common/src/main/java" charset="UTF-8" /> |
|||
<file url="file://$PROJECT_DIR$/lottery-pojo/src/main/java" charset="UTF-8" /> |
|||
<file url="file://$PROJECT_DIR$/lottery-service/src/main/java" charset="UTF-8" /> |
|||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> |
|||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> |
|||
</component> |
|||
</project> |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="ExternalStorageConfigurationManager" enabled="true" /> |
|||
<component name="MavenProjectsManager"> |
|||
<option name="originalFiles"> |
|||
<list> |
|||
<option value="$PROJECT_DIR$/pom.xml" /> |
|||
</list> |
|||
</option> |
|||
</component> |
|||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK"> |
|||
<output url="file://$PROJECT_DIR$/out" /> |
|||
</component> |
|||
</project> |
@ -0,0 +1,6 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project version="4"> |
|||
<component name="VcsDirectoryMappings"> |
|||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" /> |
|||
</component> |
|||
</project> |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.example</groupId> |
|||
<artifactId>lottery-system</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
|
|||
<artifactId>lottery-common</artifactId> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>11</maven.compiler.source> |
|||
<maven.compiler.target>11</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
|
|||
</project> |
@ -0,0 +1,80 @@ |
|||
package com.lottery.utils; |
|||
|
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName Result |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:59 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
public class Result<T> { |
|||
// 状态码(如 200 表示成功,500 表示失败) |
|||
private int code; |
|||
|
|||
// 提示信息(如 "操作成功" 或 "操作失败") |
|||
private String message; |
|||
|
|||
// 返回的数据(泛型,可以是任意类型) |
|||
private T data; |
|||
|
|||
// 成功结果(无数据) |
|||
public static <T> Result<T> success() { |
|||
Result<T> result = new Result<>(); |
|||
result.setCode(200); |
|||
result.setMessage("操作成功"); |
|||
return result; |
|||
} |
|||
|
|||
// 成功结果(带数据) |
|||
public static <T> Result<T> success(T data) { |
|||
Result<T> result = new Result<>(); |
|||
result.setCode(200); |
|||
result.setMessage("操作成功"); |
|||
result.setData(data); |
|||
return result; |
|||
} |
|||
|
|||
// 失败结果 |
|||
public static <T> Result<T> failure(int code, String message) { |
|||
Result<T> result = new Result<>(); |
|||
result.setCode(code); |
|||
result.setMessage(message); |
|||
return result; |
|||
} |
|||
|
|||
// Getter 和 Setter 方法 |
|||
public int getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(int code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getMessage() { |
|||
return message; |
|||
} |
|||
|
|||
public void setMessage(String message) { |
|||
this.message = message; |
|||
} |
|||
|
|||
public T getData() { |
|||
return data; |
|||
} |
|||
|
|||
public void setData(T data) { |
|||
this.data = data; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "Result{" + |
|||
"code=" + code + |
|||
", message='" + message + '\'' + |
|||
", data=" + data + |
|||
'}'; |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.example</groupId> |
|||
<artifactId>lottery-system</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
|
|||
<artifactId>lottery-pojo</artifactId> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>11</maven.compiler.source> |
|||
<maven.compiler.target>11</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
|
|||
</project> |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<parent> |
|||
<groupId>org.example</groupId> |
|||
<artifactId>lottery-system</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
</parent> |
|||
|
|||
<artifactId>lottery-service</artifactId> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>11</maven.compiler.source> |
|||
<maven.compiler.target>11</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>org.example</groupId> |
|||
<artifactId>lottery-pojo</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
<scope>compile</scope> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
|
|||
</project> |
@ -0,0 +1,14 @@ |
|||
package com.lottery; |
|||
|
|||
import org.springframework.boot.SpringApplication; |
|||
import org.springframework.boot.WebApplicationType; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
|
|||
import javax.swing.*; |
|||
|
|||
@SpringBootApplication |
|||
public class LotteryApplication { |
|||
public static void main(String[] args) { |
|||
SpringApplication.run(LotteryApplication.class, args); |
|||
} |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.lottery.controller.admin; |
|||
|
|||
import com.lottery.dto.Prize; |
|||
import com.lottery.service.IPrizeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.stereotype.Controller; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName Test |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:19 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
@RestController |
|||
@RequestMapping("/test") |
|||
public class Test { |
|||
@Autowired |
|||
private IPrizeService prizeService; |
|||
|
|||
|
|||
/** |
|||
// * //添加礼物到数据到数据库 |
|||
* @param prize |
|||
* @return |
|||
*/ |
|||
@PostMapping("/add") |
|||
public boolean addPrize(){ |
|||
Prize prize = new Prize(); |
|||
return prizeService.add(prize); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.lottery.mapper; |
|||
|
|||
import com.lottery.dto.Prize; |
|||
import org.apache.ibatis.annotations.Insert; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName IPrizeMapper |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:32 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
@Mapper |
|||
public interface IPrizeMapper { |
|||
|
|||
@Insert("INSERT INTO prize (name, description, image_url, stock, probability, prize_type, status, create_time, update_time) " + |
|||
"VALUES (#{name}, #{description}, #{imageUrl}, #{stock}, #{probability}, #{prizeType}, #{status}, #{createTime}, #{updateTime})") |
|||
boolean add(Prize prize); |
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.lottery.service; |
|||
|
|||
import com.lottery.dto.Prize; |
|||
|
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName IPrizeService |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:27 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
public interface IPrizeService { |
|||
boolean add(Prize prize); |
|||
|
|||
} |
@ -0,0 +1,39 @@ |
|||
package com.lottery.service.Impl; |
|||
|
|||
import com.lottery.dto.Prize; |
|||
import com.lottery.mapper.IPrizeMapper; |
|||
import com.lottery.service.IPrizeService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName PrizeServiceImpl |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:28 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
@Service |
|||
public class PrizeServiceImpl implements IPrizeService { |
|||
|
|||
@Autowired |
|||
private IPrizeMapper prizeMapper; |
|||
@Override |
|||
public boolean add(Prize prize) { |
|||
prize.setName("测试"); |
|||
prize.setDescription("测试"); |
|||
prize.setImageUrl("测试"); |
|||
prize.setStock(1); |
|||
prize.setProbability(new BigDecimal(0.1)); |
|||
prize.setPrizeType(1); |
|||
prize.setStatus(1); |
|||
|
|||
|
|||
return prizeMapper.add(prize); |
|||
} |
|||
} |
@ -0,0 +1,41 @@ |
|||
server: |
|||
port: 8080 # 服务端口 |
|||
|
|||
spring: |
|||
# ========== 数据源配置 (MySQL) ========== |
|||
datasource: |
|||
url: jdbc:mysql://localhost:3306/lottery_system?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai |
|||
username: root |
|||
password: root |
|||
driver-class-name: com.mysql.cj.jdbc.Driver |
|||
hikari: |
|||
pool-name: LotteryHikariCP |
|||
maximum-pool-size: 10 # 连接池大小 |
|||
connection-timeout: 30000 |
|||
|
|||
|
|||
# ========== Redis 配置 ========== |
|||
redis: |
|||
host: 127.0.0.1 |
|||
port: 6379 |
|||
password: # 若无密码则留空 |
|||
database: 0 # 默认DB索引 |
|||
jedis: |
|||
pool: |
|||
max-active: 8 # 最大连接数 |
|||
max-wait: 5000ms # 最大等待时间 |
|||
max-idle: 4 # 最大空闲连接 |
|||
min-idle: 1 # 最小空闲连接 |
|||
timeout: 3000ms # 连接超时时间 |
|||
|
|||
# ========== MyBatis 配置(如果使用MyBatis代替JPA) ========== |
|||
mybatis: |
|||
mapper-locations: classpath:mapper/*.xml # XML映射文件路径 |
|||
type-aliases-package: com.lottery.entity # 实体类包路径 |
|||
configuration: |
|||
map-underscore-to-camel-case: true # 开启驼峰命名转换 |
|||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印SQL日志 |
|||
|
|||
# ========== 自定义配置(示例) ========== |
|||
lottery: |
|||
max-draw-times: 3 # 用户每日最大抽奖次数 |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.lottery.mapper.IPrizeMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,14 @@ |
|||
/** |
|||
* @program: lottery-system |
|||
* @ClassName Tset |
|||
* @description: |
|||
* @author:jihaipeng |
|||
* @create: 2025−07-10 15:16 |
|||
* @Version 1.0 |
|||
**/ |
|||
|
|||
public class Tset { |
|||
public static void main(String[] args) { |
|||
|
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-parent</artifactId> |
|||
<version>2.7.0</version> <!-- 使用稳定版本,如 2.7.0 --> |
|||
<relativePath/> |
|||
</parent> |
|||
<packaging>pom</packaging> |
|||
<modules> |
|||
<module>lottery-service</module> |
|||
<module>lottery-pojo</module> |
|||
<module>lottery-common</module> |
|||
</modules> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<groupId>org.example</groupId> |
|||
<artifactId>lottery-system</artifactId> |
|||
<version>1.0-SNAPSHOT</version> |
|||
|
|||
<properties> |
|||
<maven.compiler.source>11</maven.compiler.source> |
|||
<maven.compiler.target>11</maven.compiler.target> |
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|||
</properties> |
|||
|
|||
<dependencies> |
|||
<!-- Spring Boot Starter 基础依赖 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-web</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-jpa</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.mybatis.spring.boot</groupId> |
|||
<artifactId>mybatis-spring-boot-starter</artifactId> |
|||
<version>2.2.2</version> |
|||
</dependency> |
|||
|
|||
<!-- MySQL 驱动 --> |
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<scope>runtime</scope> |
|||
</dependency> |
|||
|
|||
<!-- Redis 依赖 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-data-redis</artifactId> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>redis.clients</groupId> |
|||
<artifactId>jedis</artifactId> |
|||
</dependency> |
|||
|
|||
<!-- Lombok 简化代码 --> |
|||
<dependency> |
|||
<groupId>org.projectlombok</groupId> |
|||
<artifactId>lombok</artifactId> |
|||
<optional>true</optional> |
|||
</dependency> |
|||
|
|||
<!-- 测试依赖 --> |
|||
<dependency> |
|||
<groupId>org.springframework.boot</groupId> |
|||
<artifactId>spring-boot-starter-test</artifactId> |
|||
<scope>test</scope> |
|||
</dependency> |
|||
|
|||
<!-- 其他工具类(可选) --> |
|||
<dependency> |
|||
<groupId>org.apache.commons</groupId> |
|||
<artifactId>commons-lang3</artifactId> |
|||
<version>3.12.0</version> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
</project> |
@ -0,0 +1,106 @@ |
|||
/* |
|||
Navicat Premium Dump SQL |
|||
|
|||
Source Server : localhost_3306 |
|||
Source Server Type : MySQL |
|||
Source Server Version : 80042 (8.0.42) |
|||
Source Host : localhost:3306 |
|||
Source Schema : lottery_system |
|||
|
|||
Target Server Type : MySQL |
|||
Target Server Version : 80042 (8.0.42) |
|||
File Encoding : 65001 |
|||
|
|||
Date: 10/07/2025 15:00:53 |
|||
*/ |
|||
|
|||
SET NAMES utf8mb4; |
|||
SET FOREIGN_KEY_CHECKS = 0; |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for lottery_round |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `lottery_round`; |
|||
CREATE TABLE `lottery_round` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '轮次ID', |
|||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '轮次名称', |
|||
`start_time` datetime NOT NULL COMMENT '开始时间', |
|||
`end_time` datetime NOT NULL COMMENT '结束时间', |
|||
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '轮次描述', |
|||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0-未开始,1-进行中,2-已结束)', |
|||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
|||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|||
PRIMARY KEY (`id`) USING BTREE, |
|||
INDEX `idx_time`(`start_time` ASC, `end_time` ASC) USING BTREE |
|||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '抽奖轮次表' ROW_FORMAT = Dynamic; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of lottery_round |
|||
-- ---------------------------- |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for prize |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `prize`; |
|||
CREATE TABLE `prize` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '奖品ID', |
|||
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '奖品名称', |
|||
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '奖品描述', |
|||
`image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '奖品图片URL', |
|||
`stock` int NOT NULL DEFAULT 0 COMMENT '库存数量', |
|||
`probability` decimal(5, 4) NOT NULL COMMENT '中奖概率(0.0000-1.0000)', |
|||
`prize_type` tinyint NOT NULL COMMENT '奖品类型(1-实物,2-虚拟,3-积分)', |
|||
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态(0-下架,1-上架)', |
|||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, |
|||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
|||
PRIMARY KEY (`id`) USING BTREE |
|||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '奖品表' ROW_FORMAT = Dynamic; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of prize |
|||
-- ---------------------------- |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for user |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `user`; |
|||
CREATE TABLE `user` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户ID', |
|||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '用户名', |
|||
`phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '手机号', |
|||
`email` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '邮箱', |
|||
`status` tinyint NOT NULL DEFAULT 1 COMMENT '状态(0-禁用,1-正常)', |
|||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
|||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
|||
PRIMARY KEY (`id`) USING BTREE, |
|||
UNIQUE INDEX `idx_username`(`username` ASC) USING BTREE, |
|||
INDEX `idx_phone`(`phone` ASC) USING BTREE |
|||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '用户表' ROW_FORMAT = Dynamic; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of user |
|||
-- ---------------------------- |
|||
|
|||
-- ---------------------------- |
|||
-- Table structure for winning_record |
|||
-- ---------------------------- |
|||
DROP TABLE IF EXISTS `winning_record`; |
|||
CREATE TABLE `winning_record` ( |
|||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '记录ID', |
|||
`user_id` bigint NOT NULL COMMENT '用户ID', |
|||
`prize_id` bigint NOT NULL COMMENT '奖品ID', |
|||
`round_id` bigint NOT NULL COMMENT '抽奖轮次ID', |
|||
`win_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '中奖时间', |
|||
`is_claimed` tinyint NOT NULL DEFAULT 0 COMMENT '是否已领取(0-未领取,1-已领取)', |
|||
`claim_time` datetime NULL DEFAULT NULL COMMENT '领取时间', |
|||
PRIMARY KEY (`id`) USING BTREE, |
|||
UNIQUE INDEX `idx_user_round`(`user_id` ASC, `round_id` ASC) USING BTREE, |
|||
INDEX `idx_round`(`round_id` ASC) USING BTREE, |
|||
INDEX `idx_user`(`user_id` ASC) USING BTREE |
|||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '中奖记录表' ROW_FORMAT = Dynamic; |
|||
|
|||
-- ---------------------------- |
|||
-- Records of winning_record |
|||
-- ---------------------------- |
|||
|
|||
SET FOREIGN_KEY_CHECKS = 1; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue