diff --git a/niucloud/app/api/controller/login/Login.php b/niucloud/app/api/controller/login/Login.php index 6e2d3426..dee2ecfc 100644 --- a/niucloud/app/api/controller/login/Login.php +++ b/niucloud/app/api/controller/login/Login.php @@ -13,6 +13,7 @@ namespace app\api\controller\login; use app\dict\member\MemberLoginTypeDict; use app\model\order_table\OrderTable; +use app\model\person_course_schedule\PersonCourseSchedule; use app\model\sys\SysConfig; use app\service\admin\sys\SystemService; use app\service\api\captcha\CaptchaService; @@ -133,4 +134,32 @@ class Login extends BaseController $order_info = $order->where(['id' => 8])->find(); event('Student', ['event_type' => 'add','order_info' => $order_info]); } + + //上课提醒 + public function class_reminder(){ + //上课提醒 + $template_id = Db::name("template_message")->where(['id' => 3])->value('template_id'); + $person_course_schedule = new PersonCourseSchedule(); + $list = $person_course_schedule + ->alias("a") + ->join(['school_customer_resources' => 'b'],'a.resources_id = b.id','left') + ->join(['school_member' => 'c'],'b.member_id = c.member_id','left') + ->join(['school_course_schedule' => 'd'],'a.schedule_id = d.id','left') + ->join(['school_course' => 'e'],'d.course_id = e.id','left') + ->field("a.id,c.wx_openid,e.course_name,a.course_date,a.time_slot") + ->select(); + + foreach ($list as $k=>$v){ + sendMessage( + $v['wx_openid'], + $template_id, + [ + 'thing4' => $v['course_name'].',您有一节课程还有不到24小时就要开始了,如需请假请提前6小时发起请假操作。', + 'thing6' => $v['course_date'].' '.$v['time_slot'], + 'pagepath' => '' + ] + ); + } + + } } diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 71ebd452..9d5ec385 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -154,6 +154,8 @@ Route::group(function () { Route::get('test', 'login.Login/test'); + Route::get('class_reminder', 'login.Login/class_reminder'); + })->middleware(ApiChannel::class) ->middleware(ApiCheckToken::class) ->middleware(ApiLog::class); @@ -430,7 +432,7 @@ Route::group(function () { Route::get('xy/personCourseSchedule/getMyCoach', 'apiController.PersonCourseSchedule/getMyCoach'); //学生端-学生课程安排-学员课时消费记录 Route::get('xy/personCourseSchedule/getStudentCourseUsageList', 'apiController.PersonCourseSchedule/getStudentCourseUsageList'); - + //获取学生课程信息列表(包含教练配置) Route::get('getStudentCourseInfo', 'apiController.PersonCourseSchedule/getStudentCourseInfo'); //获取人员列表(教练、教务、助教) diff --git a/niucloud/app/common.php b/niucloud/app/common.php index 6bae6c59..98e4c3af 100644 --- a/niucloud/app/common.php +++ b/niucloud/app/common.php @@ -1414,6 +1414,22 @@ function sendMessage($touser,$template_id,$value) { ]; } + + if($template_id == 'SWODTQvQPaucMnDrszdYSy5wg5_24FIlyXZqxwbjRT8'){ + $data = [ + 'touser' => $touser, + 'template_id' => $template_id, + 'data' => [ + 'thing4' => ['value' => $value['thing4'], 'color' => '#173177'], + 'thing6' => ['value' => $value['thing6'], 'color' => '#173177'] + ], + 'miniprogram' => [ + "appid" => "wxaee2df4a4b31df05", + "pagepath" => $value['pagepath'] + ] + ]; + } + // 发送 POST 请求 $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);