public function doaddAction() { list($name, $url, $descrip, $logo, $ifcheck, $contact) = $this->getInput(array('name', 'url', 'descrip', 'logo', 'ifcheck', 'contact'), 'post'); Wind::import('SRC:service.link.dm.PwLinkDm'); $linkDm = new PwLinkDm(); $linkDm->setName($name); $linkDm->setUrl($url); $linkDm->setDescrip($descrip); $linkDm->setLogo($logo); $linkDm->setIfcheck(0); $linkDm->setContact($contact); $logo && $linkDm->setIflogo(1); if (($result = $this->_getLinkDs()->addLink($linkDm)) instanceof PwError) { $this->showError($result->getError()); } $this->showMessage('operate.success'); }
/** * do审核友情链接 * * @return void */ public function doCheckAction() { $this->getRequest()->isPost() || $this->showError('operate.fail'); list($data, $lid, $single) = $this->getInput(array('data', 'lid', 'signle'), 'post'); if (!$lid) { $this->showError('operate.select'); } Wind::import('SRC:service.link.dm.PwLinkDm'); foreach ($lid as $_id) { if (!isset($data[$_id])) { continue; } $linkDm = new PwLinkDm($_id); $linkDm->setVieworder($data[$_id]['vieworder']); $linkDm->setIfcheck(1); $rt = $this->_getLinkDs()->updateLink($linkDm); if ($rt instanceof PwError) { $this->showError($rt->getError()); } $this->_getLinkDs()->delRelationsByLid($_id); $typeids = $single ? explode(',', $data[$_id]['typeid']) : $data[$_id]['typeid']; foreach ($typeids as $v) { $this->_getLinkDs()->addRelation($_id, $v); } } $this->showMessage("operate.success"); }
/** * 更新友情链接 * * @param PwLinksDm $dm * @return boolean */ public function updateLink(PwLinkDm $dm) { if (($result = $dm->beforeUpdate()) !== true) { return $result; } return $this->_getLinkDao()->updateLink($dm->getLid(), $dm->getData()); }