diff --git a/messages/zh-CN/app.php b/messages/zh-CN/app.php index b34854686..7798b2727 100644 --- a/messages/zh-CN/app.php +++ b/messages/zh-CN/app.php @@ -77,6 +77,7 @@ 'Release news' => '发布新闻', 'Male' => '男', 'Nickname' => '昵称', + 'New Nickname' => '新昵称', 'Prefix' => '前缀', 'Number' => '数量', 'Names' => '名称', @@ -89,6 +90,7 @@ 'Verify Password' => '确认密码', 'Female' => '女', 'Major' => '专业', + 'class' => '班级', 'Contest' => '比赛', 'Title' => '标题', 'Type' => '类型', diff --git a/migrations/m180401_030422_import_initial_table.php b/migrations/m180401_030422_import_initial_table.php index a762740ae..3a764fc68 100644 --- a/migrations/m180401_030422_import_initial_table.php +++ b/migrations/m180401_030422_import_initial_table.php @@ -67,7 +67,8 @@ public function up() 'description' => $this->string(), 'school' => $this->string(), 'student_number' => $this->string(64), - 'major' => $this->string(64) + 'major' => $this->string(64), + 'class' => $this->string(64) ], $this->tableOptions); $this->execute('ALTER TABLE {{%user_profile}} ADD PRIMARY KEY(`user_id`);'); diff --git a/migrations/m190309_123832_setting.php b/migrations/m190309_123832_setting.php index e31b86439..d3deae436 100644 --- a/migrations/m190309_123832_setting.php +++ b/migrations/m190309_123832_setting.php @@ -18,6 +18,8 @@ public function safeUp() $this->insert('{{%setting}}', ['key' => 'scoreboardFrozenTime', 'value' => '7200']); $this->insert('{{%setting}}', ['key' => 'isShareCode', 'value' => '1']); $this->insert('{{%setting}}', ['key' => 'oiMode', 'value' => '0']); + $this->insert('{{%setting}}', ['key' => 'SigninMode', 'value' => '1']); + $this->insert('{{%setting}}', ['key' => 'GroupMode', 'value' => '1']); } /** @@ -30,6 +32,7 @@ public function safeDown() $this->delete('{{%setting}}', ['key' => 'scoreboardFrozenTime']); $this->delete('{{%setting}}', ['key' => 'isShareCode']); $this->delete('{{%setting}}', ['key' => 'oiMode']); + $this->delete('{{%setting}}', ['key' => 'SigninMode']); $this->dropColumn('{{%setting}}', 'id'); } diff --git a/models/User.php b/models/User.php index c17c4c954..b59acd6e5 100644 --- a/models/User.php +++ b/models/User.php @@ -50,6 +50,7 @@ class User extends ActiveRecord implements IdentityInterface public $newPassword; public $verifyPassword; + public $newNickname; /** * 是否已经验证邮箱 */ @@ -97,7 +98,9 @@ public function rules() [['oldPassword'], 'validateOldPassword'], [['verifyPassword'], 'compare', 'compareAttribute' => 'newPassword'], [['oldPassword', 'verifyPassword', 'newPassword'], 'required'], - ['newPassword', 'string', 'min' => 6, 'max' => 16] + ['newPassword', 'string', 'min' => 6, 'max' => 16], + + [['newNickname'], 'string', 'max' => 16] ]; } @@ -120,6 +123,7 @@ public function attributeLabels() 'id' => Yii::t('app', 'ID'), 'username' => Yii::t('app', 'Username'), 'nickname' => Yii::t('app', 'Nickname'), + 'newNickname' => Yii::t('app', 'New Nickname'), 'password' => Yii::t('app', 'Password'), 'oldPassword' => Yii::t('app', 'Old Password'), 'newPassword' => Yii::t('app', 'New Password'), diff --git a/models/UserProfile.php b/models/UserProfile.php index 034f63830..56c2e194e 100644 --- a/models/UserProfile.php +++ b/models/UserProfile.php @@ -40,6 +40,7 @@ public function rules() [['address', 'description', 'major'], 'string'], [['signature', 'school'], 'string', 'max' => 128], [['major'], 'string', 'max' => 64], + [['class'], 'string', 'max' => 64], [['user_id'], 'unique'], ]; } @@ -59,7 +60,8 @@ public function attributeLabels() 'description' => Yii::t('app', 'Description'), 'school' => Yii::t('app', 'School'), 'student_number' => Yii::t('app', 'Student Number'), - 'major' => Yii::t('app', 'Major') + 'major' => Yii::t('app', 'Major'), + 'class' => Yii::t('app', 'class') ]; } } diff --git a/modules/admin/controllers/UserController.php b/modules/admin/controllers/UserController.php index a5a6909f6..50f77639f 100644 --- a/modules/admin/controllers/UserController.php +++ b/modules/admin/controllers/UserController.php @@ -122,6 +122,13 @@ public function actionUpdate($id) $model = $this->findModel($id); if (Yii::$app->request->isPost) { + $newNickname = Yii::$app->request->post('User')['newNickname']; + if (!empty($newNickname)) { + Yii::$app->db->createCommand()->update('{{%user}}', + ['username' => $newNickname, 'nickname' => $newNickname], + ['id' => $model->id] + )->execute(); + } $newPassword = Yii::$app->request->post('User')['newPassword']; $role = Yii::$app->request->post('User')['role']; if (!empty($newPassword)) { diff --git a/modules/admin/views/problem/index.php b/modules/admin/views/problem/index.php index db471dcef..b3a79f7ac 100644 --- a/modules/admin/views/problem/index.php +++ b/modules/admin/views/problem/index.php @@ -58,6 +58,13 @@ }, 'format' => 'raw' ], + [ + 'attribute' => 'tags', + 'value' => function ($model, $key, $index, $column) { + return Html::a(Html::encode($model->tags), ['problem/view', 'id' => $key]); + }, + 'format' => 'raw' + ], [ 'attribute' => 'status', 'value' => function ($model, $key, $index, $column) { diff --git a/modules/admin/views/setting/index.php b/modules/admin/views/setting/index.php index f52e8ae14..ad8bb2603 100644 --- a/modules/admin/views/setting/index.php +++ b/modules/admin/views/setting/index.php @@ -19,7 +19,20 @@ = Html::label(Yii::t('app', 'OJ名称'), 'ojName') ?> = Html::textInput('ojName', $settings['ojName'], ['class' => 'form-control']) ?> - +