<?php

namespace app\extra\weMini;

use yzh52521\EasyHttp\Http;

class Subscribe extends BasicWeChat
{

    public function sendMsg(string $id = "",string $openid = "",array $data = [])
    {
        $url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={$this->getAccessToken()}";
        $param = [
            "template_id"   => $id,
            "touser"        => $openid,
            "data"          => $data,
            "page"          => "pages/order/order",
            "miniprogram_state" => "formal",
            "lang"          => "zh_CN"
        ];
        return Http::asJson()->post($url,$param)->array();
    }

}