示例#1
0
 public function editAction()
 {
     if ($this->getInput('type', 'post') === 'do') {
         list($id, $merchandiseId, $templateId) = $this->getInput(array('id', 'mid', 'tid'), 'request');
         $discount = $this->getInput('discount', 'post');
         $dm = new App_Merchandise_Promo_Dm();
         $dm->setValue($discount)->setLastUpdateTime(Pw::getTime());
         $this->_getPromoDs()->updateMerchandisePromo($id, $dm);
         $this->updateMerchandiseCurrentPrice($merchandiseId, $discount, $templateId);
         $this->showMessage('更新成功!');
     }
     $spId = $this->getInput('spid', 'request');
     $merchandisePromotion = $this->_getPromoDs()->getMerchandisePromotionBySPID($spId);
     $this->setOutput($spId, 'spid');
     $this->setOutput($merchandisePromotion, 'merchandisePromotion');
     $this->setTemplate('promo/promo_edit');
 }
示例#2
0
 public function editAction()
 {
     if ($this->getInput('type', 'post') === 'do') {
         list($id, $merchandiseId, $spId) = $this->getInput(array('id', 'mid', 'spid'), 'request');
         $discount = $this->getInput('discount', 'post');
         //更新描述信息
         $mName = $this->_getMerchandiseDs()->getMerchandiseNameByIdList($merchandiseId);
         $description = $mName[0]['name'] . "打" . $discount * 10 . "折";
         $this->updateShopPromotion($spId, $description);
         //更新商品的活动存储
         $dm = new App_Merchandise_Promo_Dm();
         $dm->setValue($discount)->setLastUpdateTime(Pw::getTime());
         $this->_getPromoDs()->updateMerchandisePromo($id, $dm);
         //把价格更新回商品的主表
         $this->updateMerchandiseCurrentPrice($merchandiseId, $discount, 'Discount');
         $this->showMessage('更新成功!');
     }
     $spId = $this->getInput('spid', 'request');
     $merchandisePromotion = $this->_getPromoDs()->getMerchandisePromotionBySPID($spId);
     $this->setOutput($spId, 'spid');
     $this->setOutput($merchandisePromotion[0], 'merchandisePromotion');
 }