diff --git a/app/common/service/SendMsgCronJobService.php b/app/common/service/SendMsgCronJobService.php index ce8c632..941f564 100644 --- a/app/common/service/SendMsgCronJobService.php +++ b/app/common/service/SendMsgCronJobService.php @@ -448,7 +448,7 @@ class SendMsgCronJobService ]); - foreach ($student_info as $student){ + foreach ($student_info as $student) { //通知学生 $send_teacher_data = [ 'touser' => $student['openid']->openid, @@ -502,7 +502,7 @@ class SendMsgCronJobService //查找学生家长,同步发送消息给家长 $parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty(); - if(!$parents->isEmpty()){ + if (!$parents->isEmpty()) { $send_teacher_data = [ 'touser' => $parents->openid, 'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI', @@ -565,7 +565,6 @@ class SendMsgCronJobService } - /** * 上课时间 提前一天通知老师 * @return void @@ -580,7 +579,7 @@ class SendMsgCronJobService foreach ($teacher_schedule_time as $item) { - if(strtotime($item['start_time']) - time() > 60){ + if (strtotime($item['start_time']) - time() > 60) { continue; } @@ -690,7 +689,7 @@ class SendMsgCronJobService ]); - foreach ($student_info as $student){ + foreach ($student_info as $student) { //通知学生 $send_teacher_data = [ 'touser' => $student['openid']->openid, @@ -744,7 +743,7 @@ class SendMsgCronJobService //查找学生家长,同步发送消息给家长 $parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty(); - if(!$parents->isEmpty()){ + if (!$parents->isEmpty()) { $send_teacher_data = [ 'touser' => $parents->openid, 'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI', @@ -808,7 +807,6 @@ class SendMsgCronJobService } - /** * 上课时间 提前一天通知老师 * @return void @@ -1006,7 +1004,7 @@ class SendMsgCronJobService { 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(); // @@ -1078,7 +1076,7 @@ class SendMsgCronJobService 'en_end_time' => $subject_homework->en_end_time, 'send_role' => 'student', '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_msg' => $result['msg'], ]); @@ -1132,7 +1130,7 @@ class SendMsgCronJobService '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(['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_msg' => $result['msg'], ]);