短视频矩阵系统源码搭建-----源代码分享:
ctive_model = new App_Model_Douyin_MysqlActiveStorage();
$active_info = $active_model->getRowByIdSid($da_id, $this->sid);
if (!empty($active_info)) {
$material_model = new App_Model_Douyin_MysqlActiveMaterialStorage();
$add_data = [
'dam_aa_id' => $this->manager['ds_agent_id'],
'dam_ds_id' => $this->sid,
'dam_da_id' => $da_id,
'dam_material_name' => $indata['dsa_real_name'],
'dam_material_type' => $file_type == 'audio' ? 2 : 1,
'dam_material_content' => $audio_path,
'dam_video_mixed_mode' => $active_info['da_video_mode'],
'dam_duration' => $indata['dsa_duration'],
'dam_video_is_deal' => 1,
'dam_create_time' => time(),
'dam_update_time' => time(),
];
$material_model->insertValue($add_data);
}
}
$this->showAjaxResult($aid, '添加到素材库');
}
/*
* 下载音频
*/
public function downAudioAction() {
$file_path = $this->request->getStrParam('audio_path');
$save_path = PLUM_DIR_ROOT.$file_path;
if (!file_exists($save_path)) {
$this->displayJsonError('音频文件不存在');
}
$extent = pathinfo($file_path, PATHINFO_EXTENSION);
$file_size = filesize($save_path);
$file_name = plum_random_code().".".$extent;
header("Content-type:audio/mpeg");
header("Accept-Ranges:bytes");
header("Accept-Length:$file_size");
header("Content-Disposition:attachment;filename={$file_name}");
readfile($save_path);
exit();
}
/*
* 下载视频
*/
public function downVideoAction() {
$file_path = $this->request->getStrParam('video_path');
$save_path = PLUM_DIR_ROOT.$file_path;
if (!file_exists($save_path)) {
$this->displayJsonError('视频文件不存在');
}
$extent = pathinfo($file_path, PATHINFO_EXTENSION);
$file_size = filesize($save_path);
$file_name = plum_random_code().".".$extent;
header("Content-type:video/mp4");
header("Accept-Ranges:bytes");
header("Accept-Length:$file_size");
header("Content-Disposition:attachment;filename={$file_name}");
readfile($save_path);
exit();
}
/*
* 抖音热门歌曲榜
*/
public function hotMusicAction() {
$this->useLayout('dydqtshoppc-head.html');
$add_type = $this->request->getStrParam('add_type', 'project');
$video_id = $this->request->getIntParam('video_id', 0);
$channel = $this->request->getStrParam('channel', 'hot');
$tab_bar = [
'hot' => ['name' => '热歌榜', 'url' => "/dydqtshoppc/video/hotMusic/channel/hot?add_type={$add_type}&video_id=".$video_id, 'this' => false],
'soar' => ['name' => '飙升榜', 'url' => "/dydqtshoppc/video/hotMusic/channel/soar?add_type={$add_type}&video_id=".$video_id, 'this' => false],
'ori' => ['name' => '原创榜', 'url' => "/dydqtshoppc/video/hotMusic/channel/ori?add_type={$add_type}&video_id=".$video_id, 'this' => false],
];
foreach ($tab_bar as $key => &$item) {
if ($channel == $key) {
$item['this'] = true;
break;
}
}
$helper = new App_Helper_Douyin();
$music = $helper->getHotMusic(50, $channel);
$this->output['tab_bar'] = $tab_bar;
$this->output['music_list'] = $music['music_list'];
$this->output['release_date'] = $music['release_date'];
$this->output['video_id'] = $video_id;
$this->output['add_type'] = $add_type;
$this->displaySmarty('dydqtshoppc/video/hotMusic.tpl');
}
/*
* 素材分类管理
*/
public function attachmentAction($from='web') {
$type = $this->request->getIntParam('type', 3);//素材类型,1图片,2音频,3视频
if ($from == 'select') {
$this->useLayout('dydqtshoppc-head.html');
} else {
//面包屑
$breadcrumbs = [
['title' => 'AI视频创意', 'link' => '#tctk'],