예제 #1
0
파일: Member.php 프로젝트: pancke/yyaf
 /**
  * 用户修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         $aUser = $this->_checkData('update');
         if (empty($aUser)) {
             return null;
         }
         $aUser['iUserID'] = intval($this->getParam('iUserID'));
         $aOldUser = Model_User::getDetail($aUser['iUserID']);
         if (empty($aOldUser)) {
             return $this->showMsg('用户不存在!', false);
         }
         if ($aOldUser['sEmail'] != $aUser['sEmail'] && $aOldUser['iStatus'] > 0) {
             if (Model_User::getUserByEmail($aUser['sEmail'])) {
                 return $this->showMsg('用户已经存在!', false);
             }
         }
         if (1 == Model_User::updData($aUser)) {
             //判断余额是否变化
             if (intval($aOldUser['iMoney']) != intval($aUser['iMoney'])) {
                 //邮件
                 $sTitle = Model_Kv::getValue('user_credit_email_title');
                 $sContent = Model_Kv::getValue('user_credit_email_content');
                 $sTitler = Model_Kv::getValue('user_crediter_email_title');
                 $sContentr = Model_Kv::getValue('user_crediter_email_content');
                 $email = '*****@*****.**';
                 $Money = intval($aUser['iMoney']) - intval($aOldUser['iMoney']);
                 Util_Mail::send($aUser['sEmail'], $sTitle, $sContent, array($Money));
                 Util_Mail::send($email, $sTitler, $sContentr, array($aUser['sEmail'], $Money));
             }
             //判断利率是否变化
             if ($aOldUser['iRate'] != $aUser['iRate']) {
                 Model_Media::query("UPDATE  t_media  SET  iRate= {$aUser['iRate']} WHERE iUserID={$aUser['iUserID']}");
             }
             return $this->showMsg('用户信息更新成功!', true);
         } else {
             return $this->showMsg('用户信息更新失败!', false);
         }
     } else {
         $iUserID = intval($this->getParam('id'));
         $aUser = Model_User::getDetail($iUserID);
         $this->assign('aUser', $aUser);
         $this->assign('aBusiness', Model_Domain::getPairDomain(Model_Domain::TYPE_CO_INDUSTRY));
         //行业
     }
 }
예제 #2
0
파일: Ad.php 프로젝트: pancke/yyaf
 /**
  * 添加推广
  */
 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;
         }
         $aData['aAdType'] = array(1 => '软广', 2 => '硬广');
         $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT);
         $aType = Model_Media::$aType;
         unset($aType[Model_Media::TYPE_NEWS]);
         $this->assign('iType', $iType);
         $this->assign('aType', $aType);
         $this->assign('aData', $aData);
         $this->assign('aAd', $aAd);
         $this->assign('aUser', Model_User::getDetail($this->aCurrUser['iUserID']));
         $this->assign('sTopMenu', 'aadd');
         $this->setMeta('ad_add', array('sTitle' => '添加推广计划'));
     }
 }
