chore(web): fix style

This commit is contained in:
Baoshuo Ren 2022-03-20 17:19:07 +08:00
parent ebdd8f2208
commit e3fc955b75
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
4 changed files with 48 additions and 32 deletions

View File

@ -16,9 +16,13 @@
function ($x) { function ($x) {
global $contest; global $contest;
if (!validateUsername($x)) return '用户名不合法'; if (!validateUsername($x)) {
return '用户名不合法';
}
$user = queryUser($x); $user = queryUser($x);
if (!$user) return '用户不存在'; if (!$user) {
return '用户不存在';
}
if (hasRegistered($user, $contest)) { if (hasRegistered($user, $contest)) {
return '该用户已经报名'; return '该用户已经报名';
@ -34,7 +38,9 @@
$username = $_POST['new_username']; $username = $_POST['new_username'];
$user = queryUser($username); $user = queryUser($username);
if (!$user) return; if (!$user) {
return;
}
DB::query("replace into contests_registrants (username, user_rating, contest_id, has_participated) values ('{$user['username']}', {$user['rating']}, {$contest['id']}, 0)"); DB::query("replace into contests_registrants (username, user_rating, contest_id, has_participated) values ('{$user['username']}', {$user['rating']}, {$contest['id']}, 0)");
@ -47,9 +53,13 @@
function ($x) { function ($x) {
global $contest; global $contest;
if (!validateUInt($x)) return '小组 ID 不合法'; if (!validateUInt($x)) {
return '小组 ID 不合法';
}
$group = queryGroup($x); $group = queryGroup($x);
if (!$group) return '小组不存在'; if (!$group) {
return '小组不存在';
}
return ''; return '';
}, },

View File

@ -37,9 +37,13 @@
function ($x) { function ($x) {
global $group_id; global $group_id;
if (!validateUsername($x)) return '用户名不合法'; if (!validateUsername($x)) {
return '用户名不合法';
}
$user = queryUser($x); $user = queryUser($x);
if (!$user) return '用户不存在'; if (!$user) {
return '用户不存在';
}
if (queryUserInGroup($group_id, $x)) { if (queryUserInGroup($group_id, $x)) {
return '该用户已经在小组中'; return '该用户已经在小组中';
@ -64,7 +68,9 @@
function ($x) { function ($x) {
global $group_id; global $group_id;
if (!validateUsername($x)) return '用户名不合法'; if (!validateUsername($x)) {
return '用户名不合法';
}
if (!queryUserInGroup($group_id, $x)) { if (!queryUserInGroup($group_id, $x)) {
return '该用户不在小组中'; return '该用户不在小组中';
} }