当前位置: 首页>>代码示例>>PHP>>正文


PHP User::updateAll方法代码示例

本文整理汇总了PHP中common\models\User::updateAll方法的典型用法代码示例。如果您正苦于以下问题:PHP User::updateAll方法的具体用法?PHP User::updateAll怎么用?PHP User::updateAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common\models\User的用法示例。


在下文中一共展示了User::updateAll方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionRefreshOnline

 /**
  * Снимаем онлайн у тех, у кого за последнее время активность == 0
  */
 public function actionRefreshOnline()
 {
     $oldTime = time() - \Yii::$app->params['onlineLength'];
     $userUpdated = User::updateAll(['<=', 'updated', $oldTime]);
     $this->stdout(Console::wrapText("- {$userUpdated} отправлено в оффлайн", 10), Console::BOLD);
     $this->stdout("\n");
 }
开发者ID:KPEMATOP,项目名称:findspree_old,代码行数:10,代码来源:UserController.php

示例2: import

 public function import()
 {
     $newList = [];
     $ldap = new LdapComponent();
     $members = $ldap->groupSearch('cubric-int');
     $email = '';
     User::updateAll(['status_id' => Types::$status['inactive']['id']], 'status_id=' . Types::$status['active']['id']);
     foreach ($members as $dn) {
         $user_name = $this->_parseUserDn($dn);
         $userModel = User::findOne(['user_name' => $user_name]);
         $rec = $ldap->search(sprintf('uid=%s', $user_name));
         $rec = $rec['data'][0];
         if ($userModel === null) {
             if (array_key_exists('email', $rec)) {
                 $email = $rec['mail'][0];
             } else {
                 $email = sprintf('%s@cardiff.ac.uk', $user_name);
             }
             $userModel = new User();
             $userModel->user_name = $user_name;
             $userModel->email = $email;
             $newList[] = ['user_name' => $user_name, 'first_name' => $rec['givenname'][0], 'last_name' => $rec['sn'][0], 'email' => $email];
         }
         //if (array_key_exists('telephonenumber', $rec))
         //    echo ($rec['telephonenumber'][0]) . "<br/>";
         $userModel->first_name = $rec['givenname'][0];
         $userModel->last_name = $rec['sn'][0];
         $userModel->gid = $rec['gidnumber'][0];
         $userModel->uid = $rec['uidnumber'][0];
         $userModel->dn = $dn;
         $userModel->status_id = Types::$status['active']['id'];
         $userModel->save();
     }
     foreach ($newList as $u) {
         yii::$app->LogComponent->activateUser($u['user_name'], sprintf('Adding user: %s %s', $u['first_name'], $u['last_name']));
         if (array_key_exists('email', $u)) {
             yii::$app->LogComponent->emailSend($u['user_name'], sprintf('Welcome email sent to %s', $u['email']));
             $this->sendWelcomeEmail($u['user_name'], $u['email']);
         }
     }
     return $newList;
 }
开发者ID:spiro-stathakis,项目名称:projects,代码行数:42,代码来源:UserComponent.php

示例3: actionChangestatus

 public function actionChangestatus()
 {
     $data = json_decode(file_get_contents("php://input"));
     $query = User::updateAll(['status' => $data->status], 'sn = ' . $data->id);
     if ($query) {
         $response["status"] = 'success';
         $response["message"] = 'Status changed successfully.';
         //$response["data"]=(int)$model->id;
         http_response_code(200);
         header('Content-type: application/json');
         echo json_encode($response, JSON_NUMERIC_CHECK);
     }
 }
开发者ID:nahidlu,项目名称:easysale,代码行数:13,代码来源:EmployeeController.php

示例4: clearNotifyCount

 /**
  * 清除通知数
  * @return mixed
  */
 public static function clearNotifyCount()
 {
     return User::updateAll(['notification_count' => '0'], ['id' => \Yii::$app->user->id]);
 }
开发者ID:nsdown,项目名称:getyii,代码行数:8,代码来源:UserService.php

