Ejemplo n.º 1
0
Archivo: User.php Proyecto: pancke/yyaf
 /**
  * 请求数据检测
  *
  * @return mixed
  */
 public function _checkData($sType = 'add')
 {
     $sAdminName = $this->getParam('sAdminName');
     $sPassword = $this->getParam('sPassword');
     $sMobile = $this->getParam('sMobile');
     $sEmail = $this->getParam('sEmail');
     $sRealName = $this->getParam('sRealName');
     $iCityID = $this->getParam('iCityID');
     $aCityID = $this->getParam('aCityID');
     $sAllCityID = $this->getParam('sAllCityID');
     $aRoleID = $this->getParam('aRoleID');
     $sAdminID = $this->getParam('sAdminID');
     if (!Util_Validate::isLength($sAdminName, 3, 50)) {
         return $this->showMsg('用户名长度范围为3到30个字!', 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::isEmail($sEmail)) {
         return $this->showMsg('输入的邮箱地址不合法!', false);
     }
     if (!Util_Validate::isLength($sRealName, 2, 20)) {
         return $this->showMsg('真实姓名长度范围为2到20字符!', false);
     }
     $aCity = Model_City::getPairCitys();
     if (!isset($aCity[$iCityID])) {
         return $this->showMsg('选择的城市不存在!', false);
     }
     // 将默认城市加入到城市权限中
     if ($sAllCityID == '1') {
         $aCityID = array(-1);
     } elseif (empty($aCityID) || !in_array($iCityID, $aCityID)) {
         $aCityID[] = $iCityID;
     }
     // 将默认城市加入到城市权限中
     if ($sAdminID == '1') {
         $aRoleID = array(-1);
     } elseif (empty($aRoleID)) {
         return $this->showMsg('请至少选择一个角色!', false);
     }
     $aRow = array('sAdminName' => $sAdminName, 'sMobile' => $sMobile, 'sEmail' => $sEmail, 'sRealName' => $sRealName, 'iCityID' => $iCityID, 'sCityID' => join(',', $aCityID), 'sRoleID' => join(',', $aRoleID));
     if (!empty($sPassword)) {
         $aRow['sPassword'] = md5(Yaf_G::getConf('cryptkey', 'cookie') . $sPassword);
     }
     return $aRow;
 }
Ejemplo n.º 2
0
 /**
  * 请求数据检测
  *
  * @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;
 }
Ejemplo n.º 3
0
Archivo: User.php Proyecto: pancke/yyaf
 /**
  * 修改用户信息
  */
 public function chginfoAction()
 {
     if ($this->isPost()) {
         $aParam = $this->getParams();
         $aUser = Model_User::getDetail($aParam['iUserID']);
         $aErr = array();
         if (empty($aParam['sEmail']) || !Util_Validate::isEmail($aParam['sEmail'])) {
             $aErr['sEmail'] = '登录邮箱格式不正确!';
         }
         if (empty($aParam['sMobile']) || !Util_Validate::isMobile($aParam['sMobile'])) {
             $aErr['sMobile'] = '手机号码格式不正确!';
         }
         if ($aUser['sEmail'] != $aParam['sEmail'] && Model_User::getUserByEmail($aParam['sEmail'], $aParam['iType'], $aParam['iUserID'])) {
             $aErr['sEmail'] = '该邮箱已经被注册了!';
         }
         if ($aUser['sMobile'] != $aParam['sMobile'] && Model_User::getUserByMobile($aParam['sMobile'], $aParam['iType'], $aParam['iUserID'])) {
             $aErr['sMobile'] = '该手机号码已经被注册了!';
         }
         if (!Util_Validate::isCLength($aParam['sCoName'], 1, 50)) {
             $aErr['sCoName'] = '企业名称长度为1-50个汉字!';
         }
         if (!Util_Validate::isCLength($aParam['sRealName'], 2, 5)) {
             $aErr['sRealName'] = '联系人名称长度为2-5个汉字!';
         }
         if (!Util_Validate::isAbsoluteUrl($aParam['sCoWebsite'])) {
             $aErr['sCoWebsite'] = '网址格式不正确!';
         }
         if (!Util_Validate::isCLength($aParam['sCoDesc'], 2, 200)) {
             $aErr['sCoDesc'] = '公司介绍长度为2-500个汉字!';
         }
         if (empty($aParam['sWeixin'])) {
             $aErr['sWeixin'] = '请输入你的微信号!';
         }
         if (!Util_Validate::isQQ($aParam['sQQ'])) {
             $aErr['sQQ'] = 'QQ号码输入不正确!';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         Model_User::updData($aParam);
         return $this->showMsg('个人信息修改成功!', true);
     } else {
         $iType = $this->getParam('type');
         $aUser = $this->getCurrUser($iType);
         if (empty($aUser)) {
             return $this->show404();
         }
         $aUser = Model_user::getDetail($aUser['iUserID']);
         $aIndustry = Model_Domain::getOption(Model_Domain::TYPE_CO_INDUSTRY);
         $this->assign('aUser', $aUser);
         $this->assign('aIndustry', $aIndustry);
     }
 }