当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_Ad::addData方法代码示例

本文整理汇总了PHP中Model_Ad::addData方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Ad::addData方法的具体用法?PHP Model_Ad::addData怎么用?PHP Model_Ad::addData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Ad的用法示例。


在下文中一共展示了Model_Ad::addData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAction

 /**
  * 增加广告
  */
 public function addAction()
 {
     if ($this->_request->isPost()) {
         $aAd = $this->_checkData('add');
         if (empty($aAd)) {
             return null;
         }
         if (Model_Ad::addData($aAd) > 0) {
             return $this->showMsg('广告增加成功!', true);
         } else {
             return $this->showMsg('广告增加失败!', false);
         }
     }
 }
开发者ID:pancke,项目名称:yyaf,代码行数:17,代码来源:Adsh.php

示例2: addAction

 /**
  * 添加推广
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $iAdID = (int) $this->getParam('id');
         $aAd = null;
         if ($iAdID > 0) {
             $aAd = Model_Ad::getDetail($iAdID);
             if ($aAd['iUserID'] != $this->aCurrUser['iUserID']) {
                 return $this->showMsg('不要乱改别人的数据', false);
             }
         }
         $aData = array();
         $aData['iUserID'] = $this->aCurrUser['iUserID'];
         $aData['iMediaType'] = (int) $this->getParam('iMediaType');
         $aData['iAdType'] = (int) $this->getParam('iAdType');
         $aData['sAdName'] = $this->getParam('sAdName');
         $aData['iPlanMinMoney'] = (int) $this->getParam('iPlanMinMoney');
         $aData['iPlanMaxMoney'] = (int) $this->getParam('iPlanMaxMoney');
         $aData['sCatID'] = (int) $this->getParam('sCatID');
         $aAdType = $this->getParam('aAdType');
         $aCityID = $this->getParam('aCityID');
         $aErr = array();
         if (!Util_Validate::isLength($aData['sAdName'], 2, 50)) {
             $aErr['sAdName'] = '请输入推广名称';
         }
         if ($aData['iPlanMinMoney'] > $aData['iPlanMaxMoney']) {
             $aErr['iPlanMoney'] = '后者数字必须大于前者数字';
         }
         /*
          * if (empty($aAdType)) { $aErr['aAdType'] = '请选择广告类型'; } if (empty($aCatID)) { $aErr['aCatID'] = '请选择媒体类别'; }
          */
         /*
          * if (empty($aCityID)) { $aErr['aCityID'] = '请选择城市/地区'; }
          */
         if (!empty($aCityID) && count($aCityID) > 3) {
             $aErr['aCityID'] = '最多选择3个城市/地区';
         }
         // 判断该自媒是否已经存在
         if (!empty($aData['sAdName'])) {
             $aOtherAd = Model_Ad::getAdByName($aData['iUserID'], $aData['sAdName'], $iAdID);
             if (!empty($aOtherAd) && $aOtherAd['iStatus'] != Model_Ad::STATUS_DELETE) {
                 $aErr['sAdName'] = '该推广计划已经存在!';
             }
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         /*
          * if (count($aAdType) == 2) { $aData['iAdType'] = 3; } else { $aData['iAdType'] = array_pop($aAdType); }
          */
         $aData['sCityID'] = empty($aCityID) ? '' : join(',', $aCityID);
         $aData['iStatus'] = Model_Ad::STATUS_WRITING;
         if (empty($aAd)) {
             $iAdID = Model_Ad::addData($aData);
         } else {
             $aData['iAdID'] = $aAd['iAdID'];
             Model_Ad::updData($aData);
         }
         Model_User::updData(array('iUserID' => $this->aCurrUser['iUserID'], 'iFirst' => 'iFirst + 1'));
         if ($iAdID > 0) {
             return $this->showMsg($iAdID, true);
         } else {
             $aErr['sAdName'] = '添加失败,请稍后再试';
             return $this->showMsg($aErr, false);
         }
     } else {
         $iAdID = intval($this->getParam('id'));
         $aAd = null;
         if ($iAdID > 0) {
             $aAd = Model_Ad::getDetail($iAdID);
         }
         if (empty($aAd)) {
             $iType = intval($this->getParam('type', Model_Media::TYPE_WEIXIN));
         } else {
             $iType = $aAd['iMediaType'];
             $aAd['aCityID'] = explode(',', $aAd['sCityID']);
             $aAd['aCatID'] = explode(',', $aAd['sCatID']);
         }
         $aData = array();
         switch ($iType) {
             case Model_Media::TYPE_WEIXIN:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_TAG);
                 break;
             case Model_Media::TYPE_FRIEND:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_TAG);
                 break;
             case Model_Media::TYPE_WEIBO:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_TAG);
                 break;
             case Model_Media::TYPE_NEWS:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY);
                 // $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_TAG);
                 break;
         }
//.........这里部分代码省略.........
开发者ID:pancke,项目名称:yyaf,代码行数:101,代码来源:Ad.php


注:本文中的Model_Ad::addData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。