From 3c4f67fbd5025a0ac8dfe12e21162c9d602e79ff Mon Sep 17 00:00:00 2001 From: pfspx4a7z <2942132918@qq.com> Date: Wed, 8 Jan 2025 20:42:50 +0800 Subject: [PATCH] Update templatemessage.lib.php --- core/templatemessage.lib.php | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/core/templatemessage.lib.php b/core/templatemessage.lib.php index bc05de4..09f4ffd 100644 --- a/core/templatemessage.lib.php +++ b/core/templatemessage.lib.php @@ -18,7 +18,7 @@ class TemplateMessage { */ public static function setIndustry($industryId1, $industryId2) { // 构建请求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 $queryAction = 'POST'; // 构建请求数据数组 @@ -39,7 +39,7 @@ class TemplateMessage { */ public static function getTemplateId($templateIdShort) { // 构建请求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 $queryAction = 'POST'; // 构建请求数据数组 @@ -63,7 +63,7 @@ class TemplateMessage { */ public static function sendTemplateMessage($data, $touser, $templateId, $url, $topcolor = '#FF0000') { // 构建请求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 $queryAction = 'POST'; // 构建请求数据数组 @@ -78,4 +78,29 @@ class TemplateMessage { // 调用Curl类发送请求 return Curl::callWebServer($queryUrl, $template, $queryAction); } -} \ No newline at end of file +} +命名空间声明: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、跳转链接和顶部颜色。 \ No newline at end of file