當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::getUidByClientId方法代碼示例

本文整理匯總了PHP中frontend\models\User::getUidByClientId方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getUidByClientId方法的具體用法?PHP User::getUidByClientId怎麽用?PHP User::getUidByClientId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在frontend\models\User的用法示例。


在下文中一共展示了User::getUidByClientId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeSave


//.........這裏部分代碼省略.........
         if ($snapshotNeeded) {
             sleep(5);
             echo shell_exec(Yii::$app->params['ffmpeg']['path'] . '/' . 'ffmpeg -ss 00:00:02 -i "' . $this->tmpDir . '/' . $baseName . '.' . $baseExt . '" -f image2 -vframes 1 "' . $this->tmpDir . '/' . $baseName . '.png"');
         }
         $imgToUpload = "{$this->tmpDir}/{$baseName}.png";
         $snapshot = $this->newFileName . '.png';
     }
     if ($this->api) {
         // TODO
     } else {
         $this->user_id = Yii::$app->user->id;
         if ($movie != "") {
             // Сохраниение видео на s3
             $s3 = new S3Client(Yii::$app->params['s3']);
             $result = $s3->putObject(['Bucket' => 'razzd1', 'Key' => $movie, 'Body' => fopen($fileToUpload, 'r'), 'ACL' => 'public-read']);
             if (!$result) {
                 Yii::$app->getSession()->setFlash('error', 'There was an error uploading the file to cloud storage.');
                 return;
             } else {
                 $this->url = $result->search('ObjectURL');
             }
             // Сохраниение превьюшки на s3
             if (file_exists($imgToUpload)) {
                 $result2 = $s3->putObject(['Bucket' => 'razzd1', 'Key' => $snapshot, 'Body' => fopen($imgToUpload, 'r'), 'ACL' => 'public-read']);
             } else {
             }
             if ($result2) {
                 $this->preview = $result2->search('ObjectURL');
             }
         }
     }
     if (!$insert) {
         // Respond to existing one
         if (!$this->pureUpdate) {
             $this->responder_uid = $this->user_id;
             if ($movie != "") {
                 $this->responder_stream = $this->url;
                 $this->responder_stream_preview = $this->preview;
             } else {
                 $this->responder_stream = $this->fileName;
             }
             $this->hash = null;
         }
     } else {
         // Create new one
         $this->uid = $this->user_id;
         if ($movie != "") {
             $this->stream = $this->url;
             $this->stream_preview = $this->preview;
         } else {
             // Ziggeo
             $this->stream = $this->fileName;
         }
         // SomeOne через аккаунт сайта - отправка майла
         if ($this->type == 1 && !$this->fb_friend) {
             $this->hash = md5(time() . $this->email);
             $this->sendMail = true;
             $user = \frontend\models\User::findOne(['email' => $this->email]);
             if ($user) {
                 $this->responder_uid = $user->id;
             }
         }
         /*
         if( $this->fileName != "" ){
             $this->stream_preview = \common\helpers\Ziggeo::getPreview($this->fileName);
         }
         */
         // SomeOne через социальную сеть
         if ($this->type == 1 && $this->fb_friend) {
             $this->hash = md5(time() . $this->fb_friend);
             $user_id = \frontend\models\User::getUidByClientId($this->fb_friend);
             if ($user_id) {
                 // Шлём razzd внешнему пользователю, который уже есть в базе
                 $this->responder_uid = $user_id;
             } else {
                 // Razzd незарегистрированному внешнему пользователю
                 $this->facebook_id = $this->fb_friend;
             }
         }
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.png")) {
         unlink("{$this->tmpDir}/{$baseName}.png");
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.jpg")) {
         unlink("{$this->tmpDir}/{$baseName}.jpg");
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.wav")) {
         unlink("{$this->tmpDir}/{$baseName}.wav");
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.mp3")) {
         unlink("{$this->tmpDir}/{$baseName}.mp3");
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.mp4")) {
         unlink("{$this->tmpDir}/{$baseName}.mp4");
     }
     if (file_exists("{$this->tmpDir}/{$baseName}.webm")) {
         unlink("{$this->tmpDir}/{$baseName}.webm");
     }
     return parent::beforeSave($insert);
 }
開發者ID:babagay,項目名稱:razzd,代碼行數:101,代碼來源:Razz.php


注:本文中的frontend\models\User::getUidByClientId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。