-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.php
executable file
·379 lines (365 loc) · 25 KB
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<?php
/**
* 用于调试时模拟用户发送信息到微号公众号 PGCAO改良 www.kl3w.com
* [WDL] Copyright (c) 2013 B2CTUI.COM
*/
define('IN_SYS', true);
require 'source/bootstrap.inc.php';
$list = account_search();
template('common/header');
?>
<style type="text/css">
.chatPanel .left{float:left;}
.chatPanel .right{float:right;}
.chatPanel .media a{display:block;}
.chatPanel .media{border:1px solid #cdcdcd;box-shadow:0 3px 6px #999999;-webkit-border-radius:12px;-moz-border-radius:12px;border-radius:12px;width:285px;background-color:#FFFFFF;background:-webkit-gradient(linear,left top,left bottom,from(#FFFFFF),to(#FFFFFF));background-image:-moz-linear-gradient(top,#FFFFFF 0%,#FFFFFF 100%);margin:0px auto;}
.chatPanel .media .mediaPanel{padding:0px;margin:0px;}
.chatPanel .media .mediaImg{margin:25px 15px 15px;width:255px;position:relative;}
.chatPanel .media .mediaImg .mediaImgPanel{position:relative;padding:0px;margin:0px;max-height:164px;overflow:hidden;}
.chatPanel .media .mediaImg img{/* width:100%;height:164px;position:absolute;left:0px;*/width:255px;}
.chatPanel .media .mediaImg .mediaImgFooter{position:absolute;bottom:0;height:29px;background-color:#000;background-color:rgba(0,0,0,0.4);text-shadow:none;color:#FFF;text-align:left;padding:0px 11px;line-height:29px;width:233px;}
.chatPanel .media .mediaImg .mediaImgFooter a:hover p{color:#B8B3B3;}
.chatPanel .media .mediaImg .mediaImgFooter .mesgTitleTitle{line-height:28px;color:#FFF;max-width:240px;height:26px;white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden;width:240px;}
.chatPanel .media .mesgIcon{display:inline-block;height:19px;width:13px;margin:8px 0px -2px 4px;}
.chatPanel .media .mediaContent{margin:0px;padding:0px;}
.chatPanel .media .mediaContent .mediaMesg{border-top:1px solid #D7D7D7;padding:10px;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgDot{display:block;position:relative;top:-3px;left:20px;height:6px;width:6px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle:hover p{color:#1A1717;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle a{color:#707577;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle a:hover p{color:#444440;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgIcon{}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle p{line-height:1.5em;max-height:45px;max-width:220px;min-width:176px;margin-top:2px;color:#5D6265;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden;text-align:left;text-overflow:ellipsis;}
.chatPanel .media .mediaContent .mediaMesg .mediaMesgIcon img{height:45px;width:45px;}
/*media mesg detail*/
.chatPanel .media .mediaHead{/*height:48px;*/padding:0px 15px 4px;border-bottom:0px solid #D3D8DC;color:#000000;font-size:20px;}
.chatPanel .media .mediaHead .title{line-height:1.2em;margin-top:22px;display:block;max-width:312px;text-align:left;/*height:25px;white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden;*/}
.chatPanel .mediaFullText .mediaImg{width:255px;padding:0;margin:0 15px;overflow:hidden;max-height:164px;}
.chatPanel .mediaFullText .mediaImg img{/*margin-top:17px;position:absolute;*/}
.chatPanel .mediaFullText .mediaContent{padding:0 0 8px;font-size:16px;line-height:1.5em;text-align:left;color:#222222;}
.chatPanel .mediaFullText .mediaContentP{margin:12px 15px 0px;}
.chatPanel .media .mediaHead .time{margin:0px;margin-top:21px;color:#8C8C8C;background:none;width:auto;font-size:12px;}
.chatPanel .media .mediaFooter{-webkit-border-radius:0px 0px 12px 12px;-moz-border-radius:0px 0px 12px 12px;border-radius:0px 0px 12px 12px;padding:0px;}
.chatPanel .media .mediaFooter a{color:#222222;font-size:16px;padding:0;}
.chatPanel .media .mediaFooter .mesgIcon{margin:15px 3px 0px 0px;}
.chatPanel .media .mediaFooterbox{border-top:1px #CCC solid;}
.chatPanel .media a:hover{cursor:pointer;}
.chatPanel .media a:hover .mesgIcon{}
.mediaContent a:hover{background-color:#F6F6F6;}
.mediaContent .last:hover{-webkit-border-radius:0px 0px 12px 12px;-moz-border-radius:0px 0px 12px 12px;border-radius:0px 0px 12px 12px;background-color:#F6F6F6;}
.mediaFullText:hover{background-color:#F6F6F6;background:-webkit-gradient(linear,left top,left bottom,from(#F6F6F6),to(#F6F6F6));background-image:-moz-linear-gradient(top,#F6F6F6 0%,#F6F6F6 100%);}
.chatItem a{text-decoration:none;}.chatItem a:hover{text-decoration:none;}.mediaFooterbox{cursor:pointer; padding:0 15px;}
#svinfolist{display:none;}#svinfolist p{border-top:1px #CCC solid; padding:4px 6px;word-break:break-all; white-space:pre; margin:2px; cursor:pointer;}
#svinfolist p img{width:50px;height:50px;}
</style>
<div class="main">
<form action="" method="get" class="form-horizontal form" style="float:left;">
<h4>模拟测试</h4>
<table class="tb">
<tr>
<th></th>
<td><input name="submit" type="button" onclick="submitform()" value="发送" class="btn btn-primary span2"></td>
</tr>
<tr>
<th>公众号</th>
<td>
<select name="account" id="account" class="span7">
<?php
foreach ($list as $row) {
$timestamp = TIMESTAMP;
$nonce = random(5);
$token = $row['token'];
$signkey = array($token, TIMESTAMP, $nonce);
sort($signkey, SORT_STRING);
$signString = implode($signkey);
$signString = sha1($signString);
?>
<option <?php if ($_W['weid'] == $row['weid']) { ?>selected<?php } ?> value="<?php echo 'api.php?hash='.$row['hash'] ?>×tamp=<?php echo $timestamp ?>&nonce=<?php echo $nonce ?>&signature=<?php echo $signString ?>"><?php echo $row['name'] ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<th>消息类型</th>
<td>
<div class="radio inline"><input type="radio" name="type" value="text" id="type_text" onclick="toggle('text')" checked="checked" /><label for="type_text"> 文本</label></div>
<div class="radio inline"><input type="radio" name="type" value="image" id="type_image" onclick="toggle('image')" /><label for="type_image"> 图片</label></div>
<div class="radio inline"><input type="radio" name="type" value="location" id="type_location" onclick="toggle('location')" /><label for="type_location"> 位置</label></div>
<div class="radio inline"><input type="radio" name="type" value="link" id="type_link" onclick="toggle('link')" /><label for="type_link"> 链接</label></div>
<div class="radio inline"><input type="radio" name="type" value="event" id="type_event" onclick="toggle('event')" /><label for="type_event"> 菜单</label></div>
<div class="radio inline"><input type="radio" name="type" value="subscribe" id="type_subscribe" onclick="toggle('subscribe')" /><label for="type_subscribe"> 模拟关注</label></div>
<div class="radio inline"><input type="radio" name="type" value="unsubscribe" id="type_unsubscribe" onclick="toggle('unsubscribe')" /><label for="type_unsubscribe"> 取消关注</label></div>
<div class="radio inline"><input type="radio" name="type" value="other" id="type_unsubscribe" onclick="toggle('other')" /><label for="type_unsubscribe"> 其他</label></div>
</td>
</tr>
<tr>
<th>发送用户</th>
<td>
<input type="text" id="fromuser" value="fromUser" class="span7" />
</td>
</tr>
<tr>
<th>接收用户</th>
<td>
<input type="text" id="touser" value="toUser" class="span7" />
</td>
</tr>
<tr>
<td colspan="2" id="content">
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="content_text">
<tr>
<th>内容</th>
<td><textarea id="contentvalue" rows="5" cols="50" class="span7">测试内容</textarea></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="content_image">
<tr>
<th>图片</th>
<td><input type="text" id="picurl" value="http://www.baidu.com/img/bdlogo.gif" class="span7" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="content_location">
<tr>
<th>X坐标</th>
<td><input type="text" id="location_x" class="span7" value="23.134521" /></td>
</tr>
<tr>
<th>Y坐标</th>
<td><input type="text" id="location_y" class="span7" value="113.358803" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="content_link">
<tr>
<th>链接</th>
<td><input type="text" id="url" class="span7" value="http://baidu.com" /></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="content_event">
<tr>
<th>EventKey</th>
<td><input type="text" id="event_key" class="span7" value="EVENTKEY" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<th>发送消息</th>
<td>
<textarea id="sendxml" rows="10" cols="50" class="span7" readonly="readonly"></textarea>
</td>
</tr>
<tr>
<th>接收消息</th>
<td>
<pre id="receive" style="width:520px;"></pre>
</td>
</tr>
</table>
</form>
<div id="demoSendBox" style="position:absolute;margin-left:700px;">
<div class="chatPanel form" style="width:300px;">
<h4>预览效果</h4>
<div id="svposttext" style="text-align:left; padding-bottom:10px;display:none;">
<img src="./resource/image/noavatar_middle.gif" style="width:34px;height:34px;margin-right:6px;float:right;" class="img-rounded">
<div id="svpostinfo" class="btn btn-success" style="margin-right: 4px;float: right;max-width: 184px;text-align:left;">发送内容</div>
<div style="clear:both;"></div>
</div>
<div class="chatItem you">
<div id="svtext" style="text-align:left; padding-bottom:10px;display:none;">
<img src="./resource/image/noavatar_middle.gif" style="width:34px;height:34px;margin-left:6px; float:left;" class="img-rounded">
<div class="btn btn-success" style="margin-left: 4px;float: left;max-width: 184px;text-align:left;">回复内容</div>
<div style="clear:both;"></div>
</div>
<div id="svurlbox" style="display:none;"><div class="media mediaFullText"><div class="mediaPanel">
<a href="javascript:;" id="svurl" target="_blank">
<div class="mediaHead"><span class="title" id="svtitle">标题</span><span class="time"><?php echo date('m月d日'); ?></span>
<div class="clr"></div></div><div class="mediaImg"><img id="svpic" src="false"></div>
<div class="mediaContent mediaContentP"><p id="svinfo"></p></div>
</a>
<div id="svinfolist"></div>
<div class="mediaFooter"><div class="mediaFooterbox clearfix" onclick="opensvurl();"><span class="mesgIcon right">></span>
<span style="line-height:50px;" class="left">查看全文</span></div>
<div class="clr"></div></div>
</div></div></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var curtype = 'text';
function opensvurl(){
var href=$("#svurl").attr("href");
window.open(href, "_blank");
}
function popensvurl(href){
if(href)window.open(href, "_blank");
}
function toggle(type) {
curtype = type;
$('#content table').css('display', 'none');
if ($('#content_'+type)[0]) {
$('#content_'+type).css('display', 'block');
}
buildRequest(type);
$('#receive').text('');
$('#svposttext').hide();
$('#svtext').hide();
$('#svurlbox').hide();
$('#sendxml').attr('readonly', 'readonly');
if(type == 'other') {
$('#sendxml').removeAttr('readonly');
}
}
function getxml(xmlstring){
var xmlobject = null;
try{
if(window.ActiveXObject){
xmlobject =new ActiveXObject("Microsoft.XMLDOM");
xmlobject.async="false";
xmlobject.loadXML(xmlstring);
}else{// 用于 Mozilla, Firefox, Opera, 等浏览器的代码:
var parser=new DOMParser();
xmlobject =parser.parseFromString(xmlstring,"text/xml");
}
}catch(e){alert("您的浏览器不支持模拟测试");}
return xmlobject;
}
function buildRequest(type) {
var $demoSendBox = $('#demoSendBox');
$('span.time', $demoSendBox).show();
$('div.mediaImg', $demoSendBox).show();
$('div.mediaContent', $demoSendBox).show();
$('div.mediaFooterbox', $demoSendBox).show();
var time = Math.round(new Date().getTime()/1000);
xml = "<xml>\n"+
"<ToUserName><![CDATA["+$('#touser').val()+"]]></ToUserName>\n"+
"<FromUserName><![CDATA["+$('#fromuser').val()+"]]></FromUserName>\n"+
"<CreateTime>"+time+"</CreateTime>\n";
if (type == 'text') {
xml += "<MsgType><![CDATA[text]]></MsgType>\n";
xml += "<Content><![CDATA["+$('#contentvalue').val()+"]]></Content>\n";
$('#svpostinfo').text($('#contentvalue').val());
} else if (type == 'image') {
xml += "<MsgType><![CDATA[image]]></MsgType>\n";
xml += "<PicUrl><![CDATA["+$('#picurl').val()+"]]></PicUrl>";
$('#svpostinfo').html('<img src="'+$('#picurl').val()+'">');
} else if (type == 'location') {
xml += "<MsgType><![CDATA[location]]></MsgType>\n";
xml += "<Location_X>"+parseFloat($('#location_x').val())+"</Location_X>\n";
xml += "<Location_Y>"+parseFloat($('#location_y').val())+"</Location_Y>\n";
xml += "<Scale>20</Scale>\n";
xml += "<Label><![CDATA[位置信息]]></Label>\n";
$('span.time', $demoSendBox).hide();
$('div.mediaImg', $demoSendBox).hide();
$('div.mediaContent', $demoSendBox).hide();
$('#svpostinfo').html('<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAcEBAQFBAcFBQcKBwUHCgwJBwcJDA0LCwwLCw0RDQ0NDQ0NEQ0PEBEQDw0UFBYWFBQeHR0dHiIiIiIiIiIiIiL/2wBDAQgHBw0MDRgQEBgaFREVGiAgICAgICAgICAgICAhICAgICAgISEhICAgISEhISEhISEiIiIiIiIiIiIiIiIiIiL/wAARCABvAMgDAREAAhEBAxEB/8QAHAABAAEFAQEAAAAAAAAAAAAA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fADxbX06D8VnvgB4tr6dB+Kz3wA8W19Og/FZ74AeLa+nQfis98AFcG19cJ/MfjM98GCJPBtfrU+Y+vyzHfHy01Pe4mkrEvi2vrT6j8Znvj6jMqfBvfTV+Y8mnyrPfAFPFtfWv1H4rHfAFU8G99MZVg6P9VjvgCE+DW/VfqPxmO+LqxVlPFrfroPxme+J4EDxa366D8ZjviHYkkf4Nr7ZTUg6KeeY74iJLI/FrfroPxme+LcCo8Wt+ug/GZ74cAPFrfroPxme+HADxa366D8ZnvhwA8Wt+ug/GZ74cAPFrfroPxme+HAFfFrfroPxme+HAHo3BBwVWpYlpfKC3MKZCUGiJHSol0xlRS1GWjZooKtkpH//Z">');
} else if (type == 'link') {
xml += "<MsgType><![CDATA[link]]></MsgType>\n";
xml += "<Title><![CDATA[测试链接]]></Title>\n";
xml += "<Description><![CDATA[测试链接描述]]></Description>\n";
xml += "<Url><![CDATA["+$('#url').val()+"]]></Url>\n";
} else if (type == 'subscribe') {
xml += "<MsgType><![CDATA[event]]></MsgType>\n";
xml += "<Event><![CDATA[subscribe]]></Event>\n";
xml += "<EventKey><![CDATA[]]></EventKey>\n";
} else if (type == 'unsubscribe') {
xml += "<MsgType><![CDATA[event]]></MsgType>\n";
xml += "<Event><![CDATA[unsubscribe]]></Event>\n";
xml += "<EventKey><![CDATA[]]></EventKey>\n";
} else if (type == 'event') {
xml += "<MsgType><![CDATA[event]]></MsgType>\n";
xml += "<Event><![CDATA[CLICK]]></Event>\n";
xml += "<EventKey><![CDATA["+$('#event_key').val()+"]]></EventKey>\n";
}
xml += "<MsgId>1234567890123456</MsgId>\n"+
"</xml>";
if(type == 'other') {
xml = $('#sendxml').val();
}
$('#sendxml').val(xml);
}
function submitform() {
buildRequest(curtype);
$('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
$('div.mediaFooterbox', $('#demoSendBox')).show();
$.ajax($('#account').val(), {
type : 'POST',
headers : {"Content-type" : "text/xml"},
data : $('#sendxml').val().replace(/[\r\n]/g,""),
beforeSend : function(){
if(curtype!='subscribe' && curtype!='unsubscribe'){
if(curtype=='text' || curtype=='image' || curtype == 'location'){
$('#svposttext').show();
}
}
$('#receive').text('加载中。。。');
}
}).done(function(s){
if(curtype!='unsubscribe'){
var xmlobject = getxml(s);
if(xmlobject){
var xmlobj = xmlobject.getElementsByTagName("xml");
if(xmlobj.length){
var xmls = xmlobj.item(0);
var xml = xmls;
var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue;
if(MsgType=='text'){
var Content = xml.getElementsByTagName("Content")[0].firstChild.nodeValue;
Content = nl2br(Content);
$('#svtext').show().find('div.btn').html(Content);
}else if(MsgType == 'news'){
var Title = xml.getElementsByTagName("Title")[0].firstChild.nodeValue;
var Description = xml.getElementsByTagName("Description")[0].firstChild.nodeValue;
var PicUrl = xml.getElementsByTagName("PicUrl")[0].firstChild.nodeValue;
var Url = xml.getElementsByTagName("Url")[0].firstChild.nodeValue;
$('#svtitle').html(Title);
$('#svinfo').html(Description);
$('#svpic').attr('src', PicUrl);
$('#svurlbox').show().find('a#svurl').attr('href', Url);
var titleObj = xml.getElementsByTagName("Title");
if(titleObj.length>1){
var svinfolist = imghtml = '';
var UrlObj = xml.getElementsByTagName("Url");
var PicUrlObj = xml.getElementsByTagName("PicUrl");
for(var ti=1;ti<titleObj.length;ti++){
imghtml = PicUrlObj[ti].firstChild.nodeValue ? '<img align="right" src="'+PicUrlObj[ti].firstChild.nodeValue+'">' : '';
svinfolist += '<p class="clearfix" onclick="popensvurl(\''+UrlObj[ti].firstChild.nodeValue+'\')">'+titleObj[ti].firstChild.nodeValue+imghtml+'</p>';
}
$('div.mediaFooterbox', $('#demoSendBox')).hide();
$('#svinfolist').show().html(svinfolist);
}
}
}
}
$('#receive').text(s);
}else{
$('#receive').text('模拟取消关注成功');
}
})
}
function nl2br(str, is_xhtml) {
// http://kevin.vanzonneveld.net
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Philip Peterson
// + improved by: Onno Marsman
// + improved by: Atli Tór
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Maximusya
// * example 1: nl2br('Kevin\nvan\nZonneveld');
// * returns 1: 'Kevin<br />\nvan<br />\nZonneveld'
// * example 2: nl2br("\nOne\nTwo\n\nThree\n", false);
// * returns 2: '<br>\nOne<br>\nTwo<br>\n<br>\nThree<br>\n'
// * example 3: nl2br("\nOne\nTwo\n\nThree\n", true);
// * returns 3: '<br />\nOne<br />\nTwo<br />\n<br />\nThree<br />\n'
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
}
toggle(curtype);
</script>
<?php template('common/footer'); ?>