人人商城

emulator.ctrl.php 46KB

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