fix 课程文件发布 提醒学生和家长
This commit is contained in:
parent
98432d75d7
commit
7efa0c6151
@ -30,6 +30,7 @@ class SendMsgCronJobService
|
|||||||
const CLASS_BEGIN_NOTIFY_TEACHER = 'class_begin_notify_teacher';
|
const CLASS_BEGIN_NOTIFY_TEACHER = 'class_begin_notify_teacher';
|
||||||
const SUBJECT_UPLOAD_NOTIFY_ADMIN = 'subject_upload_notify_admin';
|
const SUBJECT_UPLOAD_NOTIFY_ADMIN = 'subject_upload_notify_admin';
|
||||||
const SUBJECT_VERSION_UPLOAD_NOTIFY_STUDENT = 'subject_version_upload_notify_student';
|
const SUBJECT_VERSION_UPLOAD_NOTIFY_STUDENT = 'subject_version_upload_notify_student';
|
||||||
|
const SUBJECT_VERSION_UPLOAD_NOTIFY_PARENT = 'subject_version_upload_notify_parent';
|
||||||
const STUDENT_UPLOAD_HOMEWORK_NOTIFY_TEACHER = 'student_upload_homework_notify_teacher';
|
const STUDENT_UPLOAD_HOMEWORK_NOTIFY_TEACHER = 'student_upload_homework_notify_teacher';
|
||||||
const ADMIN_NOTIFY_STUDENT_SCHEDULE_TIME = 'admin_notify_student_schedule_time';
|
const ADMIN_NOTIFY_STUDENT_SCHEDULE_TIME = 'admin_notify_student_schedule_time';
|
||||||
const ADMIN_NOTIFY_TEACHER_SUBMIT_FREE_TIME = 'admin_notify_teacher_submit_free_time';
|
const ADMIN_NOTIFY_TEACHER_SUBMIT_FREE_TIME = 'admin_notify_teacher_submit_free_time';
|
||||||
@ -317,7 +318,6 @@ class SendMsgCronJobService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -652,13 +652,9 @@ class SendMsgCronJobService
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
return [
|
$subject_homework = SubjectHomework::where(['id' => $subject_homework_id])->findOrEmpty();
|
||||||
'code' => ResponseCode::FAIL,
|
|
||||||
'msg' => $e->getMessage()
|
|
||||||
];
|
|
||||||
$subject_homework = SubjectHomework::where(['id'=>$subject_homework_id])->findOrEmpty();
|
|
||||||
//查找该课程作业的课程的学生
|
//查找该课程作业的课程的学生
|
||||||
$student_schedule = StudentSchedule::where(['teacher_schedule_time_id'=>$subject_homework->teacher_schedule_time_id])->with(['student', 'subject', 'teacher'])->findOrEmpty();
|
$student_schedule = StudentSchedule::where(['teacher_schedule_time_id' => $subject_homework->teacher_schedule_time_id])->with(['student', 'subject', 'teacher'])->findOrEmpty();
|
||||||
//
|
//
|
||||||
// $student_homework = StudentHomework::where(['id' => $student_homework_id])->with(['teacher', 'subject'])->findOrEmpty();
|
// $student_homework = StudentHomework::where(['id' => $student_homework_id])->with(['teacher', 'subject'])->findOrEmpty();
|
||||||
|
|
||||||
@ -733,10 +729,65 @@ class SendMsgCronJobService
|
|||||||
'send_result_msg' => $result['msg'],
|
'send_result_msg' => $result['msg'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
//查找学生的家长
|
||||||
|
$student = Student::where(['id' => $student_schedule->student_id])->findOrEmpty();
|
||||||
|
$parent = StudentParent::where(['id' => $student->parent_id])->findOrEmpty();
|
||||||
|
if (!$parent->isEmpty()) {
|
||||||
|
$send_teacher_data = [
|
||||||
|
'touser' => $parent->openid,
|
||||||
|
'template_id' => 'IYIMurENbyxkQ_axIsrkjMJNb8i1AIX4qRgVUEzQX6I',
|
||||||
|
'data' => [
|
||||||
|
'thing1' => [//所属课程
|
||||||
|
'value' => substr($student_schedule->english_name . '/' . date('m-d H:i', strtotime($student_schedule->start_time)), 0, 18) . '..',
|
||||||
|
'color' => '#000000'
|
||||||
|
],
|
||||||
|
'thing2' => [//作业名称
|
||||||
|
'value' => substr($student_schedule->english_name . '/' . date('m-d H:i', strtotime($student_schedule->start_time)), 0, 18) . '..',
|
||||||
|
'color' => '#000000'
|
||||||
|
],
|
||||||
|
'thing3' => [//批改老师
|
||||||
|
'value' => $student_schedule->teacher_name,
|
||||||
|
'color' => '#000000'
|
||||||
|
],
|
||||||
|
'time8' => [//机构名称
|
||||||
|
'value' => $next_time,
|
||||||
|
'color' => '#000000'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'miniprogram' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
"lang" => "zh_CN",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$result = (new WechatSubscriptService())->sendMsg($send_teacher_data);
|
||||||
|
//@todo:写入日志中
|
||||||
|
|
||||||
|
CronJob::create([
|
||||||
|
'msg_type' => self::SUBJECT_VERSION_UPLOAD_NOTIFY_PARENT,
|
||||||
|
'teacher_id' => $subject_homework->teacher_id,
|
||||||
|
'subject_id' => $subject_homework->subject_id,
|
||||||
|
'student_id' => '',
|
||||||
|
'teacher_schedule_time_id' => $subject_homework->teacher_schedule_time_id,
|
||||||
|
'time' => $subject_homework->time,
|
||||||
|
'en_time' => $subject_homework->en_time,
|
||||||
|
'start_time' => $subject_homework->start_time,
|
||||||
|
'end_time' => $subject_homework->end_time,
|
||||||
|
'en_start_time' => $subject_homework->en_start_time,
|
||||||
|
'en_end_time' => $subject_homework->en_end_time,
|
||||||
|
'send_role' => 'parent',
|
||||||
|
'send_data' => json_encode($send_teacher_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||||
|
'msg_info' => json_encode($subject_homework->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||||
|
'send_result' => $result['code'] == ResponseCode::SUCCESS ? 1 : 0,
|
||||||
|
'send_result_msg' => $result['msg'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return [
|
return [
|
||||||
'code' => ResponseCode::FAIL,
|
'code' => ResponseCode::FAIL,
|
||||||
'msg' => $e->getMessage()
|
'msg' => $e->getMessage()
|
||||||
@ -754,9 +805,9 @@ class SendMsgCronJobService
|
|||||||
public function uploadVersionSubjectHomeworkNotifyStudent($subject_homework_id)
|
public function uploadVersionSubjectHomeworkNotifyStudent($subject_homework_id)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$subject_homework = SubjectHomework::where(['id'=>$subject_homework_id])->findOrEmpty();
|
$subject_homework = SubjectHomework::where(['id' => $subject_homework_id])->findOrEmpty();
|
||||||
//查找该课程作业的课程的学生
|
//查找该课程作业的课程的学生
|
||||||
$student_schedule = StudentSchedule::where(['teacher_schedule_time_id'=>$subject_homework->teacher_schedule_time_id])->with(['student', 'subject', 'teacher'])->findOrEmpty();
|
$student_schedule = StudentSchedule::where(['teacher_schedule_time_id' => $subject_homework->teacher_schedule_time_id])->with(['student', 'subject', 'teacher'])->findOrEmpty();
|
||||||
//
|
//
|
||||||
// $student_homework = StudentHomework::where(['id' => $student_homework_id])->with(['teacher', 'subject'])->findOrEmpty();
|
// $student_homework = StudentHomework::where(['id' => $student_homework_id])->with(['teacher', 'subject'])->findOrEmpty();
|
||||||
|
|
||||||
@ -994,7 +1045,7 @@ class SendMsgCronJobService
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$teacher = Teacher::where(['id' => $teacher_id])->findOrEmpty();
|
$teacher = Teacher::where(['id' => $teacher_id])->findOrEmpty();
|
||||||
if($teacher->isEmpty()){
|
if ($teacher->isEmpty()) {
|
||||||
throw new Exception('未找到教师信息');
|
throw new Exception('未找到教师信息');
|
||||||
}
|
}
|
||||||
$send_teacher_data = [
|
$send_teacher_data = [
|
||||||
@ -1028,7 +1079,7 @@ class SendMsgCronJobService
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return [
|
return [
|
||||||
'code' => ResponseCode::FAIL,
|
'code' => ResponseCode::FAIL,
|
||||||
'msg' => $e->getMessage()
|
'msg' => $e->getMessage()
|
||||||
|
@ -120,6 +120,8 @@
|
|||||||
<span class="layui-badge layui-bg-red">课程作业上传提醒管理员</span>
|
<span class="layui-badge layui-bg-red">课程作业上传提醒管理员</span>
|
||||||
{{# }else if(d.msg_type == 'subject_version_upload_notify_student'){ }}
|
{{# }else if(d.msg_type == 'subject_version_upload_notify_student'){ }}
|
||||||
<span class="layui-badge layui-bg-blue">课程报告上传提醒学生</span>
|
<span class="layui-badge layui-bg-blue">课程报告上传提醒学生</span>
|
||||||
|
{{# }else if(d.msg_type == 'subject_version_upload_notify_parent'){ }}
|
||||||
|
<span class="layui-badge layui-bg-blue">课程报告上传提醒家长</span>
|
||||||
{{# }else if(d.msg_type == 'admin_notify_teacher_submit_free_time'){ }}
|
{{# }else if(d.msg_type == 'admin_notify_teacher_submit_free_time'){ }}
|
||||||
<span class="layui-badge layui-bg-green">教师空闲时间上传提醒</span>
|
<span class="layui-badge layui-bg-green">教师空闲时间上传提醒</span>
|
||||||
{{# }else if(d.msg_type == 'student_upload_homework_notify_teacher'){ }}
|
{{# }else if(d.msg_type == 'student_upload_homework_notify_teacher'){ }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user