58 lines
1.9 KiB
PHP
58 lines
1.9 KiB
PHP
![]() |
<?php
|
||
|
|
||
|
namespace app\common\service;
|
||
|
|
||
|
use app\common\model\TeacherScheduleTime;
|
||
|
use think\Exception;
|
||
|
|
||
|
class SendMsgCronJobService
|
||
|
{
|
||
|
const TEACHER_SCHEDULE_TIME_PUBLISH_TEACHER = 'teacher_schedule_time_publish_to_teacher';
|
||
|
const TEACHER_SCHEDULE_TIME_PUBLISH_STUDENT = 'teacher_schedule_time_publish_to_teacher';
|
||
|
|
||
|
public function teacherScheduleTimePublishMsg($teacher_schedule_time_id)
|
||
|
{
|
||
|
try {
|
||
|
$teacher_schedule_time = TeacherScheduleTime::where('id', $teacher_schedule_time_id)->with(['teacherAttr', 'subject', 'studentSchedule'])->findOrEmpty();
|
||
|
|
||
|
//给教师发送消息
|
||
|
$msgInfo = [
|
||
|
'teacher'=>$teacher_schedule_time->teacherAttr,
|
||
|
'subject'=>$teacher_schedule_time->subject,
|
||
|
];
|
||
|
|
||
|
$msg = $send_data = [
|
||
|
'touser' => '1231231',
|
||
|
'template_id' => 'R5kORlczAC4Ltf9RxuesUB8A0ZhEKEh0Zqv9mI8r6u4',
|
||
|
'data' => [
|
||
|
'time2' => [//上课时间
|
||
|
'value' => '00:10 - 01:00',
|
||
|
'color' => '#000000'
|
||
|
],
|
||
|
'thing1' => [//课程名称
|
||
|
'value' => '历史',
|
||
|
'color' => '#000000'
|
||
|
],
|
||
|
'thing5' => [//上课老师
|
||
|
'value' => 'David',
|
||
|
'color' => '#000000'
|
||
|
],
|
||
|
'thing4' => [//学员姓名
|
||
|
'value' => '张三',
|
||
|
'color' => '#000000'
|
||
|
]
|
||
|
],
|
||
|
'miniprogram' => [
|
||
|
'pagepath' => 'pages/orders/orders',
|
||
|
'appid' => getenv('XUN_FU_MA_MINI_APPID'),
|
||
|
],
|
||
|
"lang" => "zh_CN",
|
||
|
];
|
||
|
$result = (new WechatSubscriptService())->sendMsg($msg);
|
||
|
|
||
|
}catch (Exception $e){
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|