示例5: actionLockUsers

 public function actionLockUsers($ids)
 {
     if (!Yii::$app->user->can("admin")) {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
     $this->layout = "admin";
     User::updateAll(['status' => User::STATUS_LOCK], "id in (" . $ids . ") ");
     $this->redirect('referrer');
 }
开发者ID:ncuong,项目名称:lifeguard,代码行数:9,代码来源:ManageController.php

示例6: toBigPicArctileShow

 public static function toBigPicArctileShow($object, User $weixinuser, Activity $activity, Activity $re_activity)
 {
     $strPicurl = "https://mmbiz.qlogo.cn/mmbiz/3Nsx3YNMeOv6rg4at4Txeak4b9Wkiaq9ibIw7z3V0jFgoXRnCoAfs06y6VRYdzbsSicMRia4nIAyDzkzcjMxzdA3aw/0?wx_fmt=jpeg";
     $strUrl = "http://mp.weixin.qq.com/s?__biz=MzAwNDU3NjAwMw==&mid=402239047&idx=1&sn=96477c6d8807242d4bd75ecf021fbde0#rd";
     $result = $activity->toRollActivity($weixinuser, $activity->id);
     #增加提醒记录
     $activityRemind = new ActivityRemind();
     $activityRemind->setAttributes(['activity_id' => $re_activity->id, 'user_id' => $weixinuser->user_id, 'remind_name' => $re_activity->ac_name, 'remind_mark' => $re_activity->ac_cname, 'remind_type' => 0, 'addtime' => time()]);
     $activityRemind->save();
     if ($result['status'] != 2) {
         User::updateAll(['purview' => time()], 'user_id=:user_id', [':user_id' => $weixinuser->user_id]);
     }
     if ($result['status'] == 1) {
         $strPicurl = "https://mmbiz.qlogo.cn/mmbiz/3Nsx3YNMeOv6rg4at4Txeak4b9Wkiaq9ibIw7z3V0jFgoXRnCoAfs06y6VRYdzbsSicMRia4nIAyDzkzcjMxzdA3aw/0?wx_fmt=jpeg";
         $strUrl = "http://mp.weixin.qq.com/s?__biz=MzAwNDU3NjAwMw==&mid=402239047&idx=1&sn=96477c6d8807242d4bd75ecf021fbde0#rd";
     }
     $strTitle = $result['remark'];
     $strDes = $result['remark'];
     $content = [0 => ['title' => $strTitle, 'des' => $strDes, 'picurl' => $strPicurl, 'url' => $strUrl], 1 => ['title' => '春节初一至初十五天天抽奖。抽完为止。', 'des' => 'ooo', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/3Nsx3YNMeOv6rg4at4Txeak4b9Wkiaq9ib9tjFrJOGZQmfeAC4WapMdKMA7ZkfBLjicel4rwxdicOxhCHN3Z1y1rTQ/0?wx_fmt=jpeg', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwNDU3NjAwMw==&mid=402303743&idx=1&sn=e9f6232ec4b8cf5e0b6faa8f89b28cbe#rd'], 2 => ['title' => '免费获取各种商品打折券,春节就要省省省。', 'des' => 'xxx', 'picurl' => 'https://mmbiz.qlogo.cn/mmbiz/3Nsx3YNMeOv6rg4at4Txeak4b9Wkiaq9ibuiamOrlB3usT9VuzibYFdAn0EFAANbic6C94U969Iy9oIqIUJa80N15cg/0?wx_fmt=jpeg', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzAwNDU3NjAwMw==&mid=402303933&idx=1&sn=9f1b157a47d14c2dee8da2c14fc6abb4#rd']];
     WechatCheck::_transmitArticleAndPic($object, $content);
 }
开发者ID:uqiauto,项目名称:wxzuan,代码行数:21,代码来源:ClickService.php

示例7: actionUnblock_user

 public function actionUnblock_user($id)
 {
     if (User::isAdmin(Yii::$app->user->identity->username)) {
         if (User::updateAll(['status' => User::STATUS_ACTIVE], ['id' => $id])) {
             return $this->redirect('/user/view');
         } else {
             throw new ForbiddenHttpException('Ошибка разблокирования пользователя', 404);
         }
     } else {
         throw new ForbiddenHttpException('У вас нет прав администратора!', 404);
     }
 }
开发者ID:Sywooch,项目名称:find-parser,代码行数:12,代码来源:UserController.php

示例8: actionChangeThemeColor

 public function actionChangeThemeColor($id)
 {
     User::updateAll(['themeId' => $id], 'id=' . Yii::$app->user->getId());
     $this->redirect('?r=site/index');
 }
开发者ID:ockor,项目名称:yii2adv-blog,代码行数:5,代码来源:SiteController.php


注:本文中的common\models\User::updateAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。