Update templatemessage.lib.php

src
pfspx4a7z 2 months ago
parent 89c91a1f7c
commit 3c4f67fbd5

@ -18,7 +18,7 @@ class TemplateMessage {
*/ */
public static function setIndustry($industryId1, $industryId2) { public static function setIndustry($industryId1, $industryId2) {
// 构建请求URL包含access_token // 构建请求URL包含access_token
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=' . AccessToken::getAccessToken(); $queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=' . AccessToken::getAccessToken();
// 设置请求方法为POST // 设置请求方法为POST
$queryAction = 'POST'; $queryAction = 'POST';
// 构建请求数据数组 // 构建请求数据数组
@ -39,7 +39,7 @@ class TemplateMessage {
*/ */
public static function getTemplateId($templateIdShort) { public static function getTemplateId($templateIdShort) {
// 构建请求URL包含access_token // 构建请求URL包含access_token
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=' . AccessToken::getAccessToken(); $queryUrl = 'https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=' . AccessToken::getAccessToken();
// 设置请求方法为POST // 设置请求方法为POST
$queryAction = 'POST'; $queryAction = 'POST';
// 构建请求数据数组 // 构建请求数据数组
@ -63,7 +63,7 @@ class TemplateMessage {
*/ */
public static function sendTemplateMessage($data, $touser, $templateId, $url, $topcolor = '#FF0000') { public static function sendTemplateMessage($data, $touser, $templateId, $url, $topcolor = '#FF0000') {
// 构建请求URL包含access_token // 构建请求URL包含access_token
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . AccessToken::getAccessToken(); $queryUrl = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . AccessToken::getAccessToken();
// 设置请求方法为POST // 设置请求方法为POST
$queryAction = 'POST'; $queryAction = 'POST';
// 构建请求数据数组 // 构建请求数据数组
@ -78,4 +78,29 @@ class TemplateMessage {
// 调用Curl类发送请求 // 调用Curl类发送请求
return Curl::callWebServer($queryUrl, $template, $queryAction); return Curl::callWebServer($queryUrl, $template, $queryAction);
} }
} }
命名空间声明namespace LaneWeChat\Core; 定义了类的命名空间表明这个类属于LaneWeChat模块的核心部分。
类定义class TemplateMessage 定义了一个用于处理微信公众号模板消息的类。
setIndustry方法设置公众号模板消息所属的行业。需要提供两个行业编号每月可更改一次。
getTemplateId方法从模板库中添加模板获取模板ID。需要提供模板库中的模板编号。
sendTemplateMessage方法向指定用户发送模板消息。需要提供模板数据、接收方的OpenId、模板ID、跳转链接和顶部颜色。
命名空间声明namespace LaneWeChat\Core; 定义了类的命名空间表明这个类属于LaneWeChat模块的核心部分。
类定义class TemplateMessage 定义了一个用于处理微信公众号模板消息的类。
setIndustry方法设置公众号模板消息所属的行业。需要提供两个行业编号每月可更改一次。
getTemplateId方法从模板库中添加模板获取模板ID。需要提供模板库中的模板编号。
sendTemplateMessage方法向指定用户发送模板消息。需要提供模板数据、接收方的OpenId、模板ID、跳转链接和顶部颜色。
命名空间声明namespace LaneWeChat\Core; 定义了类的命名空间表明这个类属于LaneWeChat模块的核心部分。
类定义class TemplateMessage 定义了一个用于处理微信公众号模板消息的类。
setIndustry方法设置公众号模板消息所属的行业。需要提供两个行业编号每月可更改一次。
getTemplateId方法从模板库中添加模板获取模板ID。需要提供模板库中的模板编号。
sendTemplateMessage方法向指定用户发送模板消息。需要提供模板数据、接收方的OpenId、模板ID、跳转链接和顶部颜色。
命名空间声明namespace LaneWeChat\Core; 定义了类的命名空间表明这个类属于LaneWeChat模块的核心部分。
类定义class TemplateMessage 定义了一个用于处理微信公众号模板消息的类。
setIndustry方法设置公众号模板消息所属的行业。需要提供两个行业编号每月可更改一次。
getTemplateId方法从模板库中添加模板获取模板ID。需要提供模板库中的模板编号。
sendTemplateMessage方法向指定用户发送模板消息。需要提供模板数据、接收方的OpenId、模板ID、跳转链接和顶部颜色。
命名空间声明namespace LaneWeChat\Core; 定义了类的命名空间表明这个类属于LaneWeChat模块的核心部分。
类定义class TemplateMessage 定义了一个用于处理微信公众号模板消息的类。
setIndustry方法设置公众号模板消息所属的行业。需要提供两个行业编号每月可更改一次。
getTemplateId方法从模板库中添加模板获取模板ID。需要提供模板库中的模板编号。
sendTemplateMessage方法向指定用户发送模板消息。需要提供模板数据、接收方的OpenId、模板ID、跳转链接和顶部颜色。
Loading…
Cancel
Save