Browse Source

可以用试课预约,第三部分,通知

lizhen_gitee 4 months ago
parent
commit
2da8418793
1 changed files with 32 additions and 1 deletions
  1. 32 1
      application/admin/controller/Lessonslot.php

+ 32 - 1
application/admin/controller/Lessonslot.php

@@ -268,7 +268,38 @@ class Lessonslot extends Backend
 
             Db::commit();
 
-            //发送通知给用户
+            //额外的通知
+            $userinfo = Db::name('user')->where('id',$user_id)->find();
+            $obj = new Email();
+            try {
+                //给这些用户发邮件
+                $result = $obj
+                    ->to($userinfo['email'])
+                    ->subject('Elin Dance Studio 已帮您预约课程')
+                    ->message('Hi,'.$userinfo['firstname']. ' ' .$userinfo['lastname'].',已帮您预约课程['.$info['name_en'].'],上课时间:'.date('Y-m-d H:i',$info['starttime']).',请及时来上课!')
+                    ->send();
+
+                //发whatsapp
+                $parameters = [
+                    [
+                        'type' => 'text',
+                        'text' => $userinfo['firstname'].' '.$userinfo['lastname'],
+                    ],
+                    [
+                        'type' => 'text',
+                        'text' => $info['name_en'],
+                    ],
+                    [
+                        'type' => 'text',
+                        'text' => date('Y-m-d H:i',$info['starttime']),
+                    ],
+                ];
+                $this->whatapp($userinfo['whatsapp'],'lessonorder_alternate_to_booking','en_US',$parameters);
+
+            } catch (Exception $e) {
+
+            }
+            //额外的通知
 
             $this->success('预约成功');
         }