12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace Cas\Dao;
- use KIF\Dao\DBAgileDev;
- use KIF\Core\Request;
- use KIF\Cache\Memcached;
- class LotteryUserParticipateLog extends DBAgileDev {
- protected $tableName = 'lottery_user_participate_log';
-
-
- protected $other_field = array (
- 'events_id',
- 'uid',
-
- 'audit',
- );
-
-
- public function findUserParticipateDataGroupByUid($eventsId,$limit=null){
-
- $sql = "SELECT uid,create_time FROM `{$this->tableName}` WHERE events_id={$eventsId} GROUP BY uid ";
- if($limit){
- $sql = "SELECT uid,create_time FROM `{$this->tableName}` WHERE events_id={$eventsId} GROUP BY uid limit {$limit} ";
- }
-
- $tmpResult = $this->db->fetchAll($sql);
- if (!$tmpResult) {
- return array();
- }
- return $tmpResult;
- }
-
-
- public function getUserParticipateLogNumGroupByUid($eventsId){
- $returnNum = 0;
- $sql = "SELECT count(uid) FROM `{$this->tableName}` WHERE events_id={$eventsId} GROUP BY uid ";
- $tmpResult = $this->db->fetchAll($sql);
- if (!$tmpResult) {
- return $returnNum;
- }
- return count($tmpResult);
- }
- public function getUserParticipateLogNumGroupByUidDate($eventsId, $start, $end){
- $returnNum = 0;
- $sql = "SELECT count(uid) FROM `{$this->tableName}` WHERE events_id={$eventsId} and create_time >= ".$start." and create_time <= ".$end." GROUP BY uid ";
- $tmpResult = $this->db->fetchAll($sql);
- if (!$tmpResult) {
- return $returnNum;
- }
- return count($tmpResult);
- }
-
- }
|