emulator.ctrl.php 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. $_W['page']['title'] = '模拟测试';
  7. $development = 1;
  8. $accounts = uni_owned(0, false);
  9. define('FRAME', '');
  10. template('common/header');
  11. ?>
  12. <style type="text/css">
  13. .chatPanel .left{float:left;}
  14. .chatPanel .right{float:right;}
  15. .chatPanel .media a{display:block;}
  16. .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;}
  17. .chatPanel .media .mediaPanel{padding:0px;margin:0px;}
  18. .chatPanel .media .mediaImg{margin:25px 15px 15px;width:255px;position:relative;}
  19. .chatPanel .media .mediaImg .mediaImgPanel{position:relative;padding:0px;margin:0px;max-height:164px;overflow:hidden;}
  20. .chatPanel .media .mediaImg img{/* width:100%;height:164px;position:absolute;left:0px;*/width:255px;}
  21. .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;}
  22. .chatPanel .media .mediaImg .mediaImgFooter a:hover p{color:#B8B3B3;}
  23. .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;}
  24. .chatPanel .media .mesgIcon{display:inline-block;height:19px;width:13px;margin:8px 0px -2px 4px;}
  25. .chatPanel .media .mediaContent{margin:0px;padding:0px;}
  26. .chatPanel .media .mediaContent .mediaMesg{border-top:1px solid #D7D7D7;padding:10px;}
  27. .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;}
  28. .chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle:hover p{color:#1A1717;}
  29. .chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle a{color:#707577;}
  30. .chatPanel .media .mediaContent .mediaMesg .mediaMesgTitle a:hover p{color:#444440;}
  31. .chatPanel .media .mediaContent .mediaMesg .mediaMesgIcon{}
  32. .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;}
  33. .chatPanel .media .mediaContent .mediaMesg .mediaMesgIcon img{height:45px;width:45px;}
  34. /*media mesg detail*/
  35. .chatPanel .media .mediaHead{/*height:48px;*/padding:0px 15px 4px;border-bottom:0px solid #D3D8DC;color:#000000;font-size:20px;}
  36. .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;*/}
  37. .chatPanel .mediaFullText .mediaImg{width:255px;padding:0;margin:0 15px;overflow:hidden;max-height:164px;}
  38. .chatPanel .mediaFullText .mediaImg img{/*margin-top:17px;position:absolute;*/}
  39. .chatPanel .mediaFullText .mediaContent{padding:0 0 8px;font-size:16px;line-height:1.5em;text-align:left;color:#222222;}
  40. .chatPanel .mediaFullText .mediaContentP{margin:12px 15px 0px; word-break: break-all;}
  41. .chatPanel .media .mediaHead .time{margin:0px;margin-top:21px;color:#8C8C8C;background:none;width:auto;font-size:12px;}
  42. .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;}
  43. .chatPanel .media .mediaFooter a{color:#222222;font-size:16px;padding:0;}
  44. .chatPanel .media .mediaFooter .mesgIcon{margin:15px 3px 0px 0px;}
  45. .chatPanel .media .mediaFooterbox{border-top:1px #CCC solid;}
  46. .chatPanel .media a:hover{cursor:pointer;}
  47. .chatPanel .media a:hover .mesgIcon{}
  48. .mediaContent a:hover{background-color:#F6F6F6;}
  49. .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;}
  50. .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%);}
  51. .chatItem a{text-decoration:none;}.chatItem a:hover{text-decoration:none;}.mediaFooterbox{cursor:pointer; padding:0 15px;}
  52. #svinfolist{display:none;}#svinfolist p{border-top:1px #CCC solid; padding:4px 6px;word-break:break-all; white-space:pre; margin:2px; cursor:pointer;}
  53. #svinfolist p img{width:50px;height:50px;}
  54. .btn{white-space:normal;box-sizing:content-box;}
  55. </style>
  56. <div class="panel panel-content">
  57. <div class="content-head panel-heading">
  58. <span class="font-lg">模拟测试</span>
  59. </div>
  60. <div class="panel-body">
  61. <div class="col-sm-8">
  62. <form action="" method="get" class="form-horizontal form">
  63. <div class="page-header">
  64. <h4>模拟测试</h4>
  65. </div>
  66. <div class="form-group">
  67. <label class="col-xs-12 col-sm-2 col-md-2 control-label"></label>
  68. <div class="col-sm-10 col-xs-12">
  69. <input name="submit" type="button" onclick="submitform()" value="发送" class="btn btn-primary" style="margin-right:15px">
  70. <input name="submit" type="button" onclick="submitprocess()" value="查看触发过程" class="btn btn-success">
  71. </div>
  72. </div>
  73. <div class="form-group">
  74. <label class="col-xs-12 col-sm-2 col-md-2 control-label">公众号</label>
  75. <div class="col-sm-10 col-xs-12">
  76. <select name="account" id="account" class="form-control">
  77. <?php
  78. foreach($accounts as $account) {
  79. ?>
  80. <?php
  81. if(!empty($account)) {
  82. $timestamp = TIMESTAMP;
  83. $nonce = random(5);
  84. $token = $account['token'];
  85. $signkey = array($token, TIMESTAMP, $nonce);
  86. sort($signkey, SORT_STRING);
  87. $signString = implode($signkey);
  88. $signString = sha1($signString);
  89. ?>
  90. <?php if($development == 1) { ?>
  91. <option <?php if ($_W['uniacid'] == $account['uniacid']) { ?>selected<?php } ?> value="<?php echo '../api.php?id='.$account['uniacid'] ?>&timestamp=<?php echo $timestamp ?>&nonce=<?php echo $nonce ?>&signature=<?php echo $signString ?>"><?php echo $account['name']?></option>
  92. <?php } else { ?>
  93. <option <?php if ($_W['uniacid'] == $account['uniacid']) { ?>selected<?php } ?> value="<?php echo $account['uniacid'];?>"><?php echo $account['name'] ?></option>
  94. <?php } ?>
  95. <?php
  96. }
  97. ?>
  98. <?php
  99. }
  100. ?>
  101. </select>
  102. </div>
  103. </div>
  104. <div class="form-group">
  105. <label class="col-xs-12 col-sm-2 col-md-2 control-label">消息类型</label>
  106. <div class="col-sm-10 col-xs-12">
  107. <div class="radio-inline"><input type="radio" name="type" value="text" id="type_text" onclick="toggle('text')" checked="checked" /><label for="type_text">&nbsp;文本</label></div>
  108. <div class="radio-inline"><input type="radio" name="type" value="image" id="type_image" onclick="toggle('image')" /><label for="type_image">&nbsp;图片</label></div>
  109. <div class="radio-inline"><input type="radio" name="type" value="location" id="type_location" onclick="toggle('location')" /><label for="type_location">&nbsp;位置</label></div>
  110. <div class="radio-inline"><input type="radio" name="type" value="link" id="type_link" onclick="toggle('link')" /><label for="type_link">&nbsp;链接</label></div>
  111. <div class="radio-inline"><input type="radio" name="type" value="event" id="type_event" onclick="toggle('event')" /><label for="type_event">&nbsp;菜单</label></div>
  112. <div class="radio-inline"><input type="radio" name="type" value="subscribe" id="type_subscribe" onclick="toggle('subscribe')" /><label for="type_subscribe">&nbsp;模拟关注</label></div>
  113. <div class="radio-inline"><input type="radio" name="type" value="unsubscribe" id="type_unsubscribe" onclick="toggle('unsubscribe')" /><label for="type_unsubscribe">&nbsp;取消关注</label></div>
  114. <div class="radio-inline"><input type="radio" name="type" value="other" id="type_other" onclick="toggle('other')" /><label for="type_other">&nbsp;其他</label></div>
  115. </div>
  116. </div>
  117. <div class="form-group">
  118. <label class="col-xs-12 col-sm-2 col-md-2 control-label">发送用户</label>
  119. <div class="col-sm-10 col-xs-12">
  120. <input type="text" id="fromuser" value="fromUser" class="form-control" />
  121. </div>
  122. </div>
  123. <div class="form-group">
  124. <label class="col-xs-12 col-sm-2 col-md-2 control-label">接收用户</label>
  125. <div class="col-sm-10 col-xs-12">
  126. <input type="text" id="touser" value="toUser" class="form-control" />
  127. </div>
  128. </div>
  129. <div class="form-group content_type" id="text">
  130. <label class="col-xs-12 col-sm-2 col-md-2 control-label">内容</label>
  131. <div class="col-sm-10 col-xs-12">
  132. <textarea id="contentvalue" rows="5" cols="50" class="form-control">测试内容</textarea>
  133. </div>
  134. </div>
  135. <div class="form-group content_type" id="image">
  136. <label class="col-xs-12 col-sm-2 col-md-2 control-label">图片</label>
  137. <div class="col-sm-10 col-xs-12">
  138. <input type="text" id="picurl" value="http://www.baidu.com/img/bdlogo.gif" class="form-control" />
  139. </div>
  140. </div>
  141. <div id="location" class="content_type">
  142. <div class="form-group">
  143. <label class="col-xs-12 col-sm-2 col-md-2 control-label">X坐标</label>
  144. <div class="col-sm-10 col-xs-12">
  145. <input type="text" id="location_x" class="form-control" value="23.134521" />
  146. </div>
  147. </div>
  148. <div class="form-group" >
  149. <label class="col-xs-12 col-sm-2 col-md-2 control-label">Y坐标</label>
  150. <div class="col-sm-10 col-xs-12">
  151. <input type="text" id="location_y" class="form-control" value="113.358803" />
  152. </div>
  153. </div>
  154. </div>
  155. <div class="form-group content_type" id="link">
  156. <label class="col-xs-12 col-sm-2 col-md-2 control-label">链接</label>
  157. <div class="col-sm-10 col-xs-12">
  158. <input type="text" id="url" class="form-control" value="http://baidu.com" />
  159. </div>
  160. </div>
  161. <div class="form-group content_type" id="event">
  162. <label class="col-xs-12 col-sm-2 col-md-2 control-label">EventKey</label>
  163. <div class="col-sm-10 col-xs-12">
  164. <input type="text" id="event_key" class="form-control" value="EVENTKEY" />
  165. </div>
  166. </div>
  167. <div class="form-group">
  168. <label class="col-xs-12 col-sm-2 col-md-2 control-label">发送消息</label>
  169. <div class="col-sm-10 col-xs-12">
  170. <textarea id="sendxml" rows="10" cols="50" class="form-control" readonly="readonly"></textarea>
  171. </div>
  172. </div>
  173. <div class="form-group" style="display:none" id="process">
  174. <label class="col-xs-12 col-sm-2 col-md-2 control-label">处理过程</label>
  175. <div class="col-sm-10 col-xs-12 table-responsive">
  176. </div>
  177. </div>
  178. <div class="form-group">
  179. <label class="col-xs-12 col-sm-2 col-md-2 control-label">接收消息</label>
  180. <div class="col-sm-10 col-xs-12">
  181. <pre id="receive"></pre>
  182. </div>
  183. </div>
  184. </form>
  185. </div>
  186. <div class="col-sm-4" id="demoSendBox">
  187. <div class="chatPanel form" style="width:300px;">
  188. <div class="page-header">
  189. <h4>预览效果</h4>
  190. </div>
  191. <div id="svposttext" style="text-align:left; padding-bottom:10px;display:none;">
  192. <img src="./resource/images/noavatar_middle.gif" style="width:34px;height:34px;margin-right:6px;float:right;" class="img-rounded">
  193. <div id="svpostinfo" class="btn btn-success" style="margin-right: 4px;float: right;max-width: 184px;text-align:left;">发送内容</div>
  194. <div style="clear:both;"></div>
  195. </div>
  196. <div class="chatItem you">
  197. <div id="svtext" style="text-align:left; padding-bottom:10px;display:none;">
  198. <img src="./resource/images/noavatar_middle.gif" style="width:34px;height:34px;margin-left:6px; float:left;" class="img-rounded">
  199. <div class="btn btn-success" style="margin-left: 4px;float: left;max-width: 184px;text-align:left;">回复内容</div>
  200. <div style="clear:both;"></div>
  201. </div>
  202. <div id="svurlbox" style="display:none;">
  203. <div class="media mediaFullText">
  204. <div class="mediaPanel">
  205. <a href="javascript:;" id="svurl" target="_blank">
  206. <div class="mediaHead"><span class="title" id="svtitle">标题</span><span class="time"><?php echo date('m月d日'); ?></span>
  207. <div class="clr"></div>
  208. </div>
  209. <div class="mediaImg"><img id="svpic" src=""></div>
  210. <div class="mediaContent mediaContentP"><p id="svinfo"></p></div>
  211. </a>
  212. <div id="svinfolist"></div>
  213. <div class="mediaFooter">
  214. <div class="mediaFooterbox clearfix" onclick="opensvurl();">
  215. <span class="mesgIcon right">&gt;</span>
  216. <span style="line-height:50px;" class="left">查看全文</span>
  217. </div>
  218. <div class="clr"></div>
  219. </div>
  220. </div>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. <?php
  229. if($development == 1) {?>
  230. <script type="text/javascript">
  231. require(['jquery'], function($){
  232. $('.content_type').hide();
  233. $('#text').show();
  234. toggle('text');
  235. });
  236. function opensvurl(){
  237. var href=$("#svurl").attr("href");
  238. window.open(href, "_blank");
  239. }
  240. function popensvurl(href){
  241. if(href)window.open(href, "_blank");
  242. }
  243. function toggle(type) {
  244. curtype = type;
  245. $('.content_type').hide();
  246. $("#" + curtype).show();
  247. buildRequest(type);
  248. $('#receive').text('');
  249. $('#svposttext').hide();
  250. $('#svtext').hide();
  251. $('#svurlbox').hide();
  252. $('#sendxml').attr('readonly', 'readonly');
  253. if(type == 'other') {
  254. $('#sendxml').removeAttr('readonly');
  255. }
  256. }
  257. function getxml(xmlstring){
  258. var xmlobject = null;
  259. try{
  260. if(window.ActiveXObject){
  261. xmlobject =new ActiveXObject("Microsoft.XMLDOM");
  262. xmlobject.async="false";
  263. xmlobject.loadXML(xmlstring);
  264. }else{// 用于 Mozilla, Firefox, Opera, 等浏览器的代码:
  265. var parser=new DOMParser();
  266. xmlobject =parser.parseFromString(xmlstring,"text/xml");
  267. }
  268. }catch(e){alert("您的浏览器不支持模拟测试");}
  269. return xmlobject;
  270. }
  271. function buildRequest(type) {
  272. var $demoSendBox = $('#demoSendBox');
  273. $('span.time', $demoSendBox).show();
  274. $('div.mediaImg', $demoSendBox).show();
  275. $('div.mediaContent', $demoSendBox).show();
  276. $('div.mediaFooterbox', $demoSendBox).show();
  277. var time = Math.round(new Date().getTime()/1000);
  278. xml = "<xml>\n"+
  279. "<ToUserName><![CDATA["+$('#touser').val()+"]]></ToUserName>\n"+
  280. "<FromUserName><![CDATA["+$('#fromuser').val()+"]]></FromUserName>\n"+
  281. "<CreateTime>"+time+"</CreateTime>\n";
  282. if (type == 'text') {
  283. xml += "<MsgType><![CDATA[text]]></MsgType>\n";
  284. xml += "<Content><![CDATA["+$('#contentvalue').val()+"]]></Content>\n";
  285. $('#svpostinfo').text($('#contentvalue').val());
  286. } else if (type == 'image') {
  287. xml += "<MsgType><![CDATA[image]]></MsgType>\n";
  288. xml += "<PicUrl><![CDATA["+$('#picurl').val()+"]]></PicUrl>";
  289. $('#svpostinfo').html('<img src="'+$('#picurl').val()+'">');
  290. } else if (type == 'location') {
  291. xml += "<MsgType><![CDATA[location]]></MsgType>\n";
  292. xml += "<Location_X>"+parseFloat($('#location_x').val())+"</Location_X>\n";
  293. xml += "<Location_Y>"+parseFloat($('#location_y').val())+"</Location_Y>\n";
  294. xml += "<Scale>20</Scale>\n";
  295. xml += "<Label><![CDATA[位置信息]]></Label>\n";
  296. $('span.time', $demoSendBox).hide();
  297. $('div.mediaImg', $demoSendBox).hide();
  298. $('div.mediaContent', $demoSendBox).hide();
  299. $('#svpostinfo').html('<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAcEBAQFBAcFBQcKBwUHCgwJBwcJDA0LCwwLCw0RDQ0NDQ0NEQ0PEBEQDw0UFBYWFBQeHR0dHiIiIiIiIiIiIiL/2wBDAQgHBw0MDRgQEBgaFREVGiAgICAgICAgICAgICAhICAgICAgISEhICAgISEhISEhISEiIiIiIiIiIiIiIiIiIiL/wAARCABvAMgDAREAAhEBAxEB/8QAHAABAAEFAQEAAAAAAAAAAAAAAAMBAgQFBgcI/8QATBAAAAUBAwYICQkGBQUAAAAAAAECAwQRBQYSExQhIjFRBzJBUlSRktIVFyNTYXGToaMWJDM0N0JicoF0g7Gys9FDY3OCwQglNUTh/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAECAwUGBP/EADARAAIBAgMHBAEEAgMAAAAAAAABAgMRExRSBBIhMVFhkQUyQXEiIzRCgTOhscHx/9oADAMBAAIRAxEAPwD3yfPzeiElVZ+4UnOxWUrGF4Wmb09QyxGU32PC03enqDEY32PC03enqDEY32PC03enqDEY32PC03enqDEY32PC03enqDEY32WuWxOS2pRGmpEZ7BWdaSi32JjK7MVF4rTNEUzNFXTIl6voHC2T1ivOpGLtZ9jpV9mhGDa+DLVbE0kmdU6C3D0CqM5m+ZVoT5DBsZMy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ml += "<Title><![CDATA[测试链接]]></Title>\n";
  303. xml += "<Description><![CDATA[测试链接描述]]></Description>\n";
  304. xml += "<Url><![CDATA["+$('#url').val()+"]]></Url>\n";
  305. } else if (type == 'subscribe') {
  306. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  307. xml += "<Event><![CDATA[subscribe]]></Event>\n";
  308. xml += "<EventKey><![CDATA[]]></EventKey>\n";
  309. } else if (type == 'unsubscribe') {
  310. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  311. xml += "<Event><![CDATA[unsubscribe]]></Event>\n";
  312. xml += "<EventKey><![CDATA[]]></EventKey>\n";
  313. } else if (type == 'event') {
  314. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  315. xml += "<Event><![CDATA[CLICK]]></Event>\n";
  316. xml += "<EventKey><![CDATA["+$('#event_key').val()+"]]></EventKey>\n";
  317. }
  318. xml += "<MsgId>1234567890123456</MsgId>\n"+
  319. "</xml>";
  320. if(type == 'other') {
  321. xml = $('#sendxml').val();
  322. }
  323. $('#sendxml').val(xml);
  324. }
  325. function submitprocess() {
  326. buildRequest(curtype);
  327. $('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
  328. $('div.mediaFooterbox', $('#demoSendBox')).show();
  329. var url = $('#account').val() + '&debug=1';
  330. $.ajax(url, {
  331. type : 'POST',
  332. headers : {"Content-type" : "text/xml"},
  333. data : $('#sendxml').val().replace(/[\r\n]/g,""),
  334. beforeSend : function(){
  335. if(curtype!='subscribe' && curtype!='unsubscribe'){
  336. if(curtype=='text' || curtype=='image' || curtype == 'location'){
  337. $('#svposttext').show();
  338. }
  339. }
  340. $('#receive').text('加载中。。。');
  341. }
  342. }).done(function(data){
  343. var data = $.parseJSON(data);
  344. var s = data.resp;
  345. var p = data.process;
  346. if(1 || curtype!='unsubscribe'){
  347. var xmlobject = getxml(s);
  348. if(xmlobject){
  349. var xmlobj = xmlobject.getElementsByTagName("xml");
  350. if(xmlobj.length){
  351. var xmls = xmlobj.item(0);
  352. var xml = xmls;
  353. if (xml.getElementsByTagName("FromUserName").length > 0) {
  354. var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
  355. var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
  356. var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue;
  357. } else {
  358. var MsgType = 'text';
  359. var Content = '';
  360. }
  361. if(MsgType=='text'){
  362. if (xml.getElementsByTagName("FromUserName").length > 0) {
  363. var Content = xml.getElementsByTagName("Content")[0].firstChild.nodeValue;
  364. } else {
  365. var Content = '';
  366. }
  367. Content = nl2br(Content);
  368. Content = Content.replace('./index', "../app/index");
  369. Content && $('#svtext').show().find('div.btn').html(Content);
  370. }else if(MsgType == 'news'){
  371. var Title = xml.getElementsByTagName("Title")[0].firstChild.nodeValue;
  372. var Description = xml.getElementsByTagName("Description")[0].firstChild.nodeValue;
  373. var PicUrl = xml.getElementsByTagName("PicUrl")[0].firstChild.nodeValue;
  374. var Url = xml.getElementsByTagName("Url")[0].firstChild.nodeValue;
  375. if(Url.indexOf('http://') == -1 && Url.indexOf('https://') == -1) {
  376. Url = '../app/' + Url;
  377. }
  378. $('#svtitle').html(Title);
  379. $('#svinfo').html(Description);
  380. $('#svpic').attr('src', PicUrl);
  381. $('#svurlbox').show().find('a#svurl').attr('href', Url);
  382. var titleObj = xml.getElementsByTagName("Title");
  383. if(titleObj.length>1){
  384. var svinfolist = imghtml = '';
  385. var UrlObj = xml.getElementsByTagName("Url");
  386. var PicUrlObj = xml.getElementsByTagName("PicUrl");
  387. for(var ti=1;ti<titleObj.length;ti++){
  388. imghtml = PicUrlObj[ti].firstChild.nodeValue ? '<img align="right" src="'+PicUrlObj[ti].firstChild.nodeValue+'">' : '';
  389. svinfolist += '<p class="clearfix" onclick="popensvurl(\''+UrlObj[ti].firstChild.nodeValue+'\')">'+titleObj[ti].firstChild.nodeValue+imghtml+'</p>';
  390. }
  391. $('div.mediaFooterbox', $('#demoSendBox')).hide();
  392. $('#svinfolist').show().html(svinfolist);
  393. }
  394. }
  395. }
  396. }
  397. $('#receive').text(s);
  398. }else{
  399. $('#receive').text('模拟取消关注成功');
  400. }
  401. $('#process').find('div').html(p);
  402. $('#process').show();
  403. });
  404. }
  405. function submitform() {
  406. $('#process').hide();
  407. buildRequest(curtype);
  408. $('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
  409. $('div.mediaFooterbox', $('#demoSendBox')).show();
  410. $.ajax($('#account').val(), {
  411. type : 'POST',
  412. headers : {"Content-type" : "text/xml"},
  413. data : $('#sendxml').val().replace(/[\r\n]/g,""),
  414. beforeSend : function(){
  415. if(curtype!='subscribe' && curtype!='unsubscribe'){
  416. if(curtype=='text' || curtype=='image' || curtype == 'location'){
  417. $('#svposttext').show();
  418. }
  419. }
  420. $('#receive').text('加载中。。。');
  421. }
  422. }).done(function(s){
  423. if(1 || curtype!='unsubscribe'){
  424. var xmlobject = getxml(s);
  425. if(xmlobject){
  426. var xmlobj = xmlobject.getElementsByTagName("xml");
  427. if(xmlobj.length){
  428. var xmls = xmlobj.item(0);
  429. var xml = xmls;
  430. /* var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
  431. var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
  432. var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue; */
  433. if (xml.getElementsByTagName("FromUserName").length > 0) {
  434. var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
  435. var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
  436. var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue;
  437. } else {
  438. var MsgType = 'text';
  439. var Content = '';
  440. }
  441. if(MsgType=='text'){
  442. if (xml.getElementsByTagName("FromUserName").length > 0) {
  443. var Content = xml.getElementsByTagName("Content")[0].firstChild.nodeValue;
  444. } else {
  445. var Content = '';
  446. }
  447. Content = nl2br(Content);
  448. Content = Content.replace('./index', "../app/index");
  449. Content && $('#svtext').show().find('div.btn').html(Content);
  450. }else if(MsgType == 'news'){
  451. var Title = xml.getElementsByTagName("Title")[0].firstChild.nodeValue;
  452. var Description = xml.getElementsByTagName("Description")[0].firstChild.nodeValue;
  453. var PicUrl = xml.getElementsByTagName("PicUrl")[0].firstChild.nodeValue;
  454. var Url = xml.getElementsByTagName("Url")[0].firstChild.nodeValue;
  455. if(Url.indexOf('http://') == -1 && Url.indexOf('https://') == -1) {
  456. Url = '../app/' + Url;
  457. }
  458. $('#svtitle').html(Title);
  459. $('#svinfo').html(Description);
  460. $('#svpic').attr('src', PicUrl);
  461. $('#svurlbox').show().find('a#svurl').attr('href', Url);
  462. var titleObj = xml.getElementsByTagName("Title");
  463. if(titleObj.length>1){
  464. var svinfolist = imghtml = '';
  465. var UrlObj = xml.getElementsByTagName("Url");
  466. var PicUrlObj = xml.getElementsByTagName("PicUrl");
  467. for(var ti=1;ti<titleObj.length;ti++){
  468. imghtml = PicUrlObj[ti].firstChild.nodeValue ? '<img align="right" src="'+PicUrlObj[ti].firstChild.nodeValue+'">' : '';
  469. svinfolist += '<p class="clearfix" onclick="popensvurl(\''+UrlObj[ti].firstChild.nodeValue+'\')">'+titleObj[ti].firstChild.nodeValue+imghtml+'</p>';
  470. }
  471. $('div.mediaFooterbox', $('#demoSendBox')).hide();
  472. $('#svinfolist').show().html(svinfolist);
  473. }
  474. }
  475. }
  476. }
  477. $('#receive').text(s);
  478. }else{
  479. $('#receive').text('模拟取消关注成功');
  480. }
  481. })
  482. }
  483. function nl2br(str, is_xhtml) {
  484. var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display
  485. return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
  486. }
  487. </script>
  488. <?php } else { ?>
  489. <script type="text/javascript">
  490. require(['jquery'], function($){
  491. $('.content_type').hide();
  492. $('#text').show();
  493. toggle('text');
  494. });
  495. function opensvurl(){
  496. var href=$("#svurl").attr("href");
  497. window.open(href, "_blank");
  498. }
  499. function popensvurl(href){
  500. if(href)window.open(href, "_blank");
  501. }
  502. function toggle(type) {
  503. curtype = type;
  504. $('.content_type').hide();
  505. $("#" + curtype).show();
  506. buildRequest(type);
  507. $('#receive').text('');
  508. $('#svposttext').hide();
  509. $('#svtext').hide();
  510. $('#svurlbox').hide();
  511. $('#sendxml').attr('readonly', 'readonly');
  512. if(type == 'other') {
  513. $('#sendxml').removeAttr('readonly');
  514. }
  515. }
  516. function getxml(xmlstring){
  517. var xmlobject = null;
  518. try{
  519. if(window.ActiveXObject){
  520. xmlobject =new ActiveXObject("Microsoft.XMLDOM");
  521. xmlobject.async="false";
  522. xmlobject.loadXML(xmlstring);
  523. }else{// 用于 Mozilla, Firefox, Opera, 等浏览器的代码:
  524. var parser=new DOMParser();
  525. xmlobject =parser.parseFromString(xmlstring,"text/xml");
  526. }
  527. }catch(e){alert("您的浏览器不支持模拟测试");}
  528. return xmlobject;
  529. }
  530. function buildRequest(type) {
  531. var $demoSendBox = $('#demoSendBox');
  532. $('span.time', $demoSendBox).show();
  533. $('div.mediaImg', $demoSendBox).show();
  534. $('div.mediaContent', $demoSendBox).show();
  535. $('div.mediaFooterbox', $demoSendBox).show();
  536. var time = Math.round(new Date().getTime()/1000);
  537. xml = "<xml>\n"+
  538. "<ToUserName><![CDATA["+$('#touser').val()+"]]></ToUserName>\n"+
  539. "<FromUserName><![CDATA["+$('#fromuser').val()+"]]></FromUserName>\n"+
  540. "<CreateTime>"+time+"</CreateTime>\n";
  541. if (type == 'text') {
  542. xml += "<MsgType><![CDATA[text]]></MsgType>\n";
  543. xml += "<Content><![CDATA["+$('#contentvalue').val()+"]]></Content>\n";
  544. $('#svpostinfo').text($('#contentvalue').val());
  545. } else if (type == 'image') {
  546. xml += "<MsgType><![CDATA[image]]></MsgType>\n";
  547. xml += "<PicUrl><![CDATA["+$('#picurl').val()+"]]></PicUrl>";
  548. $('#svpostinfo').html('<img src="'+$('#picurl').val()+'">');
  549. } else if (type == 'location') {
  550. xml += "<MsgType><![CDATA[location]]></MsgType>\n";
  551. xml += "<Location_X>"+parseFloat($('#location_x').val())+"</Location_X>\n";
  552. xml += "<Location_Y>"+parseFloat($('#location_y').val())+"</Location_Y>\n";
  553. xml += "<Scale>20</Scale>\n";
  554. xml += "<Label><![CDATA[位置信息]]></Label>\n";
  555. $('span.time', $demoSendBox).hide();
  556. $('div.mediaImg', $demoSendBox).hide();
  557. $('div.mediaContent', $demoSendBox).hide();
  558. $('#svpostinfo').html('<img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAcEBAQFBAcFBQcKBwUHCgwJBwcJDA0LCwwLCw0RDQ0NDQ0NEQ0PEBEQDw0UFBYWFBQeHR0dHiIiIiIiIiIiIiL/2wBDAQgHBw0MDRgQEBgaFREVGiAgICAgICAgICAgICAhICAgICAgISEhICAgISEhISEhISEiIiIiIiIiIiIiIiIiIiL/wAARCABvAMgDAREAAhEBAxEB/8QAHAABAAEFAQEAAAAAAAAAAAAAAAMBAgQFBgcI/8QATBAAAAUBAwYICQkGBQUAAAAAAAECAwQRBQYSExQhIjFRBzJBUlSRktIVFyNTYXGToaMWJDM0N0JicoF0g7Gys9FDY3OCwQglNUTh/8QAGgEBAAMBAQEAAAAAAAAAAAAAAAECAwUGBP/EADARAAIBAgMHBAEEAgMAAAAAAAABAgMRExRSBBIhMVFhkQUyQXEiIzRCgTOhscHx/9oADAMBAAIRAxEAPwD3yfPzeiElVZ+4UnOxWUrGF4Wmb09QyxGU32PC03enqDEY32PC03enqDEY32PC03enqDEY32PC03enqDEY32PC03enqDEY32WuWxOS2pRGmpEZ7BWdaSi32JjK7MVF4rTNEUzNFXTIl6voHC2T1ivOpGLtZ9jpV9mhGDa+DLVbE0kmdU6C3D0CqM5m+ZVoT5DBsZMy8o3jVUuXQLzlYvJ2MbwtN3p6hniMpvs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KpoRv5Bb+W+uRBorMuzbTXBK0txlKUotdm01eUb0RG0ES3ONyU2bReU1v/ANA62ZYk+RaM3HAflWc9bLVsRpMN6LRaGmEkgvKOJPS4nTo2DLe/4sSaWMu9MywL4pRIRAmzbQrEgnLbStujnzlBaaVWnRo4wu7Xj82IOusxV4kWLOQ6xaqZCUtFGQ7MgreVRWtkVpLCkyLjZTaQxdr/APpJw8Rucm+96kzikNPPWDIVgmPNPO1NCEkZqa8nyaCLYQ3l7V9kGNfO4N7LwSbNlR4SWjYgR4klK5UXjs1KrdF6SMj5RMKqjcWOksOz7RVwzOWk7FyMRFlk22a3WVqwpImkqVk1KIjWaT0EYzlL9MfJ2pLXzT9o7/cfMWPLP+oSK8c2x5uDyObrZNda6+PFhOuts06R9uyPgysjzAfSVAAAAAAA6vgc+0yyf3/9BYsuRHyZvDx9orv7JG/gYqWOHAgAAAAAAClCAChACtABShACoApQgANKdwArQgJAAphIAVoBAoBIAACAAAAAAAOr4HPtMsn9/wD0Fiy5EfJ6Nws8GMu8rrdr2SpPhFlGTeaWeEnEFpTQ+QyFSx5efBrfUlGWY7P85nvgCni2vp0H4rPfADxbX06D8VnvgB4tr6dB+Kz3wA8W19Og/FZ74AeLa+nQfis98AFcG19cJ/MfjM98GCJPBtfrU+Y+vyzHfHy01Pe4mkrEvi2vrT6j8Znvj6jMqfBvfTV+Y8mnyrPfAFPFtfWv1H4rHfAFU8G99MZVg6P9VjvgCE+DW/VfqPxmO+LqxVlPFrfroPxme+J4EDxa366D8ZjviHYkkf4Nr7ZTUg6KeeY74iJLI/FrfroPxme+LcCo8Wt+ug/GZ74cAPFrfroPxme+HADxa366D8ZnvhwA8Wt+ug/GZ74cAPFrfroPxme+HAFfFrfroPxme+HAHo3BBwVWpYlpfKC3MKZCUGiJHSol0xlRS1GWjZooKtkpH//Z">');
  559. } else if (type == 'link') {
  560. xml += "<MsgType><![CDATA[link]]></MsgType>\n";
  561. xml += "<Title><![CDATA[测试链接]]></Title>\n";
  562. xml += "<Description><![CDATA[测试链接描述]]></Description>\n";
  563. xml += "<Url><![CDATA["+$('#url').val()+"]]></Url>\n";
  564. } else if (type == 'subscribe') {
  565. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  566. xml += "<Event><![CDATA[subscribe]]></Event>\n";
  567. xml += "<EventKey><![CDATA[]]></EventKey>\n";
  568. } else if (type == 'unsubscribe') {
  569. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  570. xml += "<Event><![CDATA[unsubscribe]]></Event>\n";
  571. xml += "<EventKey><![CDATA[]]></EventKey>\n";
  572. } else if (type == 'event') {
  573. xml += "<MsgType><![CDATA[event]]></MsgType>\n";
  574. xml += "<Event><![CDATA[CLICK]]></Event>\n";
  575. xml += "<EventKey><![CDATA["+$('#event_key').val()+"]]></EventKey>\n";
  576. }
  577. xml += "<MsgId>1234567890123456</MsgId>\n"+
  578. "</xml>";
  579. if(type == 'other') {
  580. xml = $('#sendxml').val();
  581. }
  582. $('#sendxml').val(xml);
  583. }
  584. function submitform() {
  585. buildRequest(curtype);
  586. var id = $('#account').val();
  587. $.ajax('<?php echo $_W['siteroot']?>api.php?flag=1&id=' + id, {
  588. type : 'POST',
  589. headers : {"Content-type" : "text/xml"},
  590. data : $('#sendxml').val().replace(/[\r\n]/g,""),
  591. success : function(data) {
  592. var data = $.parseJSON(data);
  593. var url = '<?php echo $_W['siteroot']?>api.php?encrypt_type=' + data.encrypt_type + '&id=' + id + '&timestamp=' + data.timestamp + '&nonce=' + data.nonce + '&signature=' + data.signature + '&msg_signature=' + data.msg_signature;
  594. if(data.encrypt_type == 'aes') {
  595. var xml = "";
  596. xml += "<xml>\n";
  597. xml += "<ToUserName><![CDATA["+$('#touser').val()+"]]></ToUserName>\n";
  598. xml += "<Encrypt><![CDATA["+data.msg+"]]></Encrypt>\n";
  599. xml += "</xml>";
  600. } else {
  601. var xml = $('#sendxml').val();
  602. }
  603. $('#svtext').hide();$('#svurlbox').hide();$('#svinfolist').hide();
  604. $('div.mediaFooterbox', $('#demoSendBox')).show();
  605. $.ajax(url, {
  606. type : 'POST',
  607. headers : {"Content-type" : "text/xml"},
  608. data : xml.replace(/[\r\n]/g,""),
  609. beforeSend : function(){
  610. if(curtype!='subscribe' && curtype!='unsubscribe'){
  611. if(curtype=='text' || curtype=='image' || curtype == 'location'){
  612. $('#svposttext').show();
  613. }
  614. }
  615. $('#receive').text('加载中。。。');
  616. }
  617. }).done(function(s){
  618. if(1 || curtype!='unsubscribe'){
  619. $.ajax('<?php echo $_W['siteroot']?>api.php?flag=2&id=' + id, {
  620. type : 'POST',
  621. headers : {"Content-type" : "text/xml"},
  622. data : s.replace(/[\r\n]/g,""),
  623. success : function(s) {
  624. var xmlobject = getxml(s);
  625. if(xmlobject){
  626. var xmlobj = xmlobject.getElementsByTagName("xml");
  627. if(xmlobj.length){
  628. var xmls = xmlobj.item(0);
  629. var xml = xmls;
  630. /* var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
  631. var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
  632. var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue; */
  633. if (xml.getElementsByTagName("FromUserName").length > 0) {
  634. var FromUserName = xml.getElementsByTagName("FromUserName")[0].firstChild.nodeValue;
  635. var ToUserName = xml.getElementsByTagName("ToUserName")[0].firstChild.nodeValue;
  636. var MsgType = xml.getElementsByTagName("MsgType")[0].firstChild.nodeValue;
  637. } else {
  638. var MsgType = 'text';
  639. var Content = '';
  640. }
  641. if(MsgType=='text'){
  642. if (xml.getElementsByTagName("FromUserName").length > 0) {
  643. var Content = xml.getElementsByTagName("Content")[0].firstChild.nodeValue;
  644. } else {
  645. var Content = '';
  646. }
  647. Content = nl2br(Content);
  648. Content = Content.replace('./index', "../app/index");
  649. Content && $('#svtext').show().find('div.btn').html(Content);
  650. }else if(MsgType == 'news'){
  651. var Title = xml.getElementsByTagName("Title")[0].firstChild.nodeValue;
  652. var Description = xml.getElementsByTagName("Description")[0].firstChild.nodeValue;
  653. var PicUrl = xml.getElementsByTagName("PicUrl")[0].firstChild.nodeValue;
  654. var Url = xml.getElementsByTagName("Url")[0].firstChild.nodeValue;
  655. if(Url.indexOf('http://') == -1 && Url.indexOf('https://') == -1) {
  656. Url = '../app/' + Url;
  657. }
  658. $('#svtitle').html(Title);
  659. $('#svinfo').html(Description);
  660. $('#svpic').attr('src', PicUrl);
  661. $('#svurlbox').show().find('a#svurl').attr('href', Url);
  662. var titleObj = xml.getElementsByTagName("Title");
  663. if(titleObj.length>1){
  664. var svinfolist = imghtml = '';
  665. var UrlObj = xml.getElementsByTagName("Url");
  666. var PicUrlObj = xml.getElementsByTagName("PicUrl");
  667. for(var ti=1;ti<titleObj.length;ti++){
  668. imghtml = PicUrlObj[ti].firstChild.nodeValue ? '<img align="right" src="'+PicUrlObj[ti].firstChild.nodeValue+'">' : '';
  669. svinfolist += '<p class="clearfix" onclick="popensvurl(\''+UrlObj[ti].firstChild.nodeValue+'\')">'+titleObj[ti].firstChild.nodeValue+imghtml+'</p>';
  670. }
  671. $('div.mediaFooterbox', $('#demoSendBox')).hide();
  672. $('#svinfolist').show().html(svinfolist);
  673. }
  674. }
  675. }
  676. }
  677. $('#receive').text(s);
  678. }
  679. });
  680. }else{
  681. $('#receive').text('模拟取消关注成功');
  682. }
  683. })
  684. }
  685. });
  686. }
  687. function nl2br(str, is_xhtml) {
  688. var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display
  689. return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
  690. }
  691. </script>
  692. <?php }
  693. ?>
  694. <?php template('common/footer'); ?>