|
@@ -42,7 +42,6 @@ class Plantask extends Controller
|
|
|
->join('user','order.user_id = user.id','LEFT')
|
|
|
->join('lesson','order.lesson_id = lesson.id','LEFT')
|
|
|
->where($map)->order('order.id asc')->select();
|
|
|
- //$order_list = $this->list_lang($order_list,['name']);
|
|
|
if(empty($order_list)){
|
|
|
continue;
|
|
|
}
|
|
@@ -116,11 +115,15 @@ class Plantask extends Controller
|
|
|
//课程取消,通知。计划任务5分钟执行一次
|
|
|
public function auto_lesson_slot_cancel(){
|
|
|
$map = [
|
|
|
- 'status' => 30,
|
|
|
- 'cancel_notice_status' => 0,
|
|
|
+ 'slot.status' => 30,
|
|
|
+ 'slot.cancel_notice_status' => 0,
|
|
|
];
|
|
|
|
|
|
- $task_list = Db::name('lesson_slot')->where($map)->order('starttime asc')->limit(1)->select();
|
|
|
+ $task_list = Db::name('lesson_slot')->alias('slot')
|
|
|
+ ->field('slot.*,coach.nickname as coach_nickname,coach.email as coach_email,coach.whatsapp as coach_whatsapp,lesson.lesson_name_en')
|
|
|
+ ->join('coach','slot.coach_ids = coach.id','LEFT')
|
|
|
+ ->join('lesson','slot.lesson_id = lesson.id','LEFT')
|
|
|
+ ->where($map)->order('slot.starttime asc')->limit(1)->select();
|
|
|
if(empty($task_list)){
|
|
|
echo 'empty';
|
|
|
exit;
|
|
@@ -129,17 +132,24 @@ class Plantask extends Controller
|
|
|
foreach($task_list as $slot){
|
|
|
//找出这节课时的预约单
|
|
|
$map = [
|
|
|
-// 'order.order_status' => 10,
|
|
|
'order.slot_id' => $slot['id'],
|
|
|
];
|
|
|
|
|
|
$order_list = Db::name('lesson_order')->alias('order')
|
|
|
- ->field('lesson.name,lesson.name_en,user.firstname,user.lastname,user.email,user.whatsapp')
|
|
|
+ ->field('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']);
|
|
|
+
|
|
|
+ //把教练也加入到发送列表里
|
|
|
+ $coach_sender = [
|
|
|
+ 'firstname' => $slot['coach_nickname'],
|
|
|
+ 'lastname' => '',
|
|
|
+ 'name_en' => $slot['lesson_name_en'],
|
|
|
+ 'email' => $slot['coach_email'],
|
|
|
+ 'whatsapp' => $slot['coach_whatsapp'],
|
|
|
+ ];
|
|
|
+
|
|
|
if(empty($order_list)){
|
|
|
continue;
|
|
|
}
|
|
@@ -152,7 +162,7 @@ class Plantask extends Controller
|
|
|
$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/>
|
|
|
+ Class:'.$slot['lesson_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/>
|
|
@@ -167,7 +177,7 @@ class Plantask extends Controller
|
|
|
->message($message)
|
|
|
->send();
|
|
|
|
|
|
- $coach_name = Db::name('coach')->where('id',$slot['coach_ids'])->value('nickname');
|
|
|
+ //$coach_name = Db::name('coach')->where('id',$slot['coach_ids'])->value('nickname');
|
|
|
|
|
|
//发whatsapp
|
|
|
$parameters = [
|
|
@@ -177,7 +187,7 @@ class Plantask extends Controller
|
|
|
],
|
|
|
[
|
|
|
'type' => 'text',
|
|
|
- 'text' => $order['name_en'],
|
|
|
+ 'text' => $slot['lesson_name_en'],
|
|
|
],
|
|
|
/* [
|
|
|
'type' => 'text',
|