public function editAdPosition(PwAdDm $dm) { if (($result = $dm->beforeUpdate()) !== true) { return false; } return $this->_getPwAdDao()->editAdPosition($dm->pid, $dm->getData()); }
public function changeAdPositionStatus($id, $status) { list($id, $status) = array(intval($id), intval($status)); if ($status > 1) { return new PwError('ADVERTISEMENT:position.status.error'); } if (empty($id)) { return new PwError('ADVERTISEMENT:position.error'); } $checkPostition = $this->_getAdDs()->getByPid($id); if (!$checkPostition) { return new PwError('ADVERTISEMENT:position.not.exists'); } Wind::import('SRV:advertisement.dm.PwAdDm'); $dm = new PwAdDm($id); $dm->setStatus($status); $result = $this->_getAdDs()->editAdPosition($dm); if (!$result) { return new PwError('ADVERTISEMENT:edit.fail'); } $this->_updateAdcache(); return true; }