|
@@ -134,7 +134,7 @@ class Lessonslot extends Backend
|
|
|
if($paytype == 4){
|
|
|
$number = 1; //试课只能选一个人
|
|
|
}
|
|
|
- if(empty($package_order) && empty($trylessonorder_id)){
|
|
|
+ if(empty($packageorder_id) && empty($trylessonorder_id)){
|
|
|
$this->error('请选择任意一种支付方式');
|
|
|
}
|
|
|
|
|
@@ -681,4 +681,44 @@ class Lessonslot extends Backend
|
|
|
$this->result('',1,'修改完成','json');
|
|
|
}
|
|
|
|
|
|
+ //发送whatapp消息的方法
|
|
|
+ private function whatapp($receive_mobile,$template,$code,$parameters){
|
|
|
+ if(empty($receive_mobile)){return true;}
|
|
|
+
|
|
|
+ $token = config('site.whatsapp_token');
|
|
|
+
|
|
|
+ //发送者
|
|
|
+ $mobile_id = '337736419413019'; //Elin Dance Stuido 2:+65 8015 4154 , WhatsApp Business Account ID: 336509229537586
|
|
|
+
|
|
|
+ //发送
|
|
|
+ $url = 'https://graph.facebook.com/v19.0/'.$mobile_id.'/messages';
|
|
|
+ $header = [
|
|
|
+ 'Authorization: Bearer ' . $token,
|
|
|
+ 'Content-Type: application/json',
|
|
|
+ ];
|
|
|
+ $body = [
|
|
|
+ 'messaging_product' => 'whatsapp',
|
|
|
+ 'recipient_type' => 'individual',
|
|
|
+ 'to' => $receive_mobile,
|
|
|
+ 'type' => 'template',
|
|
|
+ 'template' => [
|
|
|
+ 'name' => $template,
|
|
|
+ 'language' => [
|
|
|
+ 'code' => $code
|
|
|
+ ],
|
|
|
+ 'components' => [
|
|
|
+ [
|
|
|
+ 'type' => 'body',
|
|
|
+ 'parameters' => $parameters
|
|
|
+ ]
|
|
|
+
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+ $body = json_encode($body);
|
|
|
+
|
|
|
+ $rs = curl_post($url,$body,$header);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
}
|