本文整理汇总了PHP中Model_User::updData方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_User::updData方法的具体用法?PHP Model_User::updData怎么用?PHP Model_User::updData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_User
的用法示例。
在下文中一共展示了Model_User::updData方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
/**
* 用户修改
*/
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 = 'viven@51wom.com';
$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: addAction
/**
* 添加推广
*/
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;
}
//.........这里部分代码省略.........
示例3: chgpwdAction
/**
* 修改密码
*/
public function chgpwdAction()
{
if ($this->isPost()) {
$aParam = $this->getParams();
$aErr = array();
if (empty($aParam['sNewPassword']) || !Util_Validate::isLength($aParam['sNewPassword'], 6, 12)) {
$aErr['sNewPassword'] = '登录密码长度为6-12个字符';
}
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: editAction
/**
* 用户修改
*/
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: addAction
//.........这里部分代码省略.........
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: firstAction
/**
* 首次发布广告或自媒体
*/
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);
}