/** * 个人信息 */ public function userinfoAction() { if ($this->isPost()) { $aParam = $this->getParams(); $aParam['iUserID'] = $this->aCurrUser['iUserID']; $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['sRealName'], 2, 5)) { $aErr['sRealName'] = '姓名长度为2-5个汉字!'; } if (!Util_Validate::isLength($aParam['sWeixin'], 4, 50)) { $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 { $aUser = Model_user::getDetail($this->aCurrUser['iUserID']); $this->assign('aUser', $aUser); $this->assign('iTabID', 2); $this->setMeta('mcenter_page', array('sTitle' => '自媒体中心 - 个人资料')); } }
/** * 修改用户信息 */ 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); } }