<link type="text/css" rel="stylesheet" href="/js/lyydate/skins/default/laydate.css?v=20150825" id="LayDateSkin">
<div class="container">
<div class="col-xs-24 btn-lg"></div>
<div class="row">
  <div class="col-md-24">
    <h3>打赏统计管理后台</h3>
    <div class="col-xs-24 btn-lg"></div>
    <div class="col-xs-24" style="background:#f0f0f0;padding:15px;">
    <form method="post" action="<?php echo site_url('thirdparty/public/infopayauthor/index'); ?>">
      <div class="col-sm-4 nopadding">
        <select class="form-control" name="author">
          <option value="">所有作者</option>
          <?php $author_list=array(); foreach ($editor_list as $editor_item) { $author_list[mb_strtoupper($editor_item->OPI_Code)]=$editor_item->OPI_Name; ?>
            <option <?php if($author==$editor_item->OPI_Code) echo 'selected'; ?> value="<?php echo $editor_item->OPI_Code; ?>" ><?php echo $editor_item->OPI_Name; ?></option>
          <?php } ?>  
        </select>
      </div>
      <div class="col-sm-4 nopadding"><input class="form-control date" style="background:#fff; cursor: pointer;" name="start_date" placeholder="start date" value="<?php echo $start_date; ?>" readonly></div>
      <div class="col-sm-4 nopadding"><input class="form-control date" style="background:#fff; cursor: pointer;" name="end_date" placeholder="end date"  value="<?php echo $end_date; ?>" readonly></div>
      <div class="col-sm-10 nopadding"><input class="form-control" name="ic_url" value="<?php echo $ic_url; ?>" placeholder="url"></div>
      <div class="col-sm-2 nopadding"><button type="submit" class="btn btn-primary btn-block">搜索</button></div>
    </form>
    <?php $total_count=0;$total_money=0; foreach ($site_rewards as $s) { ?>
       <?php $total_count+=$s->total_pay_count; ?>
       <?php $total_money+=$s->total_money; ?>
    <?php } ?>
    <p class="col-xs-24"></p>
    <p class="text-muted">
      共有<strong><?php echo count($page_rewards);?></strong>个页面被打赏； 
      获得<strong><?php echo $total_money; ?>美元</strong>，
      共被打赏<strong><?php echo $total_count; ?></strong>次，
      其中
      <?php foreach ($site_rewards as $s) { ?>
        <?php echo $s->ipa_pay; ?>美元
        <strong><?php echo $s->total_pay_count; ?></strong>次，
      <?php } ?>
      被打赏的页面如下：
    </p>    
  </div>

    <div class="col-xs-24 btn-lg"></div>
    <div class="col-xs-24 btn-lg"></div>
        <h3>作者打赏统计情况</h3>
    <table class="table table-striped">
      <tr>
        <th width="25%">作者</th>
        <th width="25%">打赏次数</th>
        <th width="12.5%">打赏总次数</th>
        <th width="25%">打赏金额</th>
        <th width="12.5%">打赏总金额</th>
      </tr>
      <?php //foreach ($author_rewards as $key => $p) {$p_totalcount=$p_totalmoney=0; ?>
      <?php foreach ($a_count_arr as $a_code => $value) { $p=$author_rewards[$a_code];$p_totalcount=$p_totalmoney=0; ?>
      <tr>
        <td style="vertical-align: middle !important;"><?php $author_code=strtoupper($p[0]->ipa_ic_author); echo isset($author_list[$author_code])?$author_list[$author_code]:$p[0]->ipa_ic_author; ?></td>
        <td>
          <?php foreach ($p as $pdata) { ?>
            <?php echo $pdata->ipa_pay; ?>美元-
            <?php echo $pdata->total_pay_count.'次；';$p_totalcount+=$pdata->total_pay_count; ?>
          <?php } ?>
        </td>
        <td><?php echo $p_totalcount; ?></td>
        <td>
          <?php foreach ($p as $pdata) { ?>
            <?php echo $pdata->ipa_pay; ?>美元-
            <?php echo '$'.$pdata->total_money.'；';$p_totalmoney+=$pdata->total_money; ?>
          <?php } ?>
        </td>
        <td><?php echo $p_totalmoney; ?></td>
      </tr>
      <?php } ?>
    </table>
           
    <div class="col-xs-24 btn-lg"></div>
    <h3>全站打赏统计情况</h3>
    <div class="col-xs-24 btn-lg"></div>
    <table class="table table-striped">
      <tr>
        <th width="25%">页面URL</th>
        <th width="25%">打赏次数</th>
        <th width="12.5%">打赏总次数</th>
        <th width="25%">打赏金额</th>
        <th width="12.5%">打赏总金额</th>
      </tr>
      <?php //foreach ($page_rewards as $key => $p) {$p_totalcount=$p_totalmoney=0; ?>
      <?php foreach ($p_count_arr as $key => $v) {$p=$page_rewards[$key]; $p_totalcount=$p_totalmoney=0;?>
      <tr>
        <td  style="vertical-align: middle !important;" >
          <a target="_blank" href="http://www.chinahighlights.com<?php echo $p[0]->ipa_ic_url; ?>"><?php echo get_text_short($p[0]->ipa_ic_url,15,'...',true); ?></a>
        </td>
        <td>
          <?php foreach ($p as $pdata) { ?>
            <?php echo $pdata->ipa_pay; ?>美元-
            <?php echo $pdata->total_pay_count.'次；';$p_totalcount+=$pdata->total_pay_count; ?>
          <?php } ?>
        </td>
        <td><?php echo $p_totalcount; ?></td>
        <td>
          <?php foreach ($p as $pdata) { ?>
            <?php echo $pdata->ipa_pay; ?>美元-
            <?php echo '$'.$pdata->total_money.'；';$p_totalmoney+=$pdata->total_money; ?>
          <?php } ?>
        </td>
        <td><?php echo $p_totalmoney; ?></td>
      </tr>
      <?php } ?>
      </table> 
</div>
</div>
</div>

<script src="/js/lyydate/jquery.lyydate.min.js?v=20150825"></script>
<script type="text/javascript">
$('.date').lyydatepicker({
    format:"yyyy-mm-dd",
    language:"zh",
    max_width:"350",
    festival:true
});
</script>