tpl = 'member'; } /** * 我的礼品 */ 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); $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(); } }