| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | 
							- <?php
 
- namespace Cas\Dao;
 
- use KIF\Dao\DBAgileDev;
 
- use KIF\Core\Request;
 
- use KIF\Cache\Memcached;
 
- /**
 
-  *
 
-  * 活动用户参与日志
 
-  *
 
-  * @author lihuanchun@qq.com
 
-  *        
 
-  */
 
- class LotteryUserParticipateLog extends DBAgileDev {
 
- 	protected $tableName = 'lottery_user_participate_log';
 
- 	
 
- 	/**
 
- 	 * 数据库里的真实字段
 
- 	 * 
 
- 	 * @var array
 
- 	 */
 
- 	protected $other_field = array (
 
- 			'events_id',
 
- 			'uid',
 
- 			# 审核字段 1未审核 2审核通过 3审核不通过
 
- 			'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);
 
- 	}
 
- 	
 
- }
 
 
  |