Files
game_server/docs/game.sql
zyh e7d36d5723 fix: 修复LinkTaskMapper中target_score列不存在的SQL错误
- 移除LinkTaskMapper.xml中所有对不存在的target_score列的引用
- 修复因SQL查询不存在列导致的BadSqlGrammarException
- 添加TargetScoreResponse DTO用于目标点数响应
- 更新LinkController添加获取目标点数接口
- 优化UserLinkStatusResponse添加machineId字段
- 更新数据库schema文档

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 19:26:11 +08:00

170 lines
12 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Navicat Premium Dump SQL
Source Server : 192.140.164.137_3306
Source Server Type : MySQL
Source Server Version : 50744 (5.7.44-log)
Source Host : 192.140.164.137:3306
Source Schema : login_task_db
Target Server Type : MySQL
Target Server Version : 50744 (5.7.44-log)
File Encoding : 65001
Date: 29/08/2025 19:16:57
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for agent_points_tx
-- ----------------------------
DROP TABLE IF EXISTS `agent_points_tx`;
CREATE TABLE `agent_points_tx` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`account_id` bigint(20) UNSIGNED NOT NULL,
`type` enum('ADD','DEDUCT') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`before_points` bigint(20) UNSIGNED NOT NULL,
`delta_points` bigint(20) NOT NULL,
`after_points` bigint(20) UNSIGNED NOT NULL,
`reason` enum('create_links','manual','refund_no_rollback','other') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'other',
`ref_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`operator_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_apx_account_time`(`account_id`, `created_at`) USING BTREE,
INDEX `fk_apx_operator`(`operator_id`) USING BTREE,
CONSTRAINT `fk_apx_account` FOREIGN KEY (`account_id`) REFERENCES `user_account` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fk_apx_operator` FOREIGN KEY (`operator_id`) REFERENCES `user_account` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for announcement
-- ----------------------------
DROP TABLE IF EXISTS `announcement`;
CREATE TABLE `announcement` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`enabled` tinyint(1) NOT NULL DEFAULT 1,
`jump_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for link_batch
-- ----------------------------
DROP TABLE IF EXISTS `link_batch`;
CREATE TABLE `link_batch` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`agent_id` bigint(20) UNSIGNED NOT NULL,
`quantity` int(10) UNSIGNED NOT NULL,
`times` int(10) UNSIGNED NOT NULL,
`operator_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_lb_agent_time`(`agent_id`, `created_at`) USING BTREE,
INDEX `fk_lb_operator`(`operator_id`) USING BTREE,
CONSTRAINT `fk_lb_agent` FOREIGN KEY (`agent_id`) REFERENCES `user_account` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fk_lb_operator` FOREIGN KEY (`operator_id`) REFERENCES `user_account` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for link_task
-- ----------------------------
DROP TABLE IF EXISTS `link_task`;
CREATE TABLE `link_task` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`batch_id` bigint(20) UNSIGNED NOT NULL,
`agent_id` bigint(20) UNSIGNED NOT NULL,
`code_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`token_hash` char(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`expire_at` datetime(3) NOT NULL,
`status` enum('NEW','USING','LOGGED_IN','COMPLETED','REFUNDED','EXPIRED') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NEW',
`region` enum('Q','V') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`machine_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`login_at` datetime(3) NULL DEFAULT NULL,
`refund_at` datetime(3) NULL DEFAULT NULL,
`revoked_at` datetime(3) NULL DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
`need_refresh` tinyint(1) NULL DEFAULT 0 COMMENT '是否需要刷新0否1是',
`refresh_time` datetime(3) NULL DEFAULT NULL COMMENT '刷新时间',
`qr_created_at` datetime(3) NULL DEFAULT NULL COMMENT '二维码创建时间',
`qr_expire_at` datetime(3) NULL DEFAULT NULL COMMENT '二维码过期时间',
`first_region_select_at` datetime(3) NULL DEFAULT NULL COMMENT '首次选区时间',
`completed_points` int(10) UNSIGNED NULL DEFAULT NULL COMMENT '完成时的点数',
`completion_images` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '完成图片JSON存储4张图片URL',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_code_no`(`code_no`) USING BTREE,
UNIQUE INDEX `uk_token_hash`(`token_hash`) USING BTREE,
INDEX `idx_agent_status`(`agent_id`, `status`) USING BTREE,
INDEX `idx_expire_at`(`expire_at`) USING BTREE,
INDEX `idx_created_at`(`created_at`) USING BTREE,
INDEX `fk_lt_batch`(`batch_id`) USING BTREE,
INDEX `idx_need_refresh`(`need_refresh`) USING BTREE,
INDEX `idx_qr_expire`(`qr_expire_at`) USING BTREE,
INDEX `idx_first_region_select`(`first_region_select_at`) USING BTREE,
CONSTRAINT `fk_lt_agent` FOREIGN KEY (`agent_id`) REFERENCES `user_account` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `fk_lt_batch` FOREIGN KEY (`batch_id`) REFERENCES `link_batch` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 78 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for operation_log
-- ----------------------------
DROP TABLE IF EXISTS `operation_log`;
CREATE TABLE `operation_log` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`actor_type` enum('admin','agent','system','user') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`actor_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`code_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`op` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`detail` json NULL,
`client_ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`user_agent` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_log_code_time`(`code_no`, `created_at`) USING BTREE,
INDEX `idx_log_time`(`created_at`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for system_config
-- ----------------------------
DROP TABLE IF EXISTS `system_config`;
CREATE TABLE `system_config` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`config_key` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置键',
`config_value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '配置值',
`config_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'STRING' COMMENT '配置类型STRING, INTEGER, BOOLEAN, JSON',
`description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '配置描述',
`is_system` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否系统配置1是0否',
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_config_key`(`config_key`) USING BTREE,
INDEX `idx_config_type`(`config_type`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Table structure for user_account
-- ----------------------------
DROP TABLE IF EXISTS `user_account`;
CREATE TABLE `user_account` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_type` enum('ADMIN','AGENT') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`username` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`password_hash` varchar(120) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`status` enum('ENABLED','DISABLED') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'ENABLED',
`points_balance` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`created_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updated_at` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `username`(`username`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;