<?php
namespace app\common\util;

class WxTemplate
{
    /**
     * 发送消息模板
     */
    public static function templateMessageSend($openid, $phone, $code, $order_no)
    {
        $send_data = [
            'touser' => $openid,//openid
            'template_id' => 'rh9v7reaIwQ-PQaXT536Y0nSgQsP1jq4-8SnEyP9KZc',//模板id
            'miniprogram_state'=>'trial',
            'miniprogram' => [
                'appid' => config('wechat.app_id'),
                'pagepath' => 'pages/index/index',
            ],
            'data' => [
                'first' => '【' . $phone . '】快递代收成功',
                'keyword1' => '宇晨科技保安亭旁快递柜',
                'keyword2' => $code,
                'keyword3' => $order_no,
                'keyword4' => getNow(),
            ],
        ];
        $hpRose = new YcApiHprose();
        $hpRose->templateMessageSend($send_data);
    }
}