正在显示
1 个修改的文件
包含
31 行增加
和
1 行删除
@@ -108,7 +108,7 @@ class Index extends Api | @@ -108,7 +108,7 @@ class Index extends Api | ||
108 | $tourl = 'https://fdc.xp.yn.cn/h5/'; | 108 | $tourl = 'https://fdc.xp.yn.cn/h5/'; |
109 | $ywt_appid = 'wx9f73637c6b8f2c47'; | 109 | $ywt_appid = 'wx9f73637c6b8f2c47'; |
110 | $pagepath = 'pages/home/index'; | 110 | $pagepath = 'pages/home/index'; |
111 | - $res = sendAstuWxMsgToAgent($sendInfo, $wxopenid, $tourl, $config['app_id'], $config['secret'], $ywt_appid, $pagepath); | 111 | + $res = $this->sendAstuWxMsgToAgent($sendInfo, $wxopenid, $tourl, $config['app_id'], $config['secret'], $ywt_appid, $pagepath); |
112 | //file_put_contents("pcl_wct_send.log", date("Y-m-d H:i:s") . "1-2-" . json_encode($res, JSON_UNESCAPED_UNICODE) . PHP_EOL, FILE_APPEND); | 112 | //file_put_contents("pcl_wct_send.log", date("Y-m-d H:i:s") . "1-2-" . json_encode($res, JSON_UNESCAPED_UNICODE) . PHP_EOL, FILE_APPEND); |
113 | } | 113 | } |
114 | } | 114 | } |
@@ -127,4 +127,34 @@ class Index extends Api | @@ -127,4 +127,34 @@ class Index extends Api | ||
127 | curl_close($ch); | 127 | curl_close($ch); |
128 | return $output; | 128 | return $output; |
129 | } | 129 | } |
130 | + | ||
131 | + /** | ||
132 | + * 微信公众号 | ||
133 | + * 经纪人审核 消息推送 | ||
134 | + */ | ||
135 | + function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) | ||
136 | + { | ||
137 | + $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; | ||
138 | + $json_token = $this->http_request($myurl); | ||
139 | + $access_tokens = json_decode($json_token, true); | ||
140 | + $access_token = $access_tokens['access_token']; | ||
141 | + | ||
142 | + $template = array( | ||
143 | + 'touser' => $openid, // | ||
144 | + 'template_id' => 'zQaLnhEOQxdGOKJlDUAfEoNY4NTmNWy9a9vYzkZjGn8', //模板消息id 必须修改 | ||
145 | + 'url' => $tourl, //点击链接 | ||
146 | + "miniprogram" => [ | ||
147 | + "appid" => $ywt_appid, | ||
148 | + "pagepath" => $pagepath | ||
149 | + ], | ||
150 | + 'topcolor' => "#173177", | ||
151 | + 'data' => $info | ||
152 | + ); | ||
153 | + | ||
154 | + $json_template = json_encode($template); | ||
155 | + $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token; | ||
156 | + $json = http_request($url, urldecode($json_template)); | ||
157 | + $rs = json_decode($json, true); | ||
158 | + return $rs; | ||
159 | + } | ||
130 | } | 160 | } |
-
请 注册 或 登录 后发表评论