| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | 
							- <?php
 
- namespace Cas\Dao;
 
- use KIF\Dao\DBAgileDev;
 
- use KIF\Core\Request;
 
- /**
 
-  * 
 
-  * 活动[用户收集字母信息]
 
-  *   
 
-  * @author lihuanchun@qq.com
 
-  *
 
-  */
 
- class LotteryEventsUserLetters extends DBAgileDev {
 
- 	protected $tableName = 'lottery_events_user_letters';
 
- 	
 
- 	/**
 
- 	 * 数据库里的真实字段
 
- 	 * @var array
 
- 	 */
 
- 	protected $other_field = array(
 
- 		'events_id',
 
- 		'uid',
 
- 		
 
- 	);
 
- 	
 
- 	
 
- 	/**
 
- 	 * 获取一个用户的收集信息
 
- 	 */
 
- 	public function getOneUserData($events_id,$uid){
 
- 		$condition = array(
 
- 				'events_id' => $events_id,
 
- 				'uid' => $uid,
 
- 		);
 
- 		$ids  = $this-> findIdsBy($condition);
 
- 		$data = $this-> gets($ids);
 
- 		return  array_shift($data);
 
- 	}
 
- 	
 
- 	
 
- 	
 
- 	/**
 
- 	 * 添加一个提字母
 
- 	 * array(
 
- 	 *   'events_id' => 
 
- 	 *   'uid' => 
 
- 	 *   'ABC_data' => letters_id
 
- 	 * )
 
- 	 */
 
- 	public function addLetters($info){
 
- 		$condition = array(
 
- 			'events_id' => $info['events_id'],
 
- 			'uid' => $info['uid'],
 
- 		);
 
- 		$ids  = $this-> findIdsBy($condition);
 
- 		$data = $this-> gets($ids);
 
- 		$data = array_shift($data);
 
- 		if(empty($data)){
 
- 			$ABC_data = $info['ABC_data'];
 
- 			$info['ABC_data'] =  array($ABC_data => $ABC_data);
 
- 			return $this->add($info);
 
- 		}else{
 
- 			$data['ABC_data'][$info['ABC_data']] = $info['ABC_data'];
 
- 			$new_info = array(
 
- 				'ABC_data' => $data['ABC_data'],
 
- 			);
 
- 			return $this->modify($new_info,array('id' => $data['id']));
 
- 		}
 
- 	}
 
- 	
 
- 	
 
- 	
 
- 	
 
- }
 
 
  |