예제 #1
0
 /**
  * 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");
 }