|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
命名空间声明: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、跳转链接和顶部颜色。
|