正在显示
1 个修改的文件
包含
31 行增加
和
0 行删除
@@ -194,4 +194,35 @@ if (!function_exists('build_heading')) { | @@ -194,4 +194,35 @@ if (!function_exists('build_heading')) { | ||
194 | } | 194 | } |
195 | return $result; | 195 | return $result; |
196 | } | 196 | } |
197 | + | ||
198 | + | ||
199 | + /** | ||
200 | + * 微信公众号 | ||
201 | + * 经纪人审核 消息推送 | ||
202 | + */ | ||
203 | + function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) | ||
204 | + { | ||
205 | + $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; | ||
206 | + $json_token = http_request($myurl); | ||
207 | + $access_tokens = json_decode($json_token, true); | ||
208 | + $access_token = $access_tokens['access_token']; | ||
209 | + | ||
210 | + $template = array( | ||
211 | + 'touser' => $openid, // | ||
212 | + 'template_id' => 'zQaLnhEOQxdGOKJlDUAfEoNY4NTmNWy9a9vYzkZjGn8', //模板消息id 必须修改 | ||
213 | + 'url' => $tourl, //点击链接 | ||
214 | + "miniprogram" => [ | ||
215 | + "appid" => $ywt_appid, | ||
216 | + "pagepath" => $pagepath | ||
217 | + ], | ||
218 | + 'topcolor' => "#173177", | ||
219 | + 'data' => $info | ||
220 | + ); | ||
221 | + | ||
222 | + $json_template = json_encode($template); | ||
223 | + $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token; | ||
224 | + $json = http_request($url, urldecode($json_template)); | ||
225 | + $rs = json_decode($json, true); | ||
226 | + return $rs; | ||
227 | + } | ||
197 | } | 228 | } |
-
请 注册 或 登录 后发表评论