CourseCountModel.class.php
1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Created by PhpStorm.
* User: liyifei2012it
* Date: 17/10/18
* Time: 14:39
*/
namespace Common\Model;
class CourseCountModel extends \Com\Model
{
// 构造方法
public function __construct()
{
parent::__construct('Count', 'oa_course_');
}
/**
* 获取前一天统计的所有课程可学人员总数、完成人员总数
* @author liyifei
* @return array
*/
public function listTotal()
{
$wheres = [];
$params = [];
// 企业标记
$wheres[] = "`{$this->prefield}domain`=?";
$params[] = QY_DOMAIN;
// 状态条件
$wheres[] = "`{$this->prefield}status`<?";
$params[] = $this->get_st_delete();
$wheres_sql = implode(' AND ', $wheres);
$sql = "SELECT * FROM
(
SELECT `count_id`, `article_id`, `user_total`, `complete_total`, `created`
FROM __TABLE__ WHERE {$wheres_sql}
ORDER BY `created` DESC
) as res_tab
GROUP BY article_id;";
return $this->_m->fetch_array($sql, $params);
}
}