2024-08-04 22:28:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
use app\BaseController;
|
|
|
|
use app\common\model\TeacherScheduleTime;
|
|
|
|
use app\common\service\SendMsgCronJobService;
|
2024-08-05 21:59:13 +08:00
|
|
|
use app\constant\ResponseCode;
|
|
|
|
use app\utils\WechatUtil;
|
2024-08-04 23:31:50 +08:00
|
|
|
use support\Request;
|
2024-08-04 22:28:52 +08:00
|
|
|
use think\Exception;
|
|
|
|
|
|
|
|
class SendMsgCronJobController extends BaseController
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $noNeedLogin = ['*'];
|
|
|
|
|
2024-08-05 21:59:13 +08:00
|
|
|
|
|
|
|
public function getToken()
|
|
|
|
{
|
|
|
|
$token = WechatUtil::getAccessToken();
|
|
|
|
|
|
|
|
return $this->json([
|
|
|
|
'code' => ResponseCode::SUCCESS,
|
|
|
|
'data' => $token,
|
|
|
|
'msg' => 'success'
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-08-04 22:28:52 +08:00
|
|
|
/**
|
|
|
|
* @desc 排课发布成功之后,发送通知
|
|
|
|
* @param $teacher_schedule_time
|
|
|
|
* @return void
|
|
|
|
*/
|
2024-08-04 23:31:50 +08:00
|
|
|
public function teacherScheduleTimePublishMsg(Request $request)
|
2024-08-04 22:28:52 +08:00
|
|
|
{
|
|
|
|
try {
|
|
|
|
// $teacher_schedule_time = TeacherScheduleTime::where('id', $teacher_schedule_time_id)->with(['teacherAttr', 'subject', 'studentSchedule'])->findOrEmpty();
|
|
|
|
|
2024-08-29 23:22:32 +08:00
|
|
|
// $res = (new SendMsgCronJobService())->teacherScheduleTimePublishMsgToTeacher(75);
|
|
|
|
|
|
|
|
$res = (new SendMsgCronJobService())->teacherScheduleTimePublishMsgToStudent(75);
|
2024-08-04 22:28:52 +08:00
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}catch (Exception $e){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @desc 上课提前通知老师
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function classBeginMsgToTeacher()
|
|
|
|
{
|
2024-08-29 23:22:32 +08:00
|
|
|
//@todo: 定时脚本
|
2024-08-05 21:59:13 +08:00
|
|
|
$res = (new SendMsgCronJobService())->classBeginMsgToTeacher();
|
2024-08-04 22:28:52 +08:00
|
|
|
|
2024-08-29 23:22:32 +08:00
|
|
|
print '<pre>';
|
|
|
|
print_r($res);
|
|
|
|
die;
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @desc 上课提前通知老师
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function classBeginSingleMsgToTeacher()
|
|
|
|
{
|
|
|
|
//@todo: 定时脚本
|
|
|
|
$res = (new SendMsgCronJobService())->classBeginSingleMsgToTeacher(79);
|
|
|
|
|
|
|
|
print '<pre>';
|
|
|
|
print_r($res);
|
|
|
|
die;
|
|
|
|
|
2024-08-05 21:59:13 +08:00
|
|
|
return $this->json($res);
|
2024-08-04 22:28:52 +08:00
|
|
|
}
|
|
|
|
|
2024-08-05 22:34:26 +08:00
|
|
|
/**
|
|
|
|
* @desc 老师上传作业,通知后台管理员人员翻译
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function teacherPublishSubjectHomework()
|
|
|
|
{
|
|
|
|
$res = (new SendMsgCronJobService())->teacherPublishSubjectHomework(10);
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
2024-08-04 22:28:52 +08:00
|
|
|
|
2024-08-19 22:48:14 +08:00
|
|
|
/**
|
|
|
|
* @desc 老师布置作业通知 教师上传课程作业,后台翻译件上传之后发送
|
|
|
|
* @param Request $request
|
|
|
|
* @return \support\Response
|
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
|
|
|
*/
|
2024-08-06 17:15:31 +08:00
|
|
|
public function uploadVersionSubjectHomeworkNotifyStudent(Request $request)
|
|
|
|
{
|
|
|
|
$res = (new SendMsgCronJobService())->uploadVersionSubjectHomeworkNotifyStudent(10);
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-08-19 22:48:14 +08:00
|
|
|
/**
|
|
|
|
* @desc 后台翻译后台 通知外教老师
|
|
|
|
* @param Request $request
|
|
|
|
* @return \support\Response
|
|
|
|
*/
|
|
|
|
public function studentUploadSubjectHomeworkNotifyTeacher(Request $request)
|
|
|
|
{
|
|
|
|
$res = (new SendMsgCronJobService())->studentUploadSubjectHomeworkNotifyTeacher(6);
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @desc 学生上课时间确定成功提醒
|
|
|
|
* @param Request $request
|
|
|
|
* @return \support\Response
|
|
|
|
*/
|
|
|
|
public function studentScheduleConfirmNotifyTeacher(Request $request)
|
|
|
|
{
|
|
|
|
$res = (new SendMsgCronJobService())->studentScheduleConfirmNotifyTeacher(84);
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @desc
|
|
|
|
* @param Request $request
|
|
|
|
* @return \support\Response
|
|
|
|
*/
|
|
|
|
public function alertTeacherSubmitFreeTime(Request $request)
|
|
|
|
{
|
|
|
|
$res = (new SendMsgCronJobService())->studentScheduleConfirmNotifyTeacher(84);
|
|
|
|
|
|
|
|
return $this->json($res);
|
|
|
|
}
|
|
|
|
|
2024-08-04 22:28:52 +08:00
|
|
|
}
|