公众号消息通知

This commit is contained in:
Dai 2024-09-13 22:11:40 +08:00
parent c7b3f1ff2f
commit 991a51c2ca
4 changed files with 48 additions and 12 deletions

View File

@ -33,7 +33,8 @@ class StudentHomework extends BaseModel
{
return $this->hasOne(Student::class, 'id', 'student_id')->bind([
'student_name',
'student_account' => 'account'
'student_account' => 'account',
'student_openid' => 'openid',
]);
}

View File

@ -40,7 +40,11 @@ class StudentSchedule extends BaseModel
public function student()
{
return $this->hasOne(Student::class, 'id', 'student_id')->bind(['student_student_name' => 'student_name', 'student_account' => 'account']);
return $this->hasOne(Student::class, 'id', 'student_id')->bind([
'student_student_name' => 'student_name',
'student_account' => 'account',
'student_openid' => 'openid',
]);
}
public function subjectHomeworkArr()

View File

@ -162,7 +162,7 @@ class SendMsgCronJobService
foreach ($student_info as $student) {
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $student->openid,
'template_id' => 'gTtXWz35mjbtbOZdq6uNBIqy2_W-gu7F4H6s5N-vNAI',
'data' => [
'time2' => [//上课时间
@ -287,7 +287,7 @@ class SendMsgCronJobService
}
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $item['teacherArr']['openid'],
'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI',
'data' => [
'thing8' => [//课程名称
@ -413,7 +413,7 @@ class SendMsgCronJobService
}
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $teacher_schedule_time['teacherArr']['openid'],
'template_id' => 'yYw0jnlhjnq4AJ_CAlAghgGyV0bvbVHG-eV8TNC3REI',
'data' => [
'thing8' => [//课程名称
@ -563,7 +563,7 @@ class SendMsgCronJobService
if (!empty($subject_homework->homework_version_file_url)) {
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $student_homework->student_openid,
'template_id' => 'IYIMurENbyxkQ_axIsrkjMJNb8i1AIX4qRgVUEzQX6I',
'data' => [
'thing1' => [//所属课程
@ -638,7 +638,7 @@ class SendMsgCronJobService
//获取教师openid
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $student_homework->student_openid,//@todo发送人
'template_id' => 'IYIMurENbyxkQ_axIsrkjOnfoURe4jOVpHU6zcGyksU',
'data' => [
'thing1' => [//课程名称
@ -720,9 +720,8 @@ class SendMsgCronJobService
}
//@todo日志
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $student_schedule->student_openid,
'template_id' => '9zKhl4mYHNcz2jW8MGEtfZXU2M3slaIers9-NCpY4Xc',
'data' => [
'time3' => [//上课时间
@ -780,7 +779,7 @@ class SendMsgCronJobService
throw new Exception('未找到教师信息');
}
$send_teacher_data = [
'touser' => 'olfLh6o4CG9xb6_tA3y29shOj_Bo',//@todo发送人
'touser' => $teacher->openid,//@todo发送人
'template_id' => 'MGAdXtRAJ7qE8hRxFu3fWZvj8bBR-oNxx-1lenpCSAI',
'data' => [
'thing2' => [//课程名称

View File

@ -125,7 +125,7 @@
<!-- 表格行工具栏 -->
<script type="text/html" id="table-bar">
<!-- <button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.studentschedule.update">编辑</button>-->
<button type="button" class="layui-btn layui-btn-xs layui-bg-green" lay-event="send_notify" permission="app.admin.studentschedule.update">发送通知</button>
<button type="button" class="layui-btn layui-btn-xs layui-bg-red" lay-event="remove" permission="app.admin.studentschedule.delete">
删除
</button>
@ -197,6 +197,7 @@
}, {
title: "学生", align: "center",
field: "student_name",
width: 150
}, {
title: "教师排课id", align: "center",
field: "teacher_schedule_time_id",
@ -214,12 +215,15 @@
}, {
title: "日期", align: "center",
field: "date",
width: 150
}, {
title: "本地时间", align: "center",
field: "en_time",
width: 120
}, {
title: "中国时间", align: "center",
field: "time",
width: 120
}, {
title: "课时", align: "center",
field: "hour",
@ -261,6 +265,7 @@
}, {
title: "创建时间", align: "center",
field: "created_at",
width: 220
}, {
title: "更新时间", align: "center",
field: "updated_at",
@ -274,7 +279,7 @@
toolbar: "#table-bar",
align: "center",
fixed: "right",
width: 120,
width: 220,
}
];
@ -303,6 +308,8 @@
table.on("tool(data-table)", function (obj) {
if (obj.event === "remove") {
remove(obj);
} else if (obj.event === "send_notify") {
send_notify(obj);
} else if (obj.event === "edit") {
edit(obj);
}
@ -387,6 +394,31 @@
content: UPDATE_URL + "?" + PRIMARY_KEY + "=" + value
});
}
// 表格编辑数据
let send_notify = function (obj) {
console.log()
let value = obj.data[PRIMARY_KEY];
layer.confirm('确定发送提醒?', {
icon: 3,
title: "提示"
}, function (index) {
layer.close(index);
let loading = layer.load();
$.ajax({
url: '/app/admin/sendMsgNotify/teacherScheduleTimePublishMsgToStudent',
data: {id: obj.data.teacher_schedule_time_id},
dataType: "json",
type: "post",
success: function (res) {
layer.close(loading);
if (res.code) {
return layui.popup.failure(res.msg);
}
return layui.popup.success("操作成功", refreshTable);
}
})
});
}
// 删除多行
let publish = function (obj, status) {