123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- // 获取应用ID
- $id = bees_decrypt(SafeRequest("id", "get"));
- $row = db('appid')->where('in_uid', $this->userid)->where('in_id', $id)->find();
- // 获取日期参数
- $start_date = SafeRequest("start_date", "get");
- $end_date = SafeRequest("end_date", "get");
- $starttime = $start_date . ' 00:00:00';
- $endtime = $end_date . ' 23:59:59';
- $specified = '';
- if (!empty($start_date) && !empty($end_date)) {
- $specified = "addtime>'" . $starttime . "' and addtime<'" . $endtime . "' ";
- }
- // 查询下载记录 - 使用 paginate 方法
- $page = SafeRequest("page", "get");
- $result = db('downhistory')->where($specified)->where('appid', $id)->where('uid', $this->userid)->order('addtime desc')->paginate(["page" => $page, 'list_rows' => 5]);
- $render = $result->render();
- $count = $result->total();
- $sid = bees_encrypt($row['in_id']);
- ?>
- <div class="download-details">
- <div class="d-top clearfix">
- <div class="date date1">
- <input class="form-control" type="text" id="datetimepicker1" value="<?php if (empty($start_date)) { echo date("Y/m/d", strtotime(date("Y/m/d") . '-1 week')); } else { echo $start_date; } ?>">
- <span class="iconfont icon-date"></span>
- </div>
- <div class="fl line">
- _
- </div>
- <div class="date date2">
- <input class="form-control" type="text" id="datetimepicker2" value="<?php if (empty($end_date)) { echo date("Y/m/d"); } else { echo $end_date; } ?>">
- <span class="iconfont icon-date"></span>
- </div>
- <button type="button" class="ms-btn ms-btn-secondary fl query">查询</button>
- <span class="fl num">累计总下载 <i>
- <?php echo $row['in_downloads'];?>
- </i> 次</span>
- <button type="button" class="ms-btn ms-btn-secondary fr cleanUp"
- data-app-id="<?php echo bees_encrypt($row['in_id']);?>">清空统计数据
- </button>
- </div>
- <div class="table-responsive">
- <table class="table">
- <tbody>
- <tr>
- <th>时间</th>
- <th>应用名称</th>
- <th>版本</th>
- <th>大小</th>
- <th>浏览次数</th>
- <th>下载次数</th>
- </tr>
- <?php
- foreach ($result as $key => $value) {
- ?>
- <tr>
- <td><?php echo $value['addtime'];?></td>
- <td><?php echo $value['appname'];?></td>
- <td><?php echo $value['appversion'];?></td>
- <td><?php echo formatsize($value['appsize']);?></td>
- <td><?php echo $value['liulan'];?></td>
- <td><?php echo $value['down'];?></td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- <tfoot>
- <tr>
- <td colspan="6"><?php echo getRender($result, $page); ?></td>
- </tr>
- </tfoot>
- </table>
- <?php
- if ($count == 0) {
- ?>
- <div class="text-center no-content">
- <img src="/static/index/image/invoice-1.png" alt="">
- <p class="color-333 mt10">
- 暂无任何数据
- </p>
- </div>
- <?php
- }
- ?>
- </div>
- </div>
- <script>
- $(function () {
- // 初始化日期选择器
- $('#datetimepicker1, #datetimepicker2').datetimepicker({
- format: 'Y/m/d',
- timepicker: false,
- datepicker: true
- });
-
- // 查询按钮点击事件
- $(".download-details div:first").on('click', '.query', function () {
- var start_date = $(this).parent().find("input:first").val();
- var end_date = $(this).parent().find("input:last").val();
- window.location.href = "/index/publish_detail?id=<?php echo bees_encrypt($row['in_id']);?>&tab=download&start_date=" + start_date + "&end_date=" + end_date + "&page=1";
- });
-
- // 清空统计数据按钮点击事件
- $(".download-details div:first").on('click', '.cleanUp', function () {
- var appId = $(this).data('app-id');
- alert('确认清空统计数据吗?', function () {
- $.post('/index/ajax_profile/cleanStatistics', { appId: appId }, function (data) {
- if (data.code == 200) {
- window.location.reload();
- } else {
- alert(data.msg);
- }
- }, 'json')
- }, function () {
- }, 'center', '确定', '取消');
- });
- });
- </script>
|