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 @@ - + - +