function getRewardByTids($tids) { if (!S::isArray($tids)) { return false; } $query = $this->_db->query(pwQuery::selectClause($this->_tableName, "{$this->_primaryKey} IN (:{$this->_primaryKey})", array($tids))); return $this->_getAllResultFromQuery($query, 'tid'); }
/** * 统计所有套餐数量 * @return int */ function countSpreads() { $total = $this->_db->get_value(pwQuery::selectClause($this->_tableName, '', array(), array(PW_EXPR => array('COUNT(*) AS total')))); return $total; }
/** * 根据fid批量统计已被购买的孔明灯数量 * @param array $fids * @return array */ function countUsedKmdNumsByFids($fids) { if (!S::isArray($fids)) { return false; } $query = $this->_db->query(pwQuery::selectClause($this->_tableName, 'fid IN(:fid) AND uid!=:uid', array($fids, 0), array(PW_COLUMN => array('fid'), PW_EXPR => array('COUNT(fid) AS total'), PW_GROUPBY => array('fid')))); return $this->_getAllResultFromQuery($query, 'fid'); }
/** * 根据uid统计记录数量 * @param int $uid * @return int */ function countPayLogsByUid($uid) { $uid = intval($uid); if ($uid < 1) { return false; } $total = $this->_db->get_value(pwQuery::selectClause($this->_tableName, '', array(), array(PW_EXPR => array('COUNT(*) AS total')))); return $total; }
function countRecordsByTidAndUid($tid, $uid) { list($tid, $uid) = array(intval($tid), intval($uid)); if ($tid < 1 || $uid < 1) { return false; } $query = $this->_db->query(pwQuery::selectClause($this->_tableName, "tid=:tid AND uid=:uid", array($tid, $uid), array(PW_EXPR => array('COUNT(*) AS total')))); $result = $this->_db->fetch_array($query); return $result['total']; }