Example #1
0
 public function editAdPosition($id, $identifier, $type, $width, $height, $status, $schedule, $showType, $condition)
 {
     list($id, $width, $heigth, $status, $showType, $condition) = array(intval($id), intval($width), intval($heigth), intval($status), intval($showType), $condition);
     if ($status > 1) {
         return new PwError('ADVERTISEMENT:position.status.error');
     }
     if (empty($id)) {
         return new PwError('ADVERTISEMENT:position.error');
     }
     if (!array_key_exists($type, $this->_getAdDs()->getAdType())) {
         return new PwError('ADVERTISEMENT:type.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->setIdentifier($identifier)->setType($type)->setWidth($width)->setHeight($height)->setStatus($status)->setSchedule($schedule)->setShowType($showType)->setCondition($condition);
     $result = $this->_getAdDs()->editAdPosition($dm);
     if (!$result) {
         return new PwError('ADVERTISEMENT:edit.fail');
     }
     $this->_updateAdcache();
     return true;
 }