You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/third_party/public/controllers/infopayauthor.php

72 lines
2.8 KiB
PHP

<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Infopayauthor extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Payauthor_model');
}
public function index()
{
$start_date=$this->input->post('start_date')?date('Y-m-d 00:00:00',strtotime($this->input->post('start_date'))):date('Y-m-d 00:00:00',(time()-7*24*60*60));
$end_date=$this->input->post('end_date')?date('Y-m-d 23:59:59',strtotime($this->input->post('end_date'))):date('Y-m-d 23:59:59');
$data['start_date']=$start_date;
$data['end_date']=$end_date;
$data['ic_url']=$this->input->post('ic_url')?$this->input->post('ic_url'):'';
$data['author']=$this->input->post('author')?$this->input->post('author'):'';
//全站被打赏次数,及打赏总额,每个等级打赏次数
$data['site_rewards']=$this->Payauthor_model->get_rewards(0,$start_date,$end_date,$data['ic_url'],$data['author']);
//每个页面被打赏的次数,及打赏总额,每个等级打赏次数
$data['page_rewards']=$this->Payauthor_model->get_rewards(1,$start_date,$end_date,$data['ic_url'],$data['author']);
//作者获得的打赏次数,及打赏总额,,每个等级打赏次数
$data['author_rewards']=$this->Payauthor_model->get_rewards(2,$start_date,$end_date,$data['ic_url'],$data['author']);
//页面获赏情况
$arr=array();
$arr_temp=array();
foreach ($data['page_rewards'] as $key => $p) {
if (in_array($p->ipa_ic_url, $arr_temp)) {
$tep_key=array_search($p->ipa_ic_url, $arr_temp);
$arr[$tep_key][]=$p;
}else{
$arr_temp[$key]=$p->ipa_ic_url;
$arr[$key][]=$p;
}
}
$data['page_rewards']=$arr;
$p_count_arr=array();
foreach ($arr as $key => $value) {
$p_count_arr[$key]=count($value);
}
arsort($p_count_arr);
$data['p_count_arr']=$p_count_arr;
//作者获赏情况,及排序
$author_rewards=array();
$a_totalcount=array();
foreach ($data['author_rewards'] as $a) {
$author_rewards[$a->ipa_ic_author][]=$a;
isset($a_totalcount[$a->ipa_ic_author])?$a_totalcount[$a->ipa_ic_author]+=$a->total_pay_count:$a_totalcount[$a->ipa_ic_author]=$a->total_pay_count;
}
arsort($a_totalcount);
$data['a_count_arr']=$a_totalcount;
$data['author_rewards']=$author_rewards;
//作者列表
$this->load->model('Operator_model');
$data['editor_list'] = $this->Operator_model->get_site_user('CHT');
$this->load->view('bootstrap3/header', $data);
$this->load->view('infopayauthor');
$this->load->view('bootstrap3/footer');
}
}