order-food-admin/app/Models/Traits/SendMiniprogramMessageTrait...

20 lines
773 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace App\Models\Traits;
trait SendMiniprogramMessageTrait
{
public function sendMiniprogramNotice($temp_id, $page, $data_msg){
$app = \EasyWeChat::miniProgram();
$data = [
'template_id' => $temp_id, // 所需下发的订阅模板id
'touser' => $this->mini_openid, // 接收者(用户)的 openid
'page' => $page, // 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,示例index?foo=bar。该字段不填则模板无跳转。
'data' => $data_msg,
'miniprogram_state'=> env('APP_ENV', 'local') == 'production' ? 'formal':'trial',
];
// dd($data);
return $app->subscribe_message->send($data);
}
}