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; } }