You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<?php
|
|
|
|
|
namespace LaneWeChat\Core;
|
|
|
|
|
/**
|
|
|
|
|
* 自动回复类
|
|
|
|
|
* 这个类用于处理微信公众号的自动回复功能。
|
|
|
|
|
*/
|
|
|
|
|
class AutoReply{
|
|
|
|
|
/**
|
|
|
|
|
* 获取自动回复规则
|
|
|
|
|
* 这个函数用于从微信公众号的API获取当前的自动回复规则。
|
|
|
|
|
*
|
|
|
|
|
* @param int $industryId1 主行业ID
|
|
|
|
|
* @param int $industryId2 副行业ID
|
|
|
|
|
* @return String 返回结果与字段说明请查看微信公众平台文档
|
|
|
|
|
* http://mp.weixin.qq.com/wiki/7/7b5789bb1262fb866d01b4b40b0efecb.html
|
|
|
|
|
*/
|
|
|
|
|
public static function getRole($industryId1, $industryId2){
|
|
|
|
|
// 构建请求URL,这里需要替换'access_token'为实际的access_token值
|
|
|
|
|
$queryUrl = 'https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=' . AccessToken::getAccessToken();
|
|
|
|
|
// 定义请求方法为POST
|
|
|
|
|
$queryAction = 'POST';
|
|
|
|
|
$template = array();// 初始化模板数组
|
|
|
|
|
$template['industry_id1'] = "$industryId1"; // 设置主行业ID
|
|
|
|
|
$template['industry_id2'] = "$industryId2";// 设置副行业ID
|
|
|
|
|
$template = json_encode($template);// 将模板数组转换为JSON格式
|
|
|
|
|
return Curl::callWebServer($queryUrl, $template, $queryAction);// 调用Curl类的方法发送请求并获取结果
|
|
|
|
|
}
|
|
|
|
|
}
|