Browse Source

课程取消,新邮件模板

lizhen_gitee 5 months ago
parent
commit
413b6dee63
2 changed files with 23 additions and 9 deletions
  1. 7 7
      application/api/controller/Demo.php
  2. 16 2
      application/index/controller/Plantask.php

+ 7 - 7
application/api/controller/Demo.php

@@ -93,16 +93,16 @@ class Demo extends Api
             'endtime' => time(),
         ];
         $slot = [
-            'endtime' => time(),
+            'starttime' => time(),
         ];
 
         $message =
             'Hi,'.$order['firstname']. ' ' .$order['lastname'].'!<br/>
-                    We wanted to let you know that the following plan is set to expire in one week’s time!<br/>
-                    Plan: '.$order['name_en'].'<br/>
-                    Expiry Date: '.date('d F Y',$order['endtime']).'<br/>
-                    Please note that any unutilised hours will automatically be forfeited in the system. Book your next session now and continue working towards those amazing goals you have set for yourself!<br/>
-                    If you would like to sign up for another plan, you can contact us at 8879-9689 or check on the app!❤<br/>
+                    We regret to inform you that the following class has been cancelled.<br/>
+                    Class:'.$order['name_en'].'<br/>
+                    Date: '.date('d F Y',$slot['starttime']).'<br/>
+                    Time: '.date('H:i a',$slot['starttime']).'<br/>
+                    Thank you for your kind understanding and look forward to seeing you in our studio soon!❤<br/>
                     Best Regards,<br/>
                     Elin Dance Studio<br/>
                     <img src="'.config('website_url').'/assets/img/logo3.png" style="width:136px;height:115px">
@@ -112,7 +112,7 @@ class Demo extends Api
         $obj = new Email();
         $result = $obj
             ->to($order['email'])
-            ->subject('Your Membership Plan is Expiring in One Week’s Time!')
+            ->subject('Class is Cancelled!')
             ->message($message)
             ->send();
         dump($result);

+ 16 - 2
application/index/controller/Plantask.php

@@ -125,7 +125,7 @@ class Plantask extends Controller
         foreach($task_list as $slot){
             //找出这节课时的预约单
             $map = [
-                'order.order_status' => 10,
+//                'order.order_status' => 10,
                 'order.slot_id' => $slot['id'],
             ];
 
@@ -133,6 +133,7 @@ class Plantask extends Controller
                 ->field('lesson.name,lesson.name_en,user.firstname,user.lastname,user.email,user.whatsapp')
                 ->join('user','order.user_id = user.id','LEFT')
                 ->join('lesson','order.lesson_id = lesson.id','LEFT')
+                ->where('(order.jointype = 1 and order.order_status = 10) or (order.jointype = 2 and order.order_status = 0)') //已支付的 或 候补单
                 ->where($map)->order('order.id asc')->select();
             //$order_list = $this->list_lang($order_list,['name']);
             if(empty($order_list)){
@@ -143,10 +144,23 @@ class Plantask extends Controller
             try {
                 $obj = new Email();
                 foreach($order_list as $order){
+
+                    $message =
+                        'Hi,'.$order['firstname']. ' ' .$order['lastname'].'!<br/>
+                    We regret to inform you that the following class has been cancelled.<br/>
+                    Class:'.$order['name_en'].'<br/>
+                    Date: '.date('d F Y',$slot['starttime']).'<br/>
+                    Time: '.date('H:i a',$slot['starttime']).'<br/>
+                    Thank you for your kind understanding and look forward to seeing you in our studio soon!❤<br/>
+                    Best Regards,<br/>
+                    Elin Dance Studio<br/>
+                    <img src="'.config('website_url').'/assets/img/logo3.png" style="width:136px;height:115px">
+                    ';
+
                     $result = $obj
                         ->to($order['email'])
                         ->subject('Class is Cancelled!')
-                        ->message('Hi,'.$order['firstname']. ' ' .$order['lastname'].',您预约的['.$order['name'].']已取消')
+                        ->message($message)
                         ->send();
 
                     $coach_name = Db::name('coach')->where('id',$slot['coach_ids'])->value('nickname');