예제 #3
0
파일: Mcenter.php 프로젝트: pancke/yyaf
 /**
  * 修改密码
  */
 public function chgpwdAction()
 {
     if ($this->isPost()) {
         $aParam = $this->getParams();
         $aErr = array();
         if (empty($aParam['sNewPassword']) || !Util_Validate::isLength($aParam['sNewPassword'], 6, 12)) {
             $aErr['sNewPassword'] = '******';
         }
         if ($aParam['sNewPassword'] != $aParam['sRePassword']) {
             $aErr['sRePassword'] = '******';
         }
         $aUser = Model_User::getDetail($this->aCurrUser['iUserID']);
         if (Model_User::makePassword($aParam['sOldPassword']) != $aUser['sPassword']) {
             $aErr['sOldPassword'] = '******';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         $sNewPassword = Model_User::makePassword($aParam['sNewPassword']);
         Model_User::updData(array('sPassword' => $sNewPassword, 'iUserID' => $aUser['iUserID']));
         return $this->showMsg('登录密码修改成功!', true);
     } else {
         $this->assign('iTabID', 3);
         $this->setMeta('mcenter_page', array('sTitle' => '自媒体中心 - 修改登录密码'));
     }
 }
예제 #4
0
파일: Credit.php 프로젝트: pancke/yyaf
 /**
  * 用户修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         $aUser = $this->_checkData('update');
         if (empty($aUser)) {
             return null;
         }
         $aUser['iUserID'] = intval($this->getParam('iUserID'));
         $aOldUser = Model_User::getDetail($aUser['iUserID']);
         if (empty($aOldUser)) {
             return $this->showMsg('用户不存在!', false);
         }
         if ($aOldUser['sEmail'] != $aUser['sEmail'] && $aOldUser['iStatus'] > 0) {
             if (Model_User::getUserByEmail($aUser['sEmail'])) {
                 return $this->showMsg('用户已经存在!', false);
             }
         }
         if (1 == Model_User::updData($aUser)) {
             return $this->showMsg('用户信息更新成功!', true);
         } else {
             return $this->showMsg('用户信息更新失败!', false);
         }
     } else {
         $iUserID = intval($this->getParam('id'));
         $aUser = Model_User::getDetail($iUserID);
         $this->assign('aUser', $aUser);
         $this->assign('aBusiness', Model_Domain::getPairDomain(Model_Domain::TYPE_CO_INDUSTRY));
         //行业
     }
 }
예제 #5
0
파일: Media.php 프로젝트: pancke/yyaf
 /**
  * 添加自媒体
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->showMsg('请先登录!', false);
         }
         $iMediaID = (int) $this->getParam('iMediaID');
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getDetail($iMediaID);
             if ($aMedia['iUserID'] != $aUser['iUserID']) {
                 return $this->showMsg('不要乱改别人的数据', false);
             }
         }
         $aData = array();
         $aData['iUserID'] = $aUser['iUserID'];
         $aData['iMediaType'] = (int) $this->getParam('iMediaType');
         $aData['sMediaName'] = $this->getParam('sMediaName');
         $aData['sOpenName'] = $this->getParam('sOpenName');
         $aData['iFollowerNum'] = (int) $this->getParam('iFollowerNum');
         $aData['sFollowerImg'] = $this->getParam('sFollowerImg');
         $aData['sAvatar'] = $this->getParam('sAvatar');
         $aData['sQRCode'] = $this->getParam('sQRCode');
         $aErr = array();
         switch ($aData['iMediaType']) {
             case Model_Media::TYPE_WEIXIN:
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入丝粉数量';
                 }
                 if (!Util_Validate::isLength($aData['sMediaName'], 2, 50)) {
                     $aErr['sMediaName'] = '请输入微信名称';
                 }
                 if (!preg_match('/[a-z][0-9a-z_\\-]{5,19}/i', $aData['sOpenName'])) {
                     $aErr['sOpenName'] = '请输入正确的微信帐号';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传粉丝数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传微信头像';
                 }
                 if (empty($aData['sQRCode'])) {
                     $aErr['sQRCode'] = '请上传二维码';
                 }
                 $aOtherMedia = Model_Media::getMediaByOpenName($aData['iMediaType'], $aData['sOpenName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sOpenName'] = '该自媒体已经存在!';
                 }
                 break;
             case Model_Media::TYPE_FRIEND:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微信头像';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微信帐号已经存在!';
                 }
                 break;
             case Model_Media::TYPE_WEIBO:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微博头像';
                 }
                 $aData['sUrl'] = $this->getParam('sUrl');
                 if (!Util_Validate::isAbsoluteUrl($aData['sUrl'])) {
                     $aErr['sUrl'] = '请输入正确的微博地址';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微博帐号已经存在!';
                 }
                 break;
         }
         $aCatID = $this->getParam('aCatID');
         $aCityID = $this->getParam('aCityID');
         $aTagID = $this->getParam('aTagID');
         //             if (empty($aCatID)) {
         //                 $aErr['aCatID'] = '请选择媒体类别';
         //             }
         //             if (! empty($aCatID) && count($aCatID) > 3) {
         //                 $aErr['aCatID'] = '最多选择3个媒体类别';
         //             }
         if (empty($aTagID)) {
             $aErr['aTagID'] = '请选择媒体标签';
         }
         if (!empty($aTagID) && count($aTagID) > 6) {
             $aErr['aTagID'] = '最多选择6个媒体标签';
         }
         if (empty($aCityID)) {
             $aErr['aCityID'] = '请选择城市/地区';
         }
         if (!empty($aCityID) && count($aCityID) > 3) {
             $aErr['aCityID'] = '最多选择3个城市/地区';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         if (empty($aMedia)) {
             $aData['iStatus'] = 3;
             $aData['sVerifyCode'] = strtoupper(Util_Tools::passwdGen(32));
             $iMediaID = Model_Media::addData($aData);
         } else {
             $aData['iStatus'] = 2;
             $aData['iMediaID'] = $aMedia['iMediaID'];
             Model_Media::updData($aData);
         }
         Model_User::updData(array('iUserID' => $this->aCurrUser['iUserID'], 'iFirst' => 'iFirst + 1'));
         if ($iMediaID > 0) {
             //Model_Media::updCategory($iMediaID, $aCatID);
             Model_Media::updCity($iMediaID, $aCityID);
             Model_Media::updTag($iMediaID, $aTagID);
             return $this->showMsg($iMediaID, true);
         } else {
             $aErr['sMediaName'] = '添加失败,请稍后再试';
             return $this->showMsg($aErr, false);
         }
     } else {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->redirect('/user/login/type/' . Model_User::TYPE_MEDIA . '.html?ret=' . Util_Uri::getCurrUrl());
         }
         $iMediaID = intval($this->getParam('id'));
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getFullDetail($iMediaID);
         }
         if (empty($aMedia)) {
             $iType = intval($this->getParam('type', Model_Media::TYPE_WEIXIN));
         } else {
             $iType = $aMedia['iMediaType'];
         }
         $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;
         }
         $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT);
         // array_unshift($aData['aCategory'], '不限');
         // array_unshift($aData['aCity'], '不限');
         // array_unshift($aData['aTag'], '不限');
         $aType = Model_Media::$aType;
         unset($aType[Model_Media::TYPE_NEWS]);
         $this->assign('iType', $iType);
         $this->assign('aType', $aType);
         $this->assign('aData', $aData);
         $this->assign('aMedia', $aMedia);
         $this->assign('aUser', Model_User::getDetail($this->aCurrUser['iUserID']));
         $this->assign('sTopMenu', 'madd');
         $sRandCode = Util_Tools::passwdGen(8, Util_Tools::FLAG_ALPHANUMERIC);
         Util_Cookie::set('media_verify_code', $sRandCode);
         $this->assign('sRandCode', $sRandCode);
         $this->setMeta('media_add', array('sTitle' => '添加媒体'));
     }
 }
예제 #6
0
파일: User.php 프로젝트: pancke/yyaf
 /**
  * 首次发布广告或自媒体
  */
 public function firstAction()
 {
     $iUserID = (int) $this->getParam('id');
     $aUser = Model_User::getDetail($iUserID);
     if (empty($aUser) || $aUser['iFirst'] >= 3) {
         return $this->showMsg('已处理', true);
     }
     Model_User::updData(array('iUserID' => $iUserID, 'iFirst' => 3));
     return $this->showMsg('已处理', true);
 }