From 6c31fb20bf590c5f6ae975bb9708b76aa892be4a Mon Sep 17 00:00:00 2001 From: lyt Date: Mon, 7 Aug 2017 13:43:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E4=BA=92=E5=8A=A8=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/statistics.php | 40 ++++++++ application/models/chinese_history_model.php | 36 +++++++ .../views/statistics/chinese_history_log.php | 98 +++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 application/controllers/statistics.php create mode 100644 application/models/chinese_history_model.php create mode 100644 application/views/statistics/chinese_history_log.php 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..c4f24923 --- /dev/null +++ b/application/models/chinese_history_model.php @@ -0,0 +1,36 @@ +HT = $this->load->database('HT', TRUE); + $this->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..8e17767b --- /dev/null +++ b/application/views/statistics/chinese_history_log.php @@ -0,0 +1,98 @@ + + + + + + 信息平台 + + + + + + + + +
+
+
+
+ + +
+
+ + 至 + +
+ +
+
+
+ + + + + + + + + + $it) { ?> + + + + + + +
类别人数
action_text);?>ret);?>
+
+
+ + + +