publish_statistics.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. namespace app\index;
  4. class publish_statistics extends BaseUser
  5. {
  6. function index()
  7. {
  8. $id = bees_decrypt(SafeRequest("id", "get"));
  9. $row = db('appid')->where('in_uid', $this->userid)->where('in_id', $id)->find();
  10. $row || exit(include_once dirname(__FILE__) . '/../pack/error/404.php');
  11. $sid = bees_encrypt($row['in_id']);
  12. $start_date = SafeRequest("start_date", "get");
  13. $end_date = SafeRequest("end_date", "get");
  14. $starttime = $start_date . ' 00:00:00';
  15. $endtime = $end_date . ' 23:59:59';
  16. $specified = '';
  17. if (!empty($start_date) && !empty($end_date)) {
  18. $specified = "addtime>'" . $starttime . "' and addtime<'" . $endtime . "' ";
  19. }
  20. $total = db('downhistory')->where($specified)->where('appid', $id)->where('uid', $this->userid)->count();
  21. $num = 10;
  22. $cpage = isset($_GET['page']) ? $_GET['page'] : 1;
  23. $pagenum = ceil($total / $num);
  24. $offset = ($cpage - 1) * $num;
  25. $result = db('downhistory')->where($specified)->where('appid', $id)->where('uid', $this->userid)->order('addtime desc')->limit($offset, $num)->select();
  26. $start = $offset + 1;
  27. $end = $cpage == $pagenum ? $total : $cpage * $num;
  28. $next = $cpage == $pagenum ? 0 : $cpage + 1;
  29. $prev = $cpage == 1 ? 0 : $cpage - 1;
  30. ?>
  31. <!DOCTYPE html>
  32. <html lang="">
  33. <head>
  34. <meta charset="utf-8">
  35. <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
  36. <meta name="keywords" content="<?php echo IN_KEYWORDS;?>" />
  37. <meta name="description" content="<?php echo IN_DESCRIPTION;?>" />
  38. <title>
  39. <?php echo $row['in_name'];?>应用详情 -
  40. <?php echo IN_NAME;?>
  41. </title>
  42. <?php
  43. $this->static_();
  44. ?>
  45. <link rel="stylesheet" href="/css/jcq.css">
  46. <style>
  47. </style>
  48. </head>
  49. <body>
  50. <?php
  51. $this->header();
  52. ?>
  53. <link rel="stylesheet" href="/static/pack/font-awesome-4.7.0/css/font-awesome.css" />
  54. <link rel="stylesheet" type="text/css" href="/static/index/css/jquery.datetimepicker.css?20190530" />
  55. <script src="/static/index/js/jquery.datetimepicker.js?20190530"></script>
  56. <script src="/static/index/js/bootstrap-paginator.js"></script>
  57. <div class="release-app-wrap">
  58. <div class="container">
  59. <div class="release-app2">
  60. <div class="crumbs">
  61. <a href="/index/apps/apps">我的应用</a>
  62. <span>/</span>
  63. <a href="/index/apps/apps">应用列表</a>
  64. <span>/</span>
  65. <?php echo $row['in_name'];?>
  66. </div>
  67. <div class="row clearfix">
  68. <?php
  69. $this->publish_app_list();
  70. ?>
  71. <div class="col-sm-10">
  72. <div class="aside-right ">
  73. <div class="app-details app-details2">
  74. <?php
  75. $this->publish_top($row);
  76. ?>
  77. <hr>
  78. <div class="download-details" style="padding: 0 20px;">
  79. <div class="d-top clearfix" style="margin-top: 10px;">
  80. <div class="date date1 fl" style="position: relative; ">
  81. <input class="form-control" type="text" id="datetimepicker1" value="<?php
  82. if (empty($start_date)) {
  83. ?><?php echo date(" Y/m/d", strtotime(date("Y/m/d") . '-1 week' ));?>
  84. <?php
  85. } else {
  86. ?>
  87. <?php echo $start_date;?>
  88. <?php
  89. }
  90. ?>">
  91. <span class="iconfont icon-date" style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%);"></span>
  92. </div>
  93. <div class="fl line">
  94. _
  95. </div>
  96. <div class="date date2 fl" style="position: relative;">
  97. <input class="form-control" type="text" id="datetimepicker2" value="<?php
  98. if (empty($end_date)) {
  99. ?><?php echo date(" Y/m/d");?>
  100. <?php
  101. } else {
  102. ?>
  103. <?php echo $end_date;?>
  104. <?php
  105. }
  106. ?>">
  107. <span class="iconfont icon-date" style="position: absolute; right: 10px; top: 50%; transform: translateY(-50%);"></span>
  108. </div>
  109. <button type="button" class="ms-btn ms-btn-secondary fl query" style="margin-left: 10px;">查询</button>
  110. <span class="fl num" style="margin-left: 10px; line-height: 34px;">累计总下载 <i>
  111. <?php echo $row['in_downloads'];?>
  112. </i> 次</span>
  113. <button type="button" class="ms-btn ms-btn-secondary fr cleanUp"
  114. data-app-id="<?php echo bees_encrypt($row['in_id']);?>">清空统计数据
  115. </button>
  116. </div>
  117. <div class="table-responsive" style="margin-top: 10px;">
  118. <table class="table app-table">
  119. <tr>
  120. <th>时间</th>
  121. <th>应用名称</th>
  122. <th>版本</th>
  123. <th>大小</th>
  124. <th>浏览次数</th>
  125. <th>下载次数</th>
  126. </tr>
  127. <?php
  128. foreach ($result as $key => $value) {
  129. ?>
  130. <tr>
  131. <td><?php echo $value['addtime'];?></td>
  132. <td><?php echo $value['appname'];?></td>
  133. <td><?php echo $value['appversion'];?></td>
  134. <td><?php echo formatsize($value['appsize']);?></td>
  135. <td><?php echo $value['liulan'];?></td>
  136. <td><?php echo $value['down'];?></td>
  137. </tr>
  138. <?php
  139. }
  140. ?>
  141. </table>
  142. <?php
  143. if ($total == 0) {
  144. ?>
  145. <div class="text-center no-content">
  146. <img src="/static/index/image/invoice-1.png" alt="">
  147. <p class="color-333 mt10">
  148. 暂无任何数据
  149. </p>
  150. </div>
  151. <?php
  152. }
  153. ?>
  154. </div>
  155. <?php
  156. if ($pagenum != 1) {
  157. ?>
  158. <?php
  159. if ($total !== 0) {
  160. ?>
  161. <?php
  162. if (empty($start_date)) {
  163. ?>
  164. <div style="text-align: center">
  165. <ul id="pager" class="pagination">
  166. <li><a>共<b>
  167. <?php echo $total;?>
  168. </b>条记录</b>
  169. <?php echo $cpage;?>/
  170. <?php echo $pagenum;?>
  171. </a></li>
  172. <?php
  173. if ($cpage == 1) {
  174. ?>
  175. <li class='active'><a>首页</a></li>
  176. <?php
  177. } else {
  178. ?>
  179. <li><a href='?page=1&id=<?php echo $sid;?>'>首页</a></li>
  180. <?php
  181. }
  182. if ($prev) {
  183. ?>
  184. <li><a href='?page=<?php echo $prev;?>&id=<?php echo $sid;?>'>上一页</a></li>
  185. <?php
  186. } else {
  187. }
  188. if ($next) {
  189. ?>
  190. <li><a href='?page=<?php echo $next;?>&id=<?php echo $sid;?>'>下一页</a></li>
  191. <?php
  192. } else {
  193. }
  194. if ($cpage == $pagenum) {
  195. ?>
  196. <li class='active'><a>尾页</a></li>
  197. <?php
  198. } else {
  199. ?>
  200. <li><a href='?page=<?php echo $pagenum;?>&id=<?php echo $sid;?>'>尾页</a></li>
  201. <?php
  202. }
  203. ?>
  204. </ul>
  205. </div>
  206. <?php
  207. } else {
  208. ?>
  209. <div style="text-align: center">
  210. <ul id="pager" class="pagination">
  211. <li><a>共<b>
  212. <?php echo $total;?>
  213. </b>条记录</b>
  214. <?php echo $cpage;?>/
  215. <?php echo $pagenum;?>
  216. </a></li>
  217. <?php
  218. if ($cpage == 1) {
  219. ?>
  220. <li class='active'><a>首页</a></li>
  221. <?php
  222. } else {
  223. ?>
  224. <li><a
  225. href='?page=1&id=<?php echo $sid;?>&start_date=<?php echo $start_date;?>&end_date=<?php echo $end_date;?>'>首页</a>
  226. </li>
  227. <?php
  228. }
  229. if ($prev) {
  230. ?>
  231. <li><a
  232. href='?page=<?php echo $prev;?>&id=<?php echo $sid;?>&start_date=<?php echo $start_date;?>&end_date=<?php echo $end_date;?>'>上一页</a>
  233. </li>
  234. <?php
  235. } else {
  236. }
  237. if ($next) {
  238. ?>
  239. <li><a
  240. href='?page=<?php echo $next;?>&id=<?php echo $sid;?>&start_date=<?php echo $start_date;?>&end_date=<?php echo $end_date;?>'>下一页</a>
  241. </li>
  242. <?php
  243. } else {
  244. }
  245. if ($cpage == $pagenum) {
  246. ?>
  247. <li class='active'><a>尾页</a></li>
  248. <?php
  249. } else {
  250. ?>
  251. <li><a
  252. href='?page=<?php echo $pagenum;?>&id=<?php echo $sid;?>&start_date=<?php echo $start_date;?>&end_date=<?php echo $end_date;?>'>尾页</a>
  253. </li>
  254. <?php
  255. }
  256. ?>
  257. </ul>
  258. </div>
  259. <?php
  260. }
  261. ?>
  262. <?php
  263. }
  264. ?>
  265. <?php
  266. }
  267. ?>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. <?php
  277. $this->inc_merge();
  278. ?>
  279. <script>
  280. $(function () {
  281. $(".download-details div:first").on('click', '.query', function () {
  282. var start_date = $(this).parent().find("input:first").val();
  283. var end_date = $(this).parent().find("input:last").val();
  284. window.location.href = "/index/publish_statistics?id=<?php echo bees_encrypt($row['in_id']);?>&start_date=" + start_date + "&end_date=" + end_date + "&page=1";
  285. });
  286. $(".download-details div:first").on('click', '.cleanUp', function () {
  287. var appId = $(this).data('app-id');
  288. alert('确认清空统计数据吗?', function () {
  289. $.post('/index/ajax_profile/cleanStatistics', { appId: appId }, function (data) {
  290. if (data.code == 200) {
  291. window.location.reload();
  292. } else {
  293. alert(data.msg);
  294. }
  295. }, 'json')
  296. }, function () {
  297. }, 'center', '确定', '取消');
  298. });
  299. })
  300. </script>
  301. <?php
  302. $this->footer();
  303. ?>
  304. </body>
  305. </html>
  306. <?php
  307. }
  308. }