Arkadaşlar bir scriptin video post fonksiyonunu gösteren apicontroller.php den bir bölüm ;
public function postVideo(){
$this->loadModel('Video');
$this->loadModel('Sound');
$this->loadModel('Hashtag');
$this->loadModel('HashtagVideo');
$this->loadModel('User');
$this->loadModel('Notification');
$this->loadModel('Follower');
$this->loadModel('PushNotification');
if ($this->request->isPost()) {
$created = date('Y-m-d H:i:s', time());
$user_id = $this->request->data('user_id');
$description = $this->request->data('description');
$privacy_type = $this->request->data('privacy_type');
$allow_comments = $this->request->data('allow_comments');
$allow_duet = $this->request->data('allow_duet');
$video_id = $this->request->data('video_id');
$sound_id = $this->request->data('sound_id');
$hashtags_json = $this->request->data('hashtags_json');
$users_json = $this->request->data('users_json');
$duet = $this->request->data('duet');
$lang_id = $this->request->data('lang_id');
$interest_id = $this->request->data('interest_id');
$privacy_type = strtolower($privacy_type);
$data_hashtag = json_decode($hashtags_json, TRUE);
$data_users = json_decode($users_json, TRUE);
$video_userDetails = $this->User->getUserDetailsFromID($user_id);
if(count($video_userDetails) > 0) {
$type = "video";
$sound_details = $this->Sound->getDetails($sound_id);
if ($video_id > 0) {
//duet
$video_details = $this->Video->getDetails($video_id);
$video_save['duet_video_id'] = $video_details['Video']['id'];
$sound_details = $this->Sound->getDetails($video_details['Video']['sound_id']);
} else {
$video_details = array();
}
if (MEDIA_STORAGE == "s3") {
if (method_exists('Extended', 's3_video_upload')) {
$result_video = Extended::s3_video_upload($user_id, $type, $sound_details, $video_details, $duet);
if(strlen(CLOUDFRONT_URL) > 5) {
$video_url = Utility::getCloudFrontUrl($result_video['video'], "/video");
$gif_url = Utility::getCloudFrontUrl($result_video['gif'], "/gif");
$thum_url = Utility::getCloudFrontUrl($result_video['thum'], "/thum");
}else{
$video_url = $result_video['video'];
$gif_url = $result_video['gif'];
$thum_url = $result_video['thum'];
}
} else {
$output['code'] = 201;
$output['msg'] = "It seems like you do not have extended files. submit ticket on yeahhelp.com for support";
echo json_encode($output);
die();
}
} else {
$result_video = Regular::local_video_upload($user_id, $type, $sound_details, $video_details, $duet);
$video_url = $result_video['video'];
$gif_url = $result_video['gif'];
$thum_url = $result_video['thum'];
}
$video_save['sound_id'] = $sound_id;
if (count($result_video) > 0) {
$video_duration = Utility::getDurationOfVideoFile($result_video['video']);
if (strlen($result_video['audio']) > 2) {
$audio_url = Utility::getCloudFrontUrl($result_video['audio'], "/audio");
$duration = Utility::getDurationofAudioFile($result_video['audio']);
$sound_date['audio'] = $audio_url;
$sound_date['duration'] = $duration;
$sound_date['thum'] = $video_userDetails['User']['profile_pic'];
$sound_date['name'] = "original sound - " . $video_userDetails['User']['username'];
$sound_date['uploaded_by'] = "user";
$this->Sound->save($sound_date);
$sound_id = $this->Sound->getInsertID();
$video_save['sound_id'] = $sound_id;
}
//$filepath_thumb = Utility::multipartFileUpload($user_id, 'thumb',$type);
$video_save['gif'] = $gif_url;
$video_save['duration'] = $video_duration;
$video_save['video'] = $video_url;
$video_save['lang_id'] = $lang_id;
$video_save['thum'] = $thum_url;
$video_save['description'] = $description;
$video_save['privacy_type'] = $privacy_type;
$video_save['allow_comments'] = $allow_comments;
$video_save['allow_duet'] = $allow_duet;
$video_save['user_id'] = $user_id;
$video_save['interest_id'] = $interest_id;
$video_save['created'] = $created;
if($user_id < 1){
Message::EMPTYDATA();
die();
}
if (!$this->Video->save($video_save)) {
echo Message:

ATASAVEERROR();
die();
}
$video_id = $this->Video->getInsertID();
bu fonksiyon kullanıcıların video post etmesini sağlıyor.database de "user" tablosu ve "video"tablosu var."video" tablosunda "block" sütunu yer alıyor."block" değeri 1 veya 0.Video yüklenirken default değeri 1."user" tablosunda ise "verified" sütunu yer alıyor bununda yine değeri 1 veya 0.default değeri 0.
şöyle birşeye ihtiyacımız var.
kullanıcı video post yaparken user verified durumu 1 ise videonun block değerine database e 0 olarak göndermek istiyoruz.özellikle belirtmek istediğim 2 nokta var ;
- videoların block değeri default olarak 1
- kodda görebileceğiniz gibi videoların depolama seçeneği için S3 yer alıyor ve biz s3 kullanıyoruz.
ücretli ücretsiz desteğe açığız.
geliştirici arayanlar başlığında ücretli olarak destek olabilirsiniz.
soru , cron jobla yapsak olur mu ? cevap "
kullanıcı video post yaparken user verified durumu 1 ise videonun block değerine database e 0 olarak göndermek istiyoruz"
ayrı bir dosya ile sorgu yaptırsak olurmu ? cevap "
kullanıcı video post yaparken user verified durumu 1 ise videonun block değerine database e 0 olarak göndermek istiyoruz"
https://www.r10.net/kodlama-isi-vere...nleme-isi.html