fix 课程报告发布通知家长、学生

This commit is contained in:
Dai 2024-10-07 21:30:35 +08:00
parent 5e78d3eccd
commit cae0c5535e

View File

@ -448,7 +448,7 @@ class SendMsgCronJobService
]); ]);
foreach ($student_info as $student){ foreach ($student_info as $student) {
//通知学生 //通知学生
$send_teacher_data = [ $send_teacher_data = [
'touser' => $student['openid']->openid, 'touser' => $student['openid']->openid,
@ -502,7 +502,7 @@ class SendMsgCronJobService
//查找学生家长,同步发送消息给家长 //查找学生家长,同步发送消息给家长
$parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty(); $parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty();
if(!$parents->isEmpty()){ if (!$parents->isEmpty()) {
$send_teacher_data = [ $send_teacher_data = [
'touser' => $parents->openid, 'touser' => $parents->openid,
'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI', 'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI',
@ -565,7 +565,6 @@ class SendMsgCronJobService
} }
/** /**
* 上课时间 提前一天通知老师 * 上课时间 提前一天通知老师
* @return void * @return void
@ -580,7 +579,7 @@ class SendMsgCronJobService
foreach ($teacher_schedule_time as $item) { foreach ($teacher_schedule_time as $item) {
if(strtotime($item['start_time']) - time() > 60){ if (strtotime($item['start_time']) - time() > 60) {
continue; continue;
} }
@ -690,7 +689,7 @@ class SendMsgCronJobService
]); ]);
foreach ($student_info as $student){ foreach ($student_info as $student) {
//通知学生 //通知学生
$send_teacher_data = [ $send_teacher_data = [
'touser' => $student['openid']->openid, 'touser' => $student['openid']->openid,
@ -744,7 +743,7 @@ class SendMsgCronJobService
//查找学生家长,同步发送消息给家长 //查找学生家长,同步发送消息给家长
$parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty(); $parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty();
if(!$parents->isEmpty()){ if (!$parents->isEmpty()) {
$send_teacher_data = [ $send_teacher_data = [
'touser' => $parents->openid, 'touser' => $parents->openid,
'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI', 'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI',
@ -808,7 +807,6 @@ class SendMsgCronJobService
} }
/** /**
* 上课时间 提前一天通知老师 * 上课时间 提前一天通知老师
* @return void * @return void
@ -1006,7 +1004,7 @@ class SendMsgCronJobService
{ {
try { try {
$subject_homework = SubjectHomework::where(['id' => $subject_homework_id])->findOrEmpty(); $subject_homework = SubjectHomework::where(['id' => $subject_homework_id])->with(['teacher', 'subject'])->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();
// //
@ -1078,7 +1076,7 @@ class SendMsgCronJobService
'en_end_time' => $subject_homework->en_end_time, 'en_end_time' => $subject_homework->en_end_time,
'send_role' => 'student', 'send_role' => 'student',
'send_data' => json_encode($send_teacher_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), '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), 'msg_info' => json_encode(['student' => $student_schedule, 'subject_homework' => $subject_homework->toArray()], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'send_result' => $result['code'] == ResponseCode::SUCCESS ? 1 : 0, 'send_result' => $result['code'] == ResponseCode::SUCCESS ? 1 : 0,
'send_result_msg' => $result['msg'], 'send_result_msg' => $result['msg'],
]); ]);
@ -1132,7 +1130,7 @@ class SendMsgCronJobService
'en_end_time' => $subject_homework->en_end_time, 'en_end_time' => $subject_homework->en_end_time,
'send_role' => 'parent', 'send_role' => 'parent',
'send_data' => json_encode($send_teacher_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'send_data' => json_encode($send_teacher_data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'msg_info' => json_encode(['parent'=>$parent->toArray(), 'subject_homework'=>$subject_homework->toArray()], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES), 'msg_info' => json_encode(['parent' => $parent->toArray(), 'subject_homework' => $subject_homework->toArray()], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'send_result' => $result['code'] == ResponseCode::SUCCESS ? 1 : 0, 'send_result' => $result['code'] == ResponseCode::SUCCESS ? 1 : 0,
'send_result_msg' => $result['msg'], 'send_result_msg' => $result['msg'],
]); ]);