wsq_my_event.inc.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?php
  2. if(!defined('IN_DISCUZ')) {
  3. exit('Access Denied');
  4. }
  5. $siteid = $_G['wechat']['setting']['wsq_siteid'];
  6. require_once libfile('function/post');
  7. $tmp = explode("\n",$_G['cache']['plugin']['xj_event']['event_offline_class']);
  8. $offlineclass = array();
  9. foreach($tmp as $key=>$value){
  10. $eventclass = explode("|",$value);
  11. $offlineclass[$eventclass[0]] = $eventclass[1];
  12. }
  13. $tmp = explode("\n",$_G['cache']['plugin']['xj_event']['event_online_class']);
  14. $onlineclass = array();
  15. foreach($tmp as $key=>$value){
  16. $eventclass = explode("|",$value);
  17. $onlineclass[$eventclass[0]] = $eventclass[1];
  18. }
  19. $perpage = 10; //ÿҳÊý
  20. if($_GET['act']=='cj'){
  21. $listcount = DB::result_first("SELECT count(*) FROM ".DB::table('xj_eventapply')." A,".DB::table('xj_event')." B,".DB::table('forum_thread')." C WHERE A.tid=B.tid and B.tid=C.tid and A.uid=".intval($_G['uid']));
  22. $page = $_GET['page']?$_GET['page']:1;
  23. //if(@ceil($listcount/$perpage) < $page) {
  24. // $page = 1;
  25. //}
  26. $start_limit = ($page - 1) * $perpage;
  27. $query = DB::query("SELECT * FROM ".DB::table('xj_eventapply')." A,".DB::table('xj_event')." B,".DB::table('forum_thread')." C WHERE A.tid=B.tid and B.tid=C.tid AND A.uid=".intval($_G['uid'])." ORDER BY B.eid DESC LIMIT $start_limit,$perpage");
  28. }elseif($_GET['act']=='zz'){
  29. $listcount = DB::result_first("SELECT count(*) FROM ".DB::table('xj_event')." A,".DB::table('forum_thread')." B WHERE A.tid=B.tid and B.authorid=".intval($_G['uid'])." ORDER BY A.eid");
  30. $page = $_GET['page']?$_GET['page']:1;
  31. //if(@ceil($listcount/$perpage) < $page) {
  32. // $page = 1;
  33. //}
  34. $start_limit = ($page - 1) * $perpage;
  35. $query = DB::query("SELECT * FROM ".DB::table('xj_event')." A,".DB::table('forum_thread')." B WHERE A.tid=B.tid and B.authorid=".intval($_G['uid'])." ORDER BY A.eid DESC LIMIT $start_limit,$perpage");
  36. }
  37. $toplist = array();
  38. while($value = DB::fetch($query)){
  39. $value['subject'] = cutstr($value['subject'],50);
  40. //»ñÈ¡±¨ÃûÈËÊý
  41. $value['zynumber'] = DB::result_first("SELECT count(*) FROM ".DB::table('xj_eventthread')." WHERE eid=".$value['eid']);
  42. $value['applynumber'] = DB::result_first("SELECT SUM(applynumber) FROM ".DB::table('xj_eventapply')." WHERE tid=".$value['tid']." and verify=1");
  43. $value['applynumber'] = $value['applynumber']?$value['applynumber']:0;
  44. $value['activityaid_url'] = $value['activityaid']?getforumimg($value['activityaid'],0,80,80):'static/image/common/nophoto.gif';
  45. $value['starttime'] = date('Y-m-d',$value['starttime']);
  46. $value['message'] = DB::result_first("SELECT message FROM ".DB::table('forum_post')." WHERE tid=".$value['tid']);
  47. $value['message'] = messagecutstr($value['message'],50);
  48. $value['setting'] = unserialize($value['setting']);
  49. $toplist[] = $value;
  50. }
  51. if($_GET['output']=='json'){
  52. foreach($toplist as $key=>$value){
  53. if($value['setting']['eventaa']){
  54. $toplist[$key]['use_cost_str'] = 'AA';
  55. }else{
  56. if($value['use_cost']>0){
  57. $toplist[$key]['use_cost_str'] = $value['use_cost'].lang('plugin/xj_event', 'yuan');
  58. }else{
  59. $toplist[$key]['use_cost_str'] = lang('plugin/xj_event', 'mianfei');
  60. }
  61. }
  62. if($value['postclass']==1){
  63. $toplist[$key]['postclass'] = lang('plugin/xj_event', 'xianxia');
  64. }else{
  65. $toplist[$key]['postclass'] = lang('plugin/xj_event', 'xianshan');
  66. }
  67. if($value['postclass']==1){
  68. $toplist[$key]['zclass'] = $offlineclass[$value['offlineclass']];
  69. }else{
  70. $toplist[$key]['zclass'] = $onlineclass[$value['onlineclass']];
  71. }
  72. if($_G['charset']=='gbk'){
  73. $toplist[$key]['subject'] = iconv("GBK", "UTF-8", $value['subject']);
  74. $toplist[$key]['zclass'] = iconv("GBK", "UTF-8", $toplist[$key]['zclass']);
  75. $toplist[$key]['postclass'] = iconv("GBK", "UTF-8", $toplist[$key]['postclass']);
  76. $toplist[$key]['use_cost_str'] = iconv("GBK", "UTF-8", $toplist[$key]['use_cost_str']);
  77. }
  78. }
  79. exit(json_encode($toplist));
  80. }
  81. ?>
  82. <script type="text/javascript" src="http://wsq.discuz.com/cdn/discuz/js/openjs.js"></script>
  83. <script>
  84. var menu = new Array();
  85. menu.push({name:"<?php echo lang('plugin/xj_event', 'changjia'); ?>", pluginid:'xj_event:wsq_my_event', param:"act=cj"});
  86. menu.push({name:"<?php echo lang('plugin/xj_event', 'zuzhi'); ?>", pluginid:'xj_event:wsq_my_event', param:"act=zz"});
  87. WSQ.initBtmBar(menu);
  88. WSQ.showBtmBar();
  89. WSQ.initPlugin({name:'<?php echo lang('plugin/xj_event', 'myevent'); ?>'});
  90. var initWx = {
  91. 'img': '<?php echo $_G['siteurl']; ?>/static/image/common/logo.png',
  92. 'desc': '<?php echo $_G['bbsname'].lang('plugin/xj_event', 'huodzx'); ?>',
  93. 'title': '<?php echo lang('plugin/xj_event', 'huodzx'); ?>',
  94. 'pluginid':'xj_event:wsq_event_center',
  95. 'param': 'a=1&b=2'
  96. };
  97. WSQ.initShareWx(initWx);
  98. </script>
  99. <script type="text/javascript" src="source/plugin/xj_event/js/jquery.js"></script>
  100. <script type="text/javascript">
  101. var i = 2;
  102. $(function(){
  103. $("#btnload").click(function(){
  104. $.getJSON("plugin.php?id=xj_event:wsq_my_event&act=<?php echo $_GET['act']; ?>&output=json",{page:i},function(json){
  105. if(json){
  106. var str = "";
  107. $.each(json,function(index,array){
  108. var str = '<div style="background-color:#FFFFFF;-moz-border-radius: 8px;-webkit-border-radius: 8px;border-radius:8px; padding:10px; margin-bottom:8px; border-bottom:2px #ddd solid;" onClick="window.open(\'http://wsq.discuz.com/?c=index&a=viewthread&f=wx&tid='+array['tid']+'&siteid=<?php echo $siteid; ?>&_bpage=1\',\'_parent\');"><div style="float:left; width:80px; height:80px; background-color:#ddd;"><img src="'+array['activityaid_url']+'" style="width:80px;height:80px;" border="0"></div><div style="margin-left:80px; padding:2px 10px; height:80px; line-height:26px; font-size:14px;">'+array['subject']+'</div><div style="clear:both;"></div><div style="height:30px;"><div style="float:left; width:120px; padding-top:12px;"><span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; ">'+array['postclass']+'</span><span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; margin-left:5px; ">'+array['zclass']+'</span></div><div style="margin-left:120px; padding:2px 10px; height:30px; line-height:30px; font-size:12px; text-align:right;"><?php echo lang('plugin/xj_event', 'baomingrs'); ?>: <span style="color:#FF3300; font-weight:bold;">'+array['applynumber']+'</span> <?php echo lang('plugin/xj_event', 'ren'); ?> <?php echo lang('plugin/xj_event', 'feiyong'); ?>:<span style="color:#FF3300; font-weight:bold;">'+array['use_cost_str']+'</span></div><div style="clear:both;"></div></div></div>';
  109. $("#mycontainer").append(str);
  110. });
  111. i++;
  112. }else{
  113. return false;
  114. }
  115. });
  116. });
  117. });
  118. </script>
  119. <style type="text/css">
  120. #container {margin:5px;}
  121. body {height:100%;}
  122. </style>
  123. </head>
  124. <body style="padding-top:10px;">
  125. <div id="mycontainer">
  126. <?php foreach($toplist as $value){ ?>
  127. <div style="background-color:#FFFFFF;-moz-border-radius: 8px;-webkit-border-radius: 8px;border-radius:8px; padding:10px; margin-bottom:8px; border-bottom:2px #ddd solid;" onClick="window.open('http://wsq.discuz.com/?c=index&a=viewthread&f=wx&tid=<?php echo $value['tid']; ?>&siteid=<?php echo $siteid; ?>&_bpage=1','_parent');">
  128. <div style="float:left; width:80px; height:80px; background-color:#ddd;">
  129. <img src="<?php echo $value['activityaid_url']; ?>" style="width:80px; height:80px;" border="0">
  130. </div>
  131. <div style="margin-left:80px; padding:2px 10px; height:80px; line-height:26px; font-size:14px;">
  132. <?php echo $value['subject']; ?>
  133. </div>
  134. <div style="clear:both;"></div>
  135. <div style="height:30px;">
  136. <div style="float:left; width:120px; padding-top:12px;">
  137. <span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; ">
  138. <?php
  139. if($value['postclass']==1){
  140. echo lang('plugin/xj_event', 'xianxia');
  141. }else{
  142. echo lang('plugin/xj_event', 'xianshan');
  143. }
  144. ?>
  145. </span>
  146. <span style=" padding:3px 8px; color:#fff; background-color:#799edc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius:3px; font-size:12px; margin-left:5px; ">
  147. <?php
  148. if($value['postclass']==1){
  149. echo $offlineclass[$value['offlineclass']];
  150. }else{
  151. echo $onlineclass[$value['onlineclass']];
  152. }
  153. ?>
  154. </span>
  155. </div>
  156. <div style="margin-left:120px; padding:2px 10px; height:30px; line-height:30px; font-size:12px; text-align:right;">
  157. <?php echo lang('plugin/xj_event', 'baomingrs'); ?>: <span style="color:#FF3300; font-weight:bold;"><?php echo $value['applynumber']; ?></span> <?php echo lang('plugin/xj_event', 'ren'); ?>
  158. <?php echo lang('plugin/xj_event', 'feiyong'); ?>:<span style="color:#FF3300; font-weight:bold;">
  159. <?php
  160. if($value['setting']['eventaa']){
  161. echo 'AA';
  162. }else{
  163. if($value['use_cost']>0){
  164. echo $value['use_cost'].lang('plugin/xj_event', 'yuan');
  165. }else{
  166. echo lang('plugin/xj_event', 'mianfei');
  167. }
  168. }
  169. ?></span>
  170. </div>
  171. </div>
  172. <div style="clear:both;"></div>
  173. </div>
  174. <?php } ?>
  175. </div>
  176. <div class="nodata"></div>
  177. <?php
  178. if(@ceil($listcount/$perpage) < $page) {
  179. ?>
  180. <div id="btnload" style="border:1px #ddd solid; background-color:#FFFFFF; height:40px; line-height:40px; font-size:14px; text-align:center; color:#666666; cursor:pointer; margin-bottom:30px;"><?php echo lang('plugin/xj_event', 'jzgdhd'); ?>...</div>
  181. <?php
  182. }
  183. ?>
  184. </body>
  185. </html>