tpl = 'member'; } /** * 我的首页 */ public function doMy() { # 获取当前用户的信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); $thisTime = time(); # 获取登录地址 $url = Request::g('url'); $thisUrl = Request::schemeDomain().'/member/my'; $loginUrl = $this -> getLoginUrl($thisUrl); $this->setOutput('loginUrl', $loginUrl); # 判断是否需要登录 $ckLogin = $this->ckLogin(); $this->setOutput('ckLogin', $ckLogin); # 获取我的助力值 $condition = array ( //'events_id' => $events_id, 'uid' => $uid, ); $objLotteryUserHelp = new LotteryUserHelp(); $info = $objLotteryUserHelp->fetchAll ( $condition, 10000, 'id desc' ); $num = 0; if ($info) { foreach ($info as $k => $v) { $num += $v['num']; } } $this->tpl = 'my'; $this->setOutput('thisTime', $thisTime); $this->setOutput('title', '我的'); $this->setOutput('num', $num); $this->setOutput('action', 'gift'); $this->setOutput('display', 1); $this->setOutput('notShowWeixinShare', true); } /** * 资料设置 */ public function doSet() { # 获取当前用户的信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); $thisTime = time(); # 获取登录地址 $url = Request::g('url'); $thisUrl = Request::schemeDomain().'/member/set'; $loginUrl = $this -> getLoginUrl($thisUrl); $this->setOutput('loginUrl', $loginUrl); # 判断是否需要登录 $ckLogin = $this->ckLogin(); $this->setOutput('ckLogin', $ckLogin); # 获取用户最新收货地址 $objDLotteryUserExpress = new LotteryUserExpress(); $userExpress = $objDLotteryUserExpress -> getUserExpress($uid); # 获取我的资料 $this->tpl = 'my_set'; $this->setOutput('thisTime', $thisTime); $this->setOutput('title', '我的资料'); $this->setOutput('my', $userExpress); $this->setOutput('action', 'gift'); $this->setOutput('display', 1); $this->setOutput('notShowWeixinShare', true); } /** * 我参与的活动 */ public function doAct() { # 获取当前用户的信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); $thisTime = time(); # 获取登录地址 $url = Request::g('url'); $thisUrl = Request::schemeDomain().'/member/act'; $loginUrl = $this -> getLoginUrl($thisUrl); $this->setOutput('loginUrl', $loginUrl); # 判断是否需要登录 $ckLogin = $this->ckLogin(); $this->setOutput('ckLogin', $ckLogin); $plat_form_id = $this->getPlatFormId(); $objLottery = new Lottery(); # 根据uid,得到参与的活动 $objMLotteryLog = new LotteryLog (); $condition = array('uid' => $uid); $totals = $objMLotteryLog -> getUserParticipateLogNum($condition); $offset = 0; $size = 10; $data = $objMLotteryLog->findUserParticipateData($condition, "{$offset},{$size}", 'create_time desc'); $events_ids = array(); foreach($data as $key=> $d) { $events_ids[$d['events_id']] = $d['events_id']; } $objDLotteryEvents = new LotteryEvents(); $eventsData = $objDLotteryEvents -> gets($events_ids); $objMLottery = new Lottery(); # 剩余天数 $TIME = time(); $objArticleLikeCounter = new ArticleLikeCounter(); foreach ($eventsData as $tmpKey => $tmpData) { $rday = ($tmpData['end_time'] - $TIME) / (24 * 60 * 60); $eventsData[$tmpKey]['rday'] = ceil($rday); # 参与人数 $objMLotteryLog = new LotteryLog ( null, $tmpData['id'] ); $eventsData[$tmpKey]['user_total'] = $objMLotteryLog->getUserParticipateLogNumGroupByUid (); if ($tmpData['type'] == 9) { # 阅读人数 $eventsData[$tmpKey]['click_num'] = $tmpData['click_num'] + ($tmpData['article_pass_base_num']?$tmpData['click_num'] + $tmpData['article_pass_base_num']:0); # 点赞人数 $eventsData[$tmpKey]['likes'] = $objArticleLikeCounter->getLikes($tmpData['id']); $eventsData[$tmpKey]['likes'] = $eventsData[$tmpKey]['likes'] + $tmpData['article_praise']; } else { if (isset($tmpData['base_num']) && $tmpData['base_num']) { $eventsData[$tmpKey]['user_total'] += $tmpData['base_num']; } } $eventsData[$tmpKey]['url'] = $objMLottery->getEventsUrl($tmpData['type'],$tmpData['create_time']); } $this->setOutput('eventsData', $eventsData); $this->setOutput('title', '我参与的活动'); $this->setOutput('totals', ceil($totals / $size)); $this->tpl = 'my_act'; $this->setOutput('action', 'gift'); $this->setOutput('plat_form_id', $plat_form_id); $this->setOutput('display', 1); $this->setOutput('notShowWeixinShare', true); } /** * 事件:ajax翻页 */ public function doActAjax() { $page = Request::varGetInt('page', 1); $thisTime = time(); $objLottery = new Lottery(); $uid = $this->getRunTimeUid(); $condition = array('uid' => $uid); $totals = $objLottery -> getLotteryDataListNum($condition); $size = 10; $offset = ($page - 1) * $size; $limit = "{$offset},{$size}"; $data = $objLottery->getLotteryDataList($condition, "{$offset},{$size}", 'create_time desc'); $newData = array(); $events_ids = array(); $events_ids = array(); foreach($data as $key=> $d) { $events_ids[$d['run_time_data']['events']['id']] = $d['run_time_data']['events']['id']; } $objDLotteryEvents = new LotteryEvents(); $eventsData = $objDLotteryEvents -> gets($events_ids); # 剩余天数 $TIME = time(); $objArticleLikeCounter = new ArticleLikeCounter(); foreach ($eventsData as $tmpKey => $tmpData) { $rday = ($tmpData['end_time'] - $TIME) / (24 * 60 * 60); $eventsData[$tmpKey]['rday'] = ceil($rday); # 参与人数 $objMLotteryLog = new LotteryLog ( null, $tmpData['id'] ); $eventsData[$tmpKey]['user_total'] = $objMLotteryLog->getUserParticipateLogNumGroupByUid (); if ($tmpData['type'] == 9) { # 阅读人数 $eventsData[$tmpKey]['click_num'] = $tmpData['click_num'] + ($tmpData['article_pass_base_num']?$tmpData['click_num'] + $tmpData['article_pass_base_num']:0); # 点赞人数 $eventsData[$tmpKey]['likes'] = $objArticleLikeCounter->getLikes($tmpData['id']); $eventsData[$tmpKey]['likes'] = $eventsData[$tmpKey]['likes'] + $tmpData['article_praise']; } else { if (isset($tmpData['base_num']) && $tmpData['base_num']) { $eventsData[$tmpKey]['user_total'] += $tmpData['base_num']; } } } $this->setOutput('eventsData', $eventsData); $this->tpl = 'ajax_my_act'; $this->ajax_success_exit($this->render(true)); } /** * 我的礼品 */ public function doGifts() { //填写收货地址 c=Express&lottery_data_id=3 $objLottery = new Lottery(); $thisTime = time(); $plat_form_id = $this->getPlatFormId(); # 获取用户信息 $objUserData = new UserInfo(); $uid = $this->getRunTimeUid(); $userData = $objUserData -> get($uid); $this->setOutput('userData', $userData); # 获取登录地址 $url = Request::g('url'); $thisUrl = Request::schemeDomain().'/member/gifts'; $loginUrl = $this -> getLoginUrl($thisUrl); $this->setOutput('loginUrl', $loginUrl); # 判断是否需要登录 $ckLogin = $this->ckLogin(); $this->setOutput('ckLogin', $ckLogin); $condition = array('audit' => 2, 'uid' => $uid,'scratch_receive' => LotteryData::EVENT_SCRATCH_RECEIVE_TRUE); $totals = $objLottery -> getLotteryDataListNum($condition); $offset = 0; $size = 6; $order = 'id desc'; $data = $objLottery->getLotteryDataList($condition, "{$offset},{$size}", 'create_time desc'); $newData = array(); $events_ids = array(); $objLotteryUserFeedback = new LotteryUserFeedback(); foreach($data as $key=> $d){ $data[$key]['feedback'] = 1;//不需要填写反馈 $events_ids[$d['run_time_data']['events']['id']] = $d['run_time_data']['events']['id']; if (in_array($d['run_time_data']['events']['type'], array(4,0))) { $data[$key]['feedback'] = 2;//未填写反馈 $where = array(); $where['uid'] = $d['uid']; $where['events_id'] = $d['run_time_data']['events']['id']; $where['status'] = 1; $ids = $objLotteryUserFeedback->findIdsBy ( $where, 1, $order = ' id desc'); if ($ids) { $data[$key]['feedback'] = 3;//已填写反馈 } /* if (isset($d['express']) && $d['express']) { $data[$key]['feedback'] = 2;//未填写反馈 $where = array(); $where['uid'] = $d['uid']; $where['events_id'] = $d['run_time_data']['events']['id']; $where['status'] = 1; $ids = $objLotteryUserFeedback->findIdsBy ( $where, 1, $order = ' id desc'); if ($ids) { $data[$key]['feedback'] = 3;//已填写反馈 } } else { $data[$key]['feedback'] = 4;//未填写收货地址 } */ } } $objDLotteryEvents = new LotteryEvents(); $eventsData = $objDLotteryEvents -> gets($events_ids); $time = time(); foreach($data as $key=> $d){ $eventsInfo = $eventsData[$d['run_time_data']['events']['id']]; if ($v['feedback'] == 3) { # 查看是否过期 if ($time > $eventsInfo['end_time']) { $data[$key]['feedback'] = 5;//未填写收货地址并且已经过期 } } $newData[$key] = array(); $newData[$key]['feedback'] = $d['feedback']; $thisEventID = $d['run_time_data']['events']['id']; $newData[$key]['prize_id'] = $d['prize_id']; $newData[$key]['prize_name'] = $d['run_time_data']['prize'][$d['prize_id']]['prize_name']; $newData[$key]['prize_type'] = $d['run_time_data']['prize'][$d['prize_id']]['type']; $newData[$key]['prize_express'] = $d['run_time_data']['prize'][$d['prize_id']]['express']; if ($d['run_time_data']['events']['type'] == LotteryEvents::TYPE_EVENTS_CODE) { //$newData[$key]['prize_img_url'] = $d['run_time_data']['events']['weixinShare']['imgUrl']; $newData[$key]['prize_img_url'] = $d['run_time_data']['prize'][$d['prize_id']]['img_url']; } else { $newData[$key]['prize_img_url'] = $d['run_time_data']['prize'][$d['prize_id']]['img_url']; } $newData[$key]['events_id'] = $thisEventID; $newData[$key]['events_delivery'] = $eventsData[$thisEventID]['delivery']; $newData[$key]['events_name'] = $eventsData[$thisEventID]['events_name']; $newData[$key]['events_type'] = $eventsData[$thisEventID]['type']; $newData[$key]['end_time_receive_prizes'] = $eventsData[$thisEventID]['end_time_receive_prizes']; $newData[$key]['virtual_data'] = $d['virtual_data']; $newData[$key]['express'] = $d['express']; $newData[$key]['lottery_data_id'] = $key; $newData[$key]['show_up_express_a'] = false; if($newData[$key]['end_time_receive_prizes'] < time() && empty($newData[$key]['express'])){ $newData[$key]['show_up_express_a'] = true; } $newData[$key]['url'] = $objLottery -> getEventsUrl($eventsInfo['type'],$eventsInfo['create_time'],$this->platform['url']); } $this->tpl = 'gifts'; $this->setOutput('thisTime', $thisTime); $this->setOutput('title', '我的奖品'); $this->setOutput('data', $data); $this->setOutput('newData', $newData); $this->setOutput('totals', ceil($totals / $size)); $this->setOutput('action', 'gift'); $this->setOutput('display', 1); $this->setOutput('notShowWeixinShare', true); } /** * 事件:ajax翻页 */ public function doAjax() { $page = Request::varGetInt('page', 1); $thisTime = time(); $objLottery = new Lottery(); $uid = $this->getRunTimeUid(); $condition = array('audit' => 2, 'uid' => $uid,'scratch_receive' => LotteryData::EVENT_SCRATCH_RECEIVE_TRUE); $totals = $objLottery -> getLotteryDataListNum($condition); $order = 'create_time desc'; $size = 6; $offset = ($page - 1) * $size; $limit = "{$offset},{$size}"; $data = $objLottery->getLotteryDataList($condition, "{$offset},{$size}", 'create_time desc'); $newData = array(); $events_ids = array(); $objLotteryUserFeedback = new LotteryUserFeedback(); foreach($data as $key=> $d){ $data[$key]['feedback'] = 1;//不需要填写反馈 $events_ids[$d['run_time_data']['events']['id']] = $d['run_time_data']['events']['id']; if (in_array($d['run_time_data']['events']['type'], array(4,0))) { $data[$key]['feedback'] = 2;//未填写反馈 $where = array(); $where['uid'] = $d['uid']; $where['events_id'] = $d['run_time_data']['events']['id']; $where['status'] = 1; $ids = $objLotteryUserFeedback->findIdsBy ( $where, 1, $order = ' id desc'); $info = $objLotteryUserFeedback->gets ( $ids ); if ($info) { $data[$key]['feedback'] = 3;//已填写反馈 } /* if (isset($d['express']) && $d['express']) { $data[$key]['feedback'] = 2;//未填写反馈 $where = array(); $where['uid'] = $d['uid']; $where['events_id'] = $d['run_time_data']['events']['id']; $where['status'] = 1; $ids = $objLotteryUserFeedback->findIdsBy ( $where, 1, $order = ' id desc'); $info = $objLotteryUserFeedback->gets ( $ids ); if ($info) { $data[$key]['feedback'] = 3;//已填写反馈 } } else { $data[$key]['feedback'] = 4;//未填写收货地址 } */ } } $objDLotteryEvents = new LotteryEvents(); $eventsData = $objDLotteryEvents -> gets($events_ids); foreach($data as $key=> $d){ $newData[$key] = array(); $thisEventID = $d['run_time_data']['events']['id']; $newData[$key]['prize_id'] = $d['prize_id']; $newData[$key]['prize_name'] = $d['run_time_data']['prize'][$d['prize_id']]['prize_name']; $newData[$key]['prize_type'] = $d['run_time_data']['prize'][$d['prize_id']]['type']; $newData[$key]['prize_express'] = $d['run_time_data']['prize'][$d['prize_id']]['express']; if ($d['run_time_data']['events']['type'] == LotteryEvents::TYPE_EVENTS_CODE) { $newData[$key]['prize_img_url'] = $d['run_time_data']['events']['weixinShare']['imgUrl']; } else { $newData[$key]['prize_img_url'] = $d['run_time_data']['prize'][$d['prize_id']]['img_url']; } $newData[$key]['events_id'] = $thisEventID; $newData[$key]['events_delivery'] = $eventsData[$thisEventID]['delivery']; $newData[$key]['events_name'] = $eventsData[$thisEventID]['events_name']; $newData[$key]['events_type'] = $eventsData[$thisEventID]['type']; $newData[$key]['end_time_receive_prizes'] = $eventsData[$thisEventID]['end_time_receive_prizes']; $newData[$key]['virtual_data'] = $d['virtual_data']; $newData[$key]['express'] = $d['express']; $newData[$key]['lottery_data_id'] = $key; $newData[$key]['show_up_express_a'] = false; if($newData[$key]['end_time_receive_prizes'] < time() && empty($newData[$key]['express'])){ $newData[$key]['show_up_express_a'] = true; } } $this->setOutput('data', $data); $this->setOutput('newData', $newData); $this->tpl = 'ajax_gifts'; $this->ajax_success_exit($this->render(true)); } public function display() { return $this->render(); } }