예제 #1
0
파일: Media.php 프로젝트: pancke/yyaf
 /**
  * 增加自媒体
  */
 public function addAction()
 {
     if ($this->_request->isPost()) {
         $aMedia = $this->_checkData('add');
         if (empty($aMedia)) {
             return null;
         }
         //            if (Model_Media::getCityByName($aMedia['sCityName'])) {
         //                return $this->showMsg('自媒体已经存在!', false);
         //            }
         //标签
         $sTagID = $aMedia['sTagID'];
         unset($aMedia['sTagID']);
         //所属类目
         $sCategoryID = $aMedia['sCategoryID'];
         unset($aMedia['sCategoryID']);
         //行业圈子
         $sCricleID = $aMedia['sCricleID'];
         unset($aMedia['sCricleID']);
         //城市
         $sCityID = $aMedia['sCityID'];
         unset($aMedia['sCityID']);
         if (Model_Media::addData($aMedia) > 0) {
             //标签
             if ($sTagID != '') {
                 $sTagID = explode(',', $sTagID);
                 $add = array();
                 $add['iMediaID'] = $aMedia['iMediaID'];
                 $add['iStatus'] = 1;
                 $add['iCreateTime'] = time();
                 $add['iUpdateTime'] = time();
                 foreach ($sTagID as $val) {
                     $add['iTagID'] = $val;
                     Model_MediaTag::addData($add);
                 }
             }
             //所属类目
             if ($sCategoryID != '') {
                 $sCategoryID = explode(',', $sCategoryID);
                 $add = array();
                 $add['iMediaID'] = $aMedia['iMediaID'];
                 $add['iStatus'] = 1;
                 $add['iCreateTime'] = time();
                 $add['iUpdateTime'] = time();
                 foreach ($sCategoryID as $val) {
                     $add['iCategoryID'] = $val;
                     Model_MediaCategory::addData($add);
                 }
             }
             //行业圈子
             if ($sCricleID != '') {
                 $sCricleID = explode(',', $sCricleID);
                 $add = array();
                 $add['iMediaID'] = $aMedia['iMediaID'];
                 $add['iStatus'] = 1;
                 $add['iCreateTime'] = time();
                 $add['iUpdateTime'] = time();
                 foreach ($sCricleID as $val) {
                     $add['iCricleID'] = $val;
                     Model_MediaCricle::addData($add);
                 }
             }
             //城市
             if ($sCityID != '') {
                 $sCityID = explode(',', $sCityID);
                 $add = array();
                 $add['iMediaID'] = $aMedia['iMediaID'];
                 $add['iStatus'] = 1;
                 $add['iCreateTime'] = time();
                 $add['iUpdateTime'] = time();
                 foreach ($sCityID as $val) {
                     $add['iCityID'] = $val;
                     Model_MediaCity::addData($add);
                 }
             }
             return $this->showMsg('自媒体增加成功!', true);
         } else {
             return $this->showMsg('自媒体增加失败!', false);
         }
     }
     $iMediaType = $this->getParam('iMediaType');
     $this->assign('iMediaType', $iMediaType);
     //属性
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aAttribute', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_ATTRIBUTE));
     } else {
         if ($iMediaType == Model_Media::TYPE_FRIEND) {
             // 微信朋友圈
             $this->assign('aAttribute', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_FRIEND_ATTRIBUTE));
         } else {
             if ($iMediaType == Model_Media::TYPE_WEIBO) {
                 // 新浪微博
                 $this->assign('aAttribute', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_ATTRIBUTE));
             } else {
                 if ($iMediaType == Model_Media::TYPE_NEWS) {
                     // 新闻&论坛
                     $this->assign('aAttribute', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_NEWS_ATTRIBUTE));
                 }
             }
         }
     }
     //分类
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aTypeInfo', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY));
     } else {
         if ($iMediaType == Model_Media::TYPE_FRIEND) {
             // 微信朋友圈
             $this->assign('aTypeInfo', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY));
         } else {
             if ($iMediaType == Model_Media::TYPE_WEIBO) {
                 // 新浪微博
                 $this->assign('aTypeInfo', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY));
             } else {
                 if ($iMediaType == Model_Media::TYPE_NEWS) {
                     // 新闻&论坛
                     $this->assign('aTypeInfo', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY));
                 }
             }
         }
     }
     //合作等级
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aCooperateLevel', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_COOPERATELEVEL));
     } else {
         if ($iMediaType == Model_Media::TYPE_FRIEND) {
             // 微信朋友圈
             $this->assign('aCooperateLevel', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_FRIEND_COOPERATELEVEL));
         } else {
             if ($iMediaType == Model_Media::TYPE_WEIBO) {
                 // 新浪微博
                 $this->assign('aCooperateLevel', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_COOPERATELEVEL));
             } else {
                 if ($iMediaType == Model_Media::TYPE_NEWS) {
                     // 新闻&论坛
                     $this->assign('aCooperateLevel', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_NEWS_COOPERATELEVEL));
                 }
             }
         }
     }
     //行业圈子
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aIndustryCircle', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_INDUSTRY));
     } else {
         if ($iMediaType == Model_Media::TYPE_FRIEND) {
             // 微信朋友圈
             $this->assign('aIndustryCircle', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_FRIEND_INDUSTRY));
         } else {
             if ($iMediaType == Model_Media::TYPE_WEIBO) {
                 // 新浪微博
                 $this->assign('aIndustryCircle', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_INDUSTRY));
             } else {
                 if ($iMediaType == Model_Media::TYPE_NEWS) {
                     // 新闻&论坛
                     $this->assign('aIndustryCircle', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_NEWS_INDUSTRY));
                 }
             }
         }
     }
     //认证
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aVerifyState', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_VERIFY));
     } else {
         if ($iMediaType == Model_Media::TYPE_WEIBO) {
             // 新浪微博
             $this->assign('aVerifyState', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_VERIFY));
         }
     }
     //标签
     if ($iMediaType == Model_Media::TYPE_WEIXIN) {
         // 微信公众号
         $this->assign('aTag', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIXIN_TAG));
     } else {
         if ($iMediaType == Model_Media::TYPE_FRIEND) {
             // 微信朋友圈
             $this->assign('aTag', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_FRIEND_TAG));
         } else {
             if ($iMediaType == Model_Media::TYPE_WEIBO) {
                 // 新浪微博
                 $this->assign('aTag', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_WEIBO_TAG));
             } else {
                 if ($iMediaType == Model_Media::TYPE_NEWS) {
                     // 新闻&论坛
                     $this->assign('aTag', Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_NEWS_TAG));
                 }
             }
         }
     }
     //资源推荐
     $aRecommend = Model_Domain::getPairDomain(Model_Domain::TYPE_MEDIA_RECOMMEND);
     $this->assign('aRecommend', $aRecommend);
     //后台管理用户
     $adminData = Model_Admin::getAll(array('where' => array('iStatus' => 1)));
     $this->assign('adminData', $adminData);
     //城市
     $this->assign('aCity', Model_City::getPairCitys());
 }
