From 4cc44430944b180b992509d6dbbddd6070e2c4a4 Mon Sep 17 00:00:00 2001 From: Himit_ZH <372347736@qq.com> Date: Tue, 21 Sep 2021 18:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + sqlAndsetting/hoj-update.sql | 77 +++++++++++++++++++++++++++++++++++- sqlAndsetting/hoj.sql | 24 ++++++++++- 3 files changed, 99 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2b126aff..af9d72d8 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ docker ps # 查看当前运行的容器状态 | 2021-06-14 | 完善后台管理员权限控制,恢复CF的vjudge判题 | Himit_ZH | | 2021-06-25 | 丰富前端操作,增加POJ的vjudge判题 | Himit_ZH | | 2021-08-14 | 增加spj对使用testlib的支持 | Himit_ZH | +| 2021-09-21 | 增加比赛打印功能、账号限制功能 | Himit_ZH | ## 五、部分截图 diff --git a/sqlAndsetting/hoj-update.sql b/sqlAndsetting/hoj-update.sql index 6b442c1e..a46794dd 100644 --- a/sqlAndsetting/hoj-update.sql +++ b/sqlAndsetting/hoj-update.sql @@ -17,9 +17,9 @@ IF NOT EXISTS ( information_schema.`COLUMNS` WHERE table_name = 'judge' - AND column_name = 'oi_rank_score' + AND column_name = 'oi_rank' ) THEN - ALTER TABLE judge ADD COLUMN oi_rank_score INT(11) NULL COMMENT '该题在OI排行榜的分数'; + ALTER TABLE judge ADD COLUMN oi_rank INT(11) NULL COMMENT '该题在OI排行榜的分数'; END IF ; END$$ @@ -59,3 +59,76 @@ CALL judge_Add_vjudge_submit_id ; DROP PROCEDURE judge_Add_vjudge_submit_id; + +/* +* 2021.09.21 比赛增加打印、账号限制的功能,增大真实姓名长度 +*/ + +DROP PROCEDURE +IF EXISTS contest_Add_print_and_limit; +DELIMITER $$ + +CREATE PROCEDURE contest_Add_print_and_limit () +BEGIN + +IF NOT EXISTS ( + SELECT + 1 + FROM + information_schema.`COLUMNS` + WHERE + table_name = 'contest' + AND column_name = 'open_print' +) THEN + ALTER TABLE contest ADD COLUMN open_print tinyint(1) DEFAULT '0' COMMENT '是否打开打印功能'; + ALTER TABLE contest ADD COLUMN open_account_limit tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制'; + ALTER TABLE contest ADD COLUMN account_limit_rule mediumtext COMMENT '账号限制规则'; + ALTER TABLE `hoj`.`user_info` CHANGE `realname` `realname` VARCHAR(100) CHARSET utf8 COLLATE utf8_general_ci NULL COMMENT '真实姓名'; +END +IF ; END$$ + +DELIMITER ; +CALL contest_Add_print_and_limit ; + +DROP PROCEDURE contest_Add_print_and_limit; + + + +DROP PROCEDURE +IF EXISTS Add_contest_print; +DELIMITER $$ + +CREATE PROCEDURE Add_contest_print () +BEGIN + +IF NOT EXISTS ( + SELECT + 1 + FROM + information_schema.`COLUMNS` + WHERE + table_name = 'contest_print' +) THEN + CREATE TABLE `contest_print` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(100) DEFAULT NULL, + `realname` varchar(100) DEFAULT NULL, + `cid` bigint(20) unsigned DEFAULT NULL, + `content` longtext NOT NULL, + `status` int(11) DEFAULT '0', + `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, + `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `cid` (`cid`), + KEY `username` (`username`), + CONSTRAINT `contest_print_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `contest` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `contest_print_ibfk_2` FOREIGN KEY (`username`) REFERENCES `user_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +END +IF ; END$$ + +DELIMITER ; +CALL Add_contest_print ; + +DROP PROCEDURE Add_contest_print; + diff --git a/sqlAndsetting/hoj.sql b/sqlAndsetting/hoj.sql index a172e06a..cc491105 100644 --- a/sqlAndsetting/hoj.sql +++ b/sqlAndsetting/hoj.sql @@ -144,6 +144,9 @@ CREATE TABLE `contest` ( `seal_rank_time` datetime DEFAULT NULL COMMENT '封榜起始时间,一直到比赛结束,不刷新榜单', `status` int(11) DEFAULT NULL COMMENT '-1为未开始,0为进行中,1为已结束', `visible` tinyint(1) DEFAULT '1' COMMENT '是否可见', + `open_print` tinyint(1) DEFAULT '0' COMMENT '是否打开打印功能', + `open_account_limit` tinyint(1) DEFAULT '0' COMMENT '是否开启账号限制', + `account_limit_rule` mediumtext COMMENT '账号限制规则', `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`,`uid`), @@ -188,6 +191,25 @@ CREATE TABLE `contest_explanation` ( /*Table structure for table `contest_problem` */ +DROP TABLE IF EXISTS `contest_print`; + +CREATE TABLE `contest_print` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `username` varchar(100) DEFAULT NULL, + `realname` varchar(100) DEFAULT NULL, + `cid` bigint(20) unsigned DEFAULT NULL, + `content` longtext NOT NULL, + `status` int(11) DEFAULT '0', + `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP, + `gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `cid` (`cid`), + KEY `username` (`username`), + CONSTRAINT `contest_print_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `contest` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `contest_print_ibfk_2` FOREIGN KEY (`username`) REFERENCES `user_info` (`username`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + DROP TABLE IF EXISTS `contest_problem`; CREATE TABLE `contest_problem` ( @@ -689,7 +711,7 @@ CREATE TABLE `user_info` ( `school` varchar(100) DEFAULT NULL COMMENT '学校', `course` varchar(100) DEFAULT NULL COMMENT '专业', `number` varchar(20) DEFAULT NULL COMMENT '学号', - `realname` varchar(10) DEFAULT NULL COMMENT '真实姓名', + `realname` varchar(100) DEFAULT NULL COMMENT '真实姓名', `github` varchar(255) DEFAULT NULL COMMENT 'github地址', `blog` varchar(255) DEFAULT NULL COMMENT '博客地址', `cf_username` varchar(255) DEFAULT NULL COMMENT 'cf的username',