public function doeditAction() { $id = (int) $this->getInput('portalid', 'post'); $title = $this->getInput('title', 'post'); $coverfrom = (int) $this->getInput('coverfrom', 'post'); $pagename = $this->getInput('pagename', 'post'); $keywords = $this->getInput('keywords', 'post'); $description = $this->getInput('description', 'post'); if (!$title) { $this->showError("DESIGN:title.is.empty"); } if (!$pagename) { $this->showError("DESIGN:pagename.is.empty"); } //二级域名start list($domain, $root) = $this->getInput(array('domain', 'root'), 'post'); if ($root) { if (!$domain) { Wekit::load('domain.PwDomain')->deleteByDomainKey("special/index/run?id={$id}"); } else { $r = Wekit::load('domain.srv.PwDomainService')->isDomainValid($domain, $root, "special/index/run?id={$id}"); if ($r instanceof PwError) { $this->showError($r->getError()); } Wind::import('SRV:domain.dm.PwDomainDm'); $dm = new PwDomainDm(); $dm->setDomain($domain)->setDomainKey("special/index/run?id={$id}")->setDomainType('special')->setRoot($root)->setFirst($domain[0])->setId($id); Wekit::load('domain.PwDomain')->replaceDomain($dm); } Wekit::load('domain.srv.PwDomainService')->flushAll(); } //二级域名end if (!$this->_validator($pagename)) { $this->showError("DESIGN:pagename.validator.fail"); } $ds = $this->_getPortalDs(); $portal = $ds->getPortal($id); if (!$portal) { $this->showError("operate.fail"); } $count = $ds->countPortalByPagename($pagename); if ($portal['pagename'] != $pagename && $count >= 1) { $this->showError("DESIGN:pagename.already.exists"); } if ($coverfrom == 2) { $cover = ''; $upload = $this->_upload($id); if ($upload['filename']) { $cover = Pw::getPath($upload['path'] . $upload['filename']); } } else { $cover = $this->getInput('webcover', 'post'); $cover = preg_match("/^http:\\/\\/(.*)\$/", $cover) ? $cover : ''; } Wind::import('SRV:design.dm.PwDesignPortalDm'); $dm = new PwDesignPortalDm($id); $dm->setPageName($pagename)->setTitle($title)->setCover($cover)->setDomain($domain)->setIsopen((int) $this->getInput('isopen', 'post'))->setHeader((int) $this->getInput('isheader', 'post'))->setNavigate((int) $this->getInput('isnavigate', 'post'))->setFooter((int) $this->getInput('isfooter', 'post'))->setKeywords($keywords)->setDescription($description); $resource = $ds->updatePortal($dm); if ($resource instanceof PwError) { $this->showError($resource->getError()); } $pageInfo = $this->_getPageDs()->getPageByTypeAndUnique(PwDesignPage::PORTAL, $id); //更新页面名称 Wind::import('SRV:design.dm.PwDesignPageDm'); $dm = new PwDesignPageDm($pageInfo['page_id']); $dm->setName($title); $this->_getPageDs()->updatePage($dm); //seo Wind::import('SRV:seo.dm.PwSeoDm'); $dm = new PwSeoDm(); $dm->setMod('area')->setPage('custom')->setParam($id)->setTitle($title)->setKeywords($keywords)->setDescription($description); Wekit::load('seo.srv.PwSeoService')->batchReplaceSeoWithCache($dm); $this->showMessage("operate.success", "special/index/run?id=" . $id, true); }
/** * 更新seo * */ public function doRunAction() { $seo = $this->getInput('seo'); $mod = $this->getInput('mod'); $data = array(); foreach ($seo as $page => $list) { foreach ($list as $k => $v) { $dm = new PwSeoDm(); $dm->setMod($mod)->setPage($page)->setParam($k)->setTitle($v['title'])->setKeywords($v['keywords'])->setDescription($v['description']); $data[] = $dm; } } $this->_seoService()->batchReplaceSeoWithCache($data); $this->showMessage('success'); }
private function _updateForumSeo($fid) { //seo $seo = $this->getInput('seo'); Wind::import('SRV:seo.dm.PwSeoDm'); $dm = new PwSeoDm(); $dm->setMod('bbs')->setPage('thread')->setParam($fid)->setTitle($seo['title'])->setKeywords($seo['keywords'])->setDescription($seo['description']); Wekit::load('seo.srv.PwSeoService')->batchReplaceSeoWithCache($dm); }