正在显示
4 个修改的文件
包含
60 行增加
和
70 行删除
@@ -196,12 +196,16 @@ if (!function_exists('build_heading')) { | @@ -196,12 +196,16 @@ if (!function_exists('build_heading')) { | ||
196 | } | 196 | } |
197 | 197 | ||
198 | 198 | ||
199 | - /** | 199 | + |
200 | +} | ||
201 | +if (!function_exists('sendAstuWxMsgToAgent')) { | ||
202 | + | ||
203 | +/** | ||
200 | * 微信公众号 | 204 | * 微信公众号 |
201 | * 经纪人审核 消息推送 | 205 | * 经纪人审核 消息推送 |
202 | */ | 206 | */ |
203 | - function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) | ||
204 | - { | 207 | +function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) |
208 | +{ | ||
205 | $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; | 209 | $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; |
206 | $json_token = http_request($myurl); | 210 | $json_token = http_request($myurl); |
207 | $access_tokens = json_decode($json_token, true); | 211 | $access_tokens = json_decode($json_token, true); |
@@ -224,5 +228,54 @@ if (!function_exists('build_heading')) { | @@ -224,5 +228,54 @@ if (!function_exists('build_heading')) { | ||
224 | $json = http_request($url, urldecode($json_template)); | 228 | $json = http_request($url, urldecode($json_template)); |
225 | $rs = json_decode($json, true); | 229 | $rs = json_decode($json, true); |
226 | return $rs; | 230 | return $rs; |
231 | +} | ||
232 | +} | ||
233 | + | ||
234 | +if (!function_exists('senWxmsgToAgentUser')) { | ||
235 | + | ||
236 | +/*** | ||
237 | + * 公众号推送审核信息给经纪人 | ||
238 | + */ | ||
239 | + function senWxmsgToAgentUser($order_id) | ||
240 | +{ | ||
241 | + $order=Db::name("order")->find($order_id); | ||
242 | + if($order['driver_id']){ | ||
243 | + $user=Db::name("user")->find($order['driver_id']); | ||
244 | + $wct_user=Db::name("wct_user")->where("unionid",$user['unionid'])->find(); | ||
245 | + $wxopenid=$wct_user['wx_openid']; | ||
246 | + $sendInfo = array( | ||
247 | + 'first' => array('value' => "汽车票出票状态通知", 'color' => "#743A3A"), | ||
248 | + 'thing2' => array('value' => "{$order['starting_point']}-{$order['end_point']}", 'color' => '#173177'), | ||
249 | + 'time3' => array('value' =>urlencode(date('Y-m-d H:i:s', $order['reservation_time'])), 'color' => '#173177'), | ||
250 | + 'thing7' => array('value' =>"{$order['starting_point']}", 'color' => '#173177'), | ||
251 | + 'phone_number5' => array('value' => "{$order['phone']}", 'color' => '#173177'), | ||
252 | + ); | ||
253 | + if ($wxopenid) { | ||
254 | + $config = get_addon_config('wechat'); | ||
255 | + $tourl = ''; | ||
256 | + $ywt_appid = 'wxb7dd0c03865a94e0'; | ||
257 | + $pagepath = ''; | ||
258 | + $res = sendAstuWxMsgToAgent($sendInfo, $wxopenid, $tourl, $config['app_id'], $config['secret'], $ywt_appid, $pagepath); | ||
259 | + print_r($res);return; | ||
260 | + //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); | ||
261 | + } | ||
227 | } | 262 | } |
228 | } | 263 | } |
264 | +} | ||
265 | +if (!function_exists('http_request')) { | ||
266 | +function http_request($url, $data = array()) | ||
267 | +{ | ||
268 | + $ch = curl_init(); | ||
269 | + curl_setopt($ch, CURLOPT_URL, $url); | ||
270 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
271 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | ||
272 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); | ||
273 | + // 我们在POST数据哦! | ||
274 | + curl_setopt($ch, CURLOPT_POST, 1); | ||
275 | + // 把post的变量加上 | ||
276 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | ||
277 | + $output = curl_exec($ch); | ||
278 | + curl_close($ch); | ||
279 | + return $output; | ||
280 | +} | ||
281 | +} |
@@ -1370,6 +1370,8 @@ class Car extends Base | @@ -1370,6 +1370,8 @@ class Car extends Base | ||
1370 | } | 1370 | } |
1371 | $res = Db::name("order")->insertGetId($data); | 1371 | $res = Db::name("order")->insertGetId($data); |
1372 | OrderSendMessage($res); | 1372 | OrderSendMessage($res); |
1373 | + senWxmsgToAgentUser($res); | ||
1374 | + | ||
1373 | $this->success("请求成功", $res); | 1375 | $this->success("请求成功", $res); |
1374 | } | 1376 | } |
1375 | 1377 |
@@ -89,70 +89,4 @@ class Index extends Api | @@ -89,70 +89,4 @@ class Index extends Api | ||
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
92 | - | ||
93 | - /*** | ||
94 | - * 公众号推送审核信息给经纪人 | ||
95 | - */ | ||
96 | - public function senWxmsgToAgentUser() | ||
97 | - { | ||
98 | - $wxopenid="oYhYi6fEAxSnlAV1qNm2BwaJdQOQ"; | ||
99 | - $sendInfo = array( | ||
100 | - 'first' => array('value' => "123111111123", 'color' => "#743A3A"), | ||
101 | - 'thing2' => array('value' => "行程", 'color' => '#173177'), | ||
102 | - 'time3' => array('value' =>urlencode(date('Y-m-d H:i:s', time())), 'color' => '#173177'), | ||
103 | - 'thing7' => array('value' =>"乘车地点", 'color' => '#173177'), | ||
104 | - 'phone_number5' => array('value' => "13529343345", 'color' => '#173177'), | ||
105 | - ); | ||
106 | - if ($wxopenid) { | ||
107 | - $config = get_addon_config('wechat'); | ||
108 | - $tourl = ''; | ||
109 | - $ywt_appid = 'wxb7dd0c03865a94e0'; | ||
110 | - $pagepath = ''; | ||
111 | - $res = $this->sendAstuWxMsgToAgent($sendInfo, $wxopenid, $tourl, $config['app_id'], $config['secret'], $ywt_appid, $pagepath); | ||
112 | - print_r($res);return; | ||
113 | - //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); | ||
114 | - } | ||
115 | - } | ||
116 | - function http_request($url, $data = array()) | ||
117 | - { | ||
118 | - $ch = curl_init(); | ||
119 | - curl_setopt($ch, CURLOPT_URL, $url); | ||
120 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | ||
121 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); | ||
122 | - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); | ||
123 | - // 我们在POST数据哦! | ||
124 | - curl_setopt($ch, CURLOPT_POST, 1); | ||
125 | - // 把post的变量加上 | ||
126 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $data); | ||
127 | - $output = curl_exec($ch); | ||
128 | - curl_close($ch); | ||
129 | - return $output; | ||
130 | - } | ||
131 | - | ||
132 | - /** | ||
133 | - * 微信公众号 | ||
134 | - * 经纪人审核 消息推送 | ||
135 | - */ | ||
136 | - function sendAstuWxMsgToAgent($info, $openid, $tourl, $appid, $secret, $ywt_appid, $pagepath) | ||
137 | - { | ||
138 | - $myurl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $appid . "&secret=" . $secret; | ||
139 | - $json_token = $this->http_request($myurl); | ||
140 | - $access_tokens = json_decode($json_token, true); | ||
141 | - $access_token = $access_tokens['access_token']; | ||
142 | - | ||
143 | - $template = array( | ||
144 | - 'touser' => $openid, // | ||
145 | - 'template_id' => 'zQaLnhEOQxdGOKJlDUAfEoNY4NTmNWy9a9vYzkZjGn8', //模板消息id 必须修改 | ||
146 | - 'url' => $tourl, //点击链接 | ||
147 | - "miniprogram" => [], | ||
148 | - 'topcolor' => "#173177", | ||
149 | - 'data' => $info | ||
150 | - ); | ||
151 | - | ||
152 | - $json_template = json_encode($template); | ||
153 | - $url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" . $access_token; | ||
154 | - $json = $this->http_request($url, urldecode($json_template)); | ||
155 | - $rs = json_decode($json, true); | ||
156 | - return $rs; | ||
157 | - } | ||
158 | } | 92 | } |
@@ -181,7 +181,8 @@ if (!function_exists('getOrderSn')) { | @@ -181,7 +181,8 @@ if (!function_exists('getOrderSn')) { | ||
181 | $driver=new \app\admin\model\Driver(); | 181 | $driver=new \app\admin\model\Driver(); |
182 | $driver=$driver->find($order['driver_id']); | 182 | $driver=$driver->find($order['driver_id']); |
183 | $driver_user=$user->find($driver['user_id']); | 183 | $driver_user=$user->find($driver['user_id']); |
184 | - $res=$wxxcxpush->Message($driver_user['wx_xcx_openid'],$order_id); | 184 | + |
185 | + //$res=$wxxcxpush->Message($driver_user['wx_xcx_openid'],$order_id); | ||
185 | $res=$wxxcxpush->Message($user['wx_xcx_openid'],$order_id); | 186 | $res=$wxxcxpush->Message($user['wx_xcx_openid'],$order_id); |
186 | if ($res !== false) { | 187 | if ($res !== false) { |
187 | return $res; | 188 | return $res; |
-
请 注册 或 登录 后发表评论