fetchOne($sql); return $result; } /** * Function Description:获取某用户的某类红包当天领取总数 * Function Name: getCountByOpenidForToday * @param $openid * @param int $activity_id * * @return string * * @author 倪宗锋 */ public function getCountByOpenidForToday($openid, $activity_id = 1) { $sql = '' ."SELECT count(1) from activity_redpack where openid ='{$openid}' and create_time >= DATE_FORMAT(NOW(),'%Y-%m-%d') and create_time < DATE_FORMAT(DATE_ADD(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') and activity_id= {$activity_id} "; $result = $this->fetchOne($sql); return $result; } /** * Function Description: * Function Name: getTotalNum * @param $activity_id * * @return string * * @author 倪宗锋 */ public function getTotalNum($activity_id) { $sql = '' . "SELECT count(1) from activity_redpack where activity_id={$activity_id} "; $result = $this->fetchOne($sql); return $result; } }