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.
75 lines
1.8 KiB
75 lines
1.8 KiB
<?php
|
|
|
|
namespace app\api\controller\student;
|
|
|
|
use core\base\BaseController;
|
|
use app\service\api\student\AttendanceService;
|
|
|
|
/**
|
|
* 学员出勤控制器
|
|
*/
|
|
class AttendanceController extends BaseController
|
|
{
|
|
/**
|
|
* 学员签到
|
|
*/
|
|
public function checkin()
|
|
{
|
|
$data = $this->request->params([
|
|
['schedule_id', 0],
|
|
['student_id', 0],
|
|
['resources_id', 0],
|
|
['person_id', 0],
|
|
]);
|
|
|
|
try {
|
|
$result = (new AttendanceService())->checkinStudent($data);
|
|
return success($result, '签到成功');
|
|
} catch (\Exception $e) {
|
|
return fail($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 学员请假
|
|
*/
|
|
public function leave()
|
|
{
|
|
$data = $this->request->params([
|
|
['schedule_id', 0],
|
|
['student_id', 0],
|
|
['resources_id', 0],
|
|
['person_id', 0],
|
|
['remark', ''],
|
|
]);
|
|
|
|
try {
|
|
$result = (new AttendanceService())->leaveStudent($data);
|
|
return success($result, '请假成功');
|
|
} catch (\Exception $e) {
|
|
return fail($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 学员取消
|
|
*/
|
|
public function cancel()
|
|
{
|
|
$data = $this->request->params([
|
|
['schedule_id', 0],
|
|
['student_id', 0],
|
|
['resources_id', 0],
|
|
['person_id', 0],
|
|
['cancel_scope', 'single'], // single: 单节课, all: 全部课程
|
|
['cancel_reason', ''],
|
|
]);
|
|
|
|
try {
|
|
$result = (new AttendanceService())->cancelStudent($data);
|
|
return success($result, '操作成功');
|
|
} catch (\Exception $e) {
|
|
return fail($e->getMessage());
|
|
}
|
|
}
|
|
}
|