public function Index() { $openId = I('request.open_id', NULL, "string"); if (!$openId) { $openId = get_openid(); } $actionId = I('action_id', 0, "intval"); $type = I('type', 'latest', "string"); $query = I('query', NULL, "string"); // 增加访问记录 $this->AddVisitor($actionId, $openId); $model = new WeVoteCandidatesModel(); $candidatesCount = $model->where('action_id = ' . $actionId)->count(); $model = new WeVoteInfoModel(); $voteCount = $model->where('action_id = ' . $actionId)->count(); $model = new WeVoteVisitorsModel(); $visitCount = $model->where('action_id = ' . $actionId)->count(); if (strcasecmp($type, 'latest') == 0) { $candidatesData = $this->GetCandidates($this->SQL_QUERY_CANDIDATES_LATEST, $actionId, $query, 1, 10); } else { $candidatesData = $this->GetCandidates($this->SQL_QUERY_CANDIDATES_ALL, $actionId, $query, 1, 10); } $model = new WeVoteConfigModel(); $data = $model->where('id = ' . $actionId)->find(); if ($data === FALSE || !$data) { return $this->error('活动已失效'); } $model = new HeadPictureManagementModel(); $picdata = $model->field('picurl,picid')->where(array('configid' => $actionId))->order('orderno')->select(); $this->assign('action_id', $actionId); $this->assign('candidatesCount', $candidatesCount); $this->assign('voteCount', $voteCount); $this->assign('visitCount', $visitCount); $this->assign('type', $type); $this->assign('introduce', $data['introduce']); $this->assign('datetime', $data['datetime']); $this->assign('candidatesData', $candidatesData); $this->assign('currentPage', 1); $this->assign('signPackage', GetSignPackage()); $this->assign('share_url', addons_url('WeVote:/Home/ShareAction')); $this->assign('shareUrl', $data['shareUrl']); $this->assign('afterShareUrl', $data['afterShareUrl']); $this->assign('shareTitle', $data['shareTitle']); $this->assign('shareDesc', $data['shareDesc']); $this->assign('shareImageUrl', $data['shareImageUrl']); $this->assign('headpic', $picdata); $this->display(ONETHINK_ADDON_PATH . 'WeVote/View/default/WeVote/Home/Index.html'); }
public function DeletePicture() { $ids = array_unique((array) I('ids', null)); if (empty($ids)) { return $this->error('请选择要删除行!'); } $data = array('id' => array('in', $ids)); $model = new HeadPictureManagementModel(); $res = $model->where($data)->delete(); if (!$res) { $this->error("删除图片失败"); } else { $this->success('删除成功!', addons_url('WeVote:/HeadPictureManagement/Index', array('action_id' => $this->mActionId))); } }