diff --git a/plugin/admin/app/controller/StudentParentController.php b/plugin/admin/app/controller/StudentParentController.php index 491593d..bf12c54 100644 --- a/plugin/admin/app/controller/StudentParentController.php +++ b/plugin/admin/app/controller/StudentParentController.php @@ -39,6 +39,38 @@ class StudentParentController extends Crud return view('student-parent/index'); } + public function select(Request $request): Response + { + try { + $parent = \app\common\model\StudentParent::order('id desc'); + $data = $request->get(); + if (isset($data['parent_name']) && !empty($data['parent_name'])) { + $parent->where('parent_name', 'like', '%' . $data['parent_name'] . '%'); + } + if (isset($data['account']) && !empty($data['account'])) { + $parent->where('account', 'like', '%' . $data['account'] . '%'); + } + $limit = (int)$request->get('limit', 10); + $limit = $limit <= 0 ? 10 : $limit; + $page = (int)$request->get('page'); + $page = $page > 0 ? $page : 1; + $total = $parent->count(); + $list = $parent->page($page, $limit)->select()->toArray(); + + return json([ + 'code' => ResponseCode::WEB_API_SUCCESS, + 'data' => $list, + 'count' => $total, + 'msg' => 'success' + ]); + } catch (Exception $e) { + return json([ + 'code' => ResponseCode::WEB_API_FAIL, + 'msg' => $e->getMessage() + ]); + } + } + /** * 插入 * @param Request $request diff --git a/plugin/admin/app/view/student-parent/index.html b/plugin/admin/app/view/student-parent/index.html index 867f5bc..8846377 100644 --- a/plugin/admin/app/view/student-parent/index.html +++ b/plugin/admin/app/view/student-parent/index.html @@ -18,8 +18,7 @@
- - +
@@ -28,8 +27,7 @@
- - +
@@ -120,6 +118,9 @@ title: "密码",align: "center", field: "password", hide: true, + },{ + title: "openid",align: "center", + field: "openid", },{ title: "昵称",align: "center", field: "nickname",