From 1c277f366576dba85432b316117250d2bf1fc35b Mon Sep 17 00:00:00 2001 From: Dai Date: Thu, 8 Aug 2024 16:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0=E6=95=99?= =?UTF-8?q?=E5=B8=88=E6=96=B0=E5=A2=9E=E3=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/TeacherController.php | 15 ++++-- plugin/admin/app/view/teacher/insert.html | 46 +++++++++++++------ plugin/admin/app/view/teacher/update.html | 25 ++++++++-- 3 files changed, 64 insertions(+), 22 deletions(-) diff --git a/plugin/admin/app/controller/TeacherController.php b/plugin/admin/app/controller/TeacherController.php index a24105d..0dc87f1 100644 --- a/plugin/admin/app/controller/TeacherController.php +++ b/plugin/admin/app/controller/TeacherController.php @@ -62,6 +62,7 @@ class TeacherController extends Crud try { $request_data = $request->post(); + $salt = random_str(16); if (empty($request_data['password'])) { $password = 'YD' . $request_data['account'] . '123'; @@ -69,13 +70,18 @@ class TeacherController extends Crud $password = $request_data['password']; } $password = md5($password . $salt); + + $timezone = TimeZone::where(['id' => $request_data['time_zone_id']])->findOrEmpty(); + $data = [ 'account' => $request_data['account'], 'password' => $password, 'slat' => $salt, 'teacher_name' => $request_data['teacher_name'], - 'time_zone_name' => $request_data['time_zone_name'], - 'time_zone' => $request_data['time_zone'], + 'time_zone_id' =>$timezone->id, + 'time_zone_name' => $timezone->name, + 'time_zone_abbr' => $timezone->abbr, + 'time_zone_offset' => $timezone->offset, ]; $res = \app\common\model\Teacher::create($data); if (!$res) { @@ -96,7 +102,10 @@ class TeacherController extends Crud return parent::insert($data); } - return view('teacher/insert'); + + $timezone = TimeZone::order('id asc')->select()->toArray(); + + return view('teacher/insert', ['timezone' => $timezone]); } /** diff --git a/plugin/admin/app/view/teacher/insert.html b/plugin/admin/app/view/teacher/insert.html index bc2436e..54d6ecb 100644 --- a/plugin/admin/app/view/teacher/insert.html +++ b/plugin/admin/app/view/teacher/insert.html @@ -13,63 +13,68 @@
- +
- +
- + - +
- + - + - +
- +
- +
- +
- +
- +
@@ -84,21 +89,32 @@ - + - +