本文整理汇总了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);
}