예제 #2
0
파일: Member.php 프로젝트: pancke/yyaf
 /**
  * 请求数据检测
  *
  * @return mixed
  */
 public function _checkData($sType = 'add')
 {
     $iType = $this->getParam('iType');
     $sEmail = $this->getParam('sEmail');
     $sMobile = $this->getParam('sMobile');
     $sRealName = $this->getParam('sRealName');
     $sPassword = $this->getParam('sPassword');
     $sCoName = $this->getParam('sCoName');
     $iCoIndustry = $this->getParam('iCoIndustry');
     $sCoAddress = $this->getParam('sCoAddress');
     $sCoWebSite = $this->getParam('sCoWebSite');
     $sCoDesc = $this->getParam('sCoDesc');
     $sWeixin = $this->getParam('sWeixin');
     $sQQ = $this->getParam('sQQ');
     $iIncome = $this->getParam('iIncome');
     $iMoney = $this->getParam('iMoney');
     $iStatus = $this->getParam('iStatus');
     $iRate = $this->getParam('iRate');
     $iUpdateTime = time();
     if (!Util_Validate::isEmail($sEmail)) {
         return $this->showMsg('输入的邮箱地址不合法!', false);
     }
     if (($sType == 'add' || !empty($sPassword)) && !Util_Validate::isLength($sPassword, 6, 20)) {
         return $this->showMsg('登录密码长度范围为6到20字符!', false);
     }
     if (!Util_Validate::isMobile($sMobile)) {
         return $this->showMsg('输入的手机号码不合法!', false);
     }
     if (!Util_Validate::isLength($sRealName, 2, 20)) {
         return $this->showMsg('真实姓名长度范围为2到20字符!', false);
     }
     $aDomain = Model_Domain::getPairDomain(Model_Domain::TYPE_CO_INDUSTRY);
     if (!isset($aDomain[$iCoIndustry])) {
         return $this->showMsg('选择的行业不存在!', false);
     }
     $aRow = array('iType' => $iType, 'sEmail' => $sEmail, 'sMobile' => $sMobile, 'sRealName' => $sRealName, 'sCoName' => $sCoName, 'iCoIndustry' => $iCoIndustry, 'sCoAddress' => $sCoAddress, 'sCoWebSite' => $sCoWebSite, 'sCoDesc' => $sCoDesc, 'sWeixin' => $sWeixin, 'sQQ' => $sQQ, 'iIncome' => $iIncome, 'iMoney' => $iMoney, 'iStatus' => $iStatus, 'iUpdateTime' => $iUpdateTime, 'iRate' => $iRate);
     if (!empty($sPassword)) {
         $aRow['sPassword'] = md5(Yaf_G::getConf('cryptkey', 'cookie') . $sPassword);
     }
     return $aRow;
 }