fix 上传课程文件后通知家长、学生
This commit is contained in:
parent
bb528198b0
commit
7172b2327c
@ -1157,13 +1157,10 @@ class SendMsgCronJobService
|
||||
public function uploadVersionSubjectHomeworkNotifyStudent($subject_homework_id)
|
||||
{
|
||||
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();
|
||||
|
||||
print '<pre>';
|
||||
print_r($student_schedule->toArray());
|
||||
die;
|
||||
|
||||
//
|
||||
// $student_homework = StudentHomework::where(['id' => $student_homework_id])->with(['teacher', 'subject'])->findOrEmpty();
|
||||
@ -1180,7 +1177,7 @@ class SendMsgCronJobService
|
||||
|
||||
|
||||
if (!$next_student_schedule_time->isEmpty()) {
|
||||
$next_time = $next_student_schedule_time->start_time;
|
||||
$next_time = '请在' . date('m-d H:i', strtotime($next_student_schedule_time->start_time)) . '前上传';
|
||||
} else {
|
||||
// $next_time = date('Y-m-d H:i:s', strtotime('+7 day',$next_student_schedule_time->start_time ));//不能没有值
|
||||
$next_time = '作业提交时间为下次上课前';//不能没有值
|
||||
@ -1205,11 +1202,11 @@ class SendMsgCronJobService
|
||||
'value' => substr($student_schedule->english_name . '/' . date('m-d H:i', strtotime($student_schedule->start_time)), 0, 18) . '..',
|
||||
'color' => '#000000'
|
||||
],
|
||||
'thing3' => [//批改老师
|
||||
'thing5' => [//批改老师
|
||||
'value' => $student_schedule->teacher_name,
|
||||
'color' => '#000000'
|
||||
],
|
||||
'time8' => [//机构名称
|
||||
'thing7' => [//班级名称
|
||||
'value' => $next_time,
|
||||
'color' => '#000000'
|
||||
]
|
||||
@ -1243,6 +1240,69 @@ class SendMsgCronJobService
|
||||
'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->student_openid,
|
||||
'template_id' => 'ng-vuuY_hHM3N2fR3VCGdhtg5zfYRmgdiYuffPEgXDs',
|
||||
'data' => [
|
||||
'thing6' => [//课程名称
|
||||
'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'
|
||||
],
|
||||
'thing9' => [//学生姓名
|
||||
'value' => substr($student_schedule->english_name . '/' . date('m-d H:i', strtotime($student_schedule->start_time)), 0, 18) . '..',
|
||||
'color' => '#000000'
|
||||
],
|
||||
'thing5' => [//批改老师
|
||||
'value' => $student_schedule->teacher_name,
|
||||
'color' => '#000000'
|
||||
],
|
||||
'thing7' => [//班级名称
|
||||
'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(['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'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user