You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
3.9 KiB
145 lines
3.9 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\adminapi\controller\student;
|
|
|
|
use core\base\BaseAdminController;
|
|
use app\service\admin\student\StudentService;
|
|
|
|
|
|
/**
|
|
* 学员控制器
|
|
* Class Student
|
|
* @package app\adminapi\controller\student
|
|
*/
|
|
class Student extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取学员列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->request->params([
|
|
["campus_id",""],
|
|
["name",""],
|
|
["emergency_contact",""],
|
|
["contact_phone",""],
|
|
["created_at",[]],
|
|
['member_label', 0],
|
|
["class_id",""]
|
|
]);
|
|
return success((new StudentService())->getPage($data));
|
|
}
|
|
|
|
/**
|
|
* 学员详情
|
|
* @param int $id
|
|
* @return \think\Response
|
|
*/
|
|
public function info(int $id){
|
|
return success((new StudentService())->getInfo($id));
|
|
}
|
|
|
|
/**
|
|
* 添加学员
|
|
* @return \think\Response
|
|
*/
|
|
public function add(){
|
|
$data = $this->request->params([
|
|
["user_id",0],
|
|
["campus_id",0],
|
|
["class_id",0],
|
|
["name",""],
|
|
["gender",0],
|
|
["age",0.00],
|
|
["birthday","2025-05-26 16:25:55"],
|
|
["emergency_contact",""],
|
|
["contact_phone",""],
|
|
["note",""],
|
|
["status",0],
|
|
['member_label', []],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\student\Student.add');
|
|
$id = (new StudentService())->add($data);
|
|
return success('ADD_SUCCESS', ['id' => $id]);
|
|
}
|
|
|
|
/**
|
|
* 学员编辑
|
|
* @param $id 学员id
|
|
* @return \think\Response
|
|
*/
|
|
public function edit(int $id){
|
|
$data = $this->request->params([
|
|
["user_id",0],
|
|
["campus_id",0],
|
|
["class_id",0],
|
|
["name",""],
|
|
["gender",0],
|
|
["age",0.00],
|
|
["birthday","2025-05-26 16:25:55"],
|
|
["emergency_contact",""],
|
|
["contact_phone",""],
|
|
["note",""],
|
|
["status",0],
|
|
['member_label', []],
|
|
|
|
]);
|
|
$this->validate($data, 'app\validate\student\Student.edit');
|
|
(new StudentService())->edit($id, $data);
|
|
return success('EDIT_SUCCESS');
|
|
}
|
|
|
|
/**
|
|
* 学员删除
|
|
* @param $id 学员id
|
|
* @return \think\Response
|
|
*/
|
|
public function del(int $id){
|
|
(new StudentService())->del($id);
|
|
return success('DELETE_SUCCESS');
|
|
}
|
|
|
|
|
|
public function getCustomerResourcesAll(){
|
|
$params = $this->request->params([
|
|
["name", ""],
|
|
["phone_number", ""]
|
|
]);
|
|
return success(( new StudentService())->getCustomerResourcesAll($params));
|
|
}
|
|
|
|
public function getCampusAll(){
|
|
return success(( new StudentService())->getCampusAll());
|
|
}
|
|
|
|
public function getClassGradeAll(){
|
|
return success(( new StudentService())->getClassGradeAll());
|
|
}
|
|
|
|
public function label_all()
|
|
{
|
|
return success(( new StudentService() )->label_all());
|
|
}
|
|
|
|
/**
|
|
* 通过名称查询学员
|
|
*/
|
|
public function getStudentByName()
|
|
{
|
|
$data = $this->request->params([
|
|
["name", ""],
|
|
]);
|
|
$list = (new StudentService())->getStudentByName($data['name']);
|
|
return success($list);
|
|
}
|
|
}
|
|
|