/** * 用户修改 */ 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)); //行业 } }
/** * 用户修改 */ 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)); //行业 } }
/** * 个人信息 */ 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 loginAction() { if ($this->isPost()) { $iType = $this->getParam('type'); $sUser = $this->getParam('user'); $sPass = $this->getParam('pass'); $sCode = $this->getParam('code'); $aErr = array(); if (!Util_Verify::checkImageCode($iType, $sCode)) { $aErr['code'] = '验证码错误'; } if (empty($sUser)) { $aErr['user'] = '******'; } else { $aUser = Model_User::getUserByEmail($sUser, $iType); if (empty($aUser)) { $aErr['user'] = '******'; } elseif (Model_User::makePassword($sPass) != $aUser['sPassword']) { $aErr['pass'] = '******'; } } if (!empty($aErr)) { return $this->showMsg($aErr, false); } $aCookie = Model_User::login($aUser); return $this->showMsg($aCookie, true); } else { $this->assign('iType', max(1, intval($this->getParam('type')))); $this->assign('retUrl', $this->getParam('ret')); $this->setMeta('user_login', array('sTitle' => '用户登录')); } }