diff --git a/application/controllers/statistics.php b/application/controllers/statistics.php new file mode 100644 index 00000000..5f512d1b --- /dev/null +++ b/application/controllers/statistics.php @@ -0,0 +1,40 @@ +permission->is_admin(); + $this->load->model('Chinese_history_model'); + } + + public function Chinese_history_log() + { + $data['log_action'] = $this->input->post('log_action') ? $this->input->post('log_action') : 0; + $data['start_date'] = $this->input->post('start_date') ? $this->input->post('start_date') : date('Y-m-01'); + $data['end_date'] = $this->input->post('end_date') ? $this->input->post('end_date') : date('Y-m-d',strtotime('+1 day')); + $order = $this->input->post('order') ? $this->input->post('order') : 'Created_On'; + $order_field = " ORDER BY ".$order." DESC "; + + $data['ret'] = $this->Chinese_history_model->get_log($data['log_action'],$data['start_date'],$data['end_date']); + foreach ($data['ret'] as $key => &$value) { + $value->action_text = $this->Chinese_history_log_type()[$value->LOG_Action]; + } + $this->load->view('statistics/Chinese_history_log',$data); + } + public function Chinese_history_log_type() + { + return array( + 0 => '', + 1 => '进了封面的图片进入测试', + 2 => '完成了前3题', + 3 => '完成了10题拿到成绩单', + 4 => '点击了try again!' + ); + } + + +} diff --git a/application/models/chinese_history_model.php b/application/models/chinese_history_model.php new file mode 100644 index 00000000..97b18e42 --- /dev/null +++ b/application/models/chinese_history_model.php @@ -0,0 +1,35 @@ +INFO = $this->load->database('INFO', TRUE); + } + + /** + * [LOG_Action] + * 1; // 进了封面的图片进入测试 + * 2; // 完成了前3题 + * 3; // 完成了10题拿到成绩单 + * 4; // 点击了try again + */ + + function get_log($log_action = '0',$start_date = null,$end_date = null,$order_field = null) + { + $sql = "SELECT COUNT(1) ret,LOG_Action FROM ChineseHistoryLog WHERE 1=1 "; + if ($log_action != '0') { + $sql .= " AND LOG_Action=" . $this->INFO->escape($log_action); + } + if ($start_date !== null) { + $sql .= " AND Created_On BETWEEN " . $this->INFO->escape($start_date) ." AND ". $this->INFO->escape($end_date); + } + if ($order_field !== null) { + $sql .= $order_field; + } + $sql .= " GROUP BY LOG_Action "; + $query = $this->INFO->query($sql); + return $query->result(); + } + +} diff --git a/application/views/statistics/chinese_history_log.php b/application/views/statistics/chinese_history_log.php new file mode 100644 index 00000000..5a7edd4d --- /dev/null +++ b/application/views/statistics/chinese_history_log.php @@ -0,0 +1,81 @@ + + + +
+ +类别 | +人数 | + +
---|---|
action_text);?> | +ret);?> | +