ActiveModel.class.php 1.03 KB
<?php
/**
 * Created by PhpStorm.
 * User: liyifei2012it
 * Date: 17/5/18
 * Time: 11:35
 */
namespace Common\Model;

class ActiveModel extends AbstractModel
{

    // 构造方法
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 获取每天活跃人数数据
     * @author zhonglei
     * @param array $conds 条件
     * @return array
     */
    public function listActiveData($conds)
    {
        $wheres = [];
        $params = [];

        if (is_array($conds) && !empty($conds)) {
            $this->_parse_where($wheres, $params, $conds);
        }

        // 企业标记
        $wheres[] = "`{$this->prefield}domain`=?";
        $params[] = QY_DOMAIN;
        // 状态条件
        $wheres[] = "`{$this->prefield}status`<?";
        $params[] = $this->get_st_delete();

        $wheres_sql = implode(' AND ', $wheres);
        $sql = "SELECT *, COUNT(DISTINCT `uid`) `total` FROM __TABLE__ WHERE {$wheres_sql} GROUP BY `active_date`";

        return $this->_m->fetch_array($sql, $params);
    }
}