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.
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if (!defined('BASEPATH'))
|
|
|
|
|
exit('No direct script access allowed');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Payauthor_model extends CI_Model {
|
|
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function get_rewards($search_type,$start_date,$end_date,$url='',$author='')
|
|
|
|
|
{
|
|
|
|
|
$map=$url==''?'':" AND ipa_ic_url like '%$url%' ";
|
|
|
|
|
$map.=$author==''?'':" AND ipa_ic_author='$author' ";
|
|
|
|
|
$sql0="SELECT ipa_pay,COUNT(0) as total_pay_count,sum(ipa_pay) as total_money from infopayauthor where ipa_addtime between '$start_date' and '$end_date' $map group by ipa_pay";
|
|
|
|
|
$sql1="SELECT ipa_ic_url,ipa_pay,COUNT(0) as total_pay_count,sum(ipa_pay) as total_money from infopayauthor where ipa_addtime between '$start_date' and '$end_date' $map group by ipa_ic_url,ipa_pay";
|
|
|
|
|
$sql2="SELECT ipa_ic_author,ipa_pay,COUNT(0) as total_pay_count,sum(ipa_pay) as total_money from infopayauthor where ipa_addtime between '$start_date' and '$end_date' $map group by ipa_ic_author,ipa_pay";
|
|
|
|
|
$sql_array=array(0=>$sql0,1=>$sql1,2=>$sql2);
|
|
|
|
|
$query = $this->HT->query($sql_array[$search_type]);
|
|
|
|
|
$result = $query->result();
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
}
|