fix 10分钟通知发送2次
This commit is contained in:
parent
a9fc49b0f9
commit
c9667cf136
@ -11,6 +11,7 @@ use app\common\model\SubjectHomework;
|
||||
use app\common\model\Teacher;
|
||||
use app\common\model\TeacherScheduleTime;
|
||||
use app\constant\ResponseCode;
|
||||
use support\Redis;
|
||||
use think\Exception;
|
||||
|
||||
class SendMsgCronJobService
|
||||
@ -583,7 +584,6 @@ class SendMsgCronJobService
|
||||
|
||||
foreach ($teacher_schedule_time as $item) {
|
||||
|
||||
|
||||
$studentSchedule = $item->studentSchedule->toArray();
|
||||
if (empty($studentSchedule)) {
|
||||
CronJob::create([
|
||||
@ -668,7 +668,9 @@ class SendMsgCronJobService
|
||||
"lang" => "zh_CN",
|
||||
];
|
||||
|
||||
|
||||
$class_begin_notify_teacher_key = md5(serialize($send_teacher_data));
|
||||
if(!Redis::get($class_begin_notify_teacher_key)){
|
||||
Redis::setEx($class_begin_notify_teacher_key, 65, 1);
|
||||
$result = (new WechatSubscriptService())->sendMsg($send_teacher_data);
|
||||
|
||||
CronJob::create([
|
||||
@ -690,6 +692,9 @@ class SendMsgCronJobService
|
||||
'send_result_msg' => $result['msg'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($student_info as $student) {
|
||||
//通知学生
|
||||
@ -720,6 +725,9 @@ class SendMsgCronJobService
|
||||
"lang" => "zh_CN",
|
||||
];
|
||||
|
||||
$class_begin_notify_student_key = md5(serialize($send_teacher_data));
|
||||
if(!Redis::get($class_begin_notify_student_key)){
|
||||
Redis::setEx($class_begin_notify_student_key, 65, 1);
|
||||
|
||||
$result = (new WechatSubscriptService())->sendMsg($send_teacher_data);
|
||||
|
||||
@ -742,6 +750,8 @@ class SendMsgCronJobService
|
||||
'send_result_msg' => $result['msg'],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//查找学生家长,同步发送消息给家长
|
||||
$parents = StudentParent::where(['id' => $student['parent_id']])->findOrEmpty();
|
||||
@ -773,9 +783,11 @@ class SendMsgCronJobService
|
||||
"lang" => "zh_CN",
|
||||
];
|
||||
|
||||
$class_begin_notify_parent_key = md5(serialize($send_teacher_data));
|
||||
|
||||
if (!Redis::get($class_begin_notify_parent_key)){
|
||||
Redis::setEx($class_begin_notify_parent_key, 65, 1);
|
||||
$result = (new WechatSubscriptService())->sendMsg($send_teacher_data);
|
||||
|
||||
CronJob::create([
|
||||
'msg_type' => self::CLASS_BEGIN_NOTIFY_PARENT,
|
||||
'teacher_id' => $item->teacher_id,
|
||||
@ -795,6 +807,9 @@ class SendMsgCronJobService
|
||||
'send_result_msg' => $result['msg'],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user