];
if ($this->front_module == 'eui') {
$this->displaySmarty('dspui/video/videoList.html');
} else {
$this->displaySmarty('dydqtshoppc/video/videoList.html');
}
}
/*
* 创建工程项目
*/
public function createProjectAction() {
$this->useLayout('dydqtshoppc-head.html');
$id = $this->request->getIntParam('id');//获取视频信息
$video_model = new App_Model_Douyin_MysqlVideoStorage();
$video_info = $video_model->getRowByIdSid($id, $this->sid);
$use_platform = empty($video_info['dv_use_platform']) ? [] : json_decode($video_info['dv_use_platform'], 1);if (!empty($video_info)) {
$video_cfg = empty($video_info['dv_platform']) ? null : json_decode($video_info['dv_platform'], 1);
}//视频混剪模式
$video_mixed_mode = plum_parse_config('project_mixed_mode','dydqt/project');$this->output['video_info'] = $video_info;
$this->output['use_platform'] = $use_platform;
$this->output['video_cfg'] = empty($video_cfg) ? null : $video_cfg;
$this->output['video_mixed_mode'] = $video_mixed_mode;
$this->output['font_map'] = (new App_Plugin_Ffmpeg_VideoPlugin())->getFontMap();
$color_list = plum_parse_config('color_list', 'config');
$this->output['color_list'] = $color_list;
//火山引擎、腾讯云配音
$huoshan_vcn = plum_parse_config('hsyq_vcn', 'system');
$tencent_vcn = plum_parse_config('txy_vcn', 'system');
$this->output['audio_vcn'] = empty($tencent_vcn) ? $huoshan_vcn : $tencent_vcn;
$this->output['platform_list'] = plum_parse_config('platform_list', 'dydqt/project');
$this->displaySmarty('dydqtshoppc/video/create-project.tpl');
}/*
* 添加/编辑视频
*/
public function addVideoAction(){
$this->useLayout('dydqtshoppc-head.html');
$id = $this->request->getIntParam('id');//获取视频信息
$Video_model = new App_Model_Douyin_MysqlVideoStorage();
$video_info = $Video_model->getRowByIdSid($id, $this->sid);//视频混剪模式
$video_mixed_mode = plum_parse_config('project_mixed_mode','dydqt/project');$this->output['video_info'] = $video_info;
$this->output['video_mixed_mode'] = $video_mixed_mode;
$this->displaySmarty('dydqtshoppc/video/addVideo.html');
}
/*
* 保存工程配置
*/
public function saveItemConfigAction() {
$dv_id = $this->request->getIntParam('dv_id');
unset($_REQUEST['q']);
unset($_REQUEST['dv_id']);
//获取视频信息
$video_model = new App_Model_Douyin_MysqlVideoStorage();
$video_info = $video_model->getRowByIdSid($dv_id, $this->sid);
if (empty($video_info)) {
$this->displayJsonError('参数错误');
}
$curr_platform = json_decode($video_info['dv_platform'], 1);
$curr_platform = is_null($curr_platform) ? [] : $curr_platform;
//发音人合集
if (isset($_REQUEST['a_vcn'])) {
$vcn = $this->request->getStrParam('a_vcn');
$vcn = explode(',', $vcn);
unset($_REQUEST['a_vcn']);
$curr_platform['vcn'] = array_combine($vcn, $vcn);
}
//随机色合集
if (isset($_REQUEST['color'])) {
$color_bg = $this->request->getArrParam('color');
$color_list = [];
foreach ($color_bg as $color => $val) {
array_push($color_list, $color);
}
unset($_REQUEST['color']);
$curr_platform['bgcolor'] = $color_list;
}
$updata['dv_platform'] = json_encode(array_merge($curr_platform, $_REQUEST));
$ret = $video_model->updateById($updata, $dv_id);
短视频矩阵源码采用的技术逻辑:
NGINX,PHP7.4,MySQL5.7,redis
就是MySQL数据库
];
$ret = $video_model->updateById($updata, $dv_id);
//更改场景组合数,则需要重新生成组合
if($video_item['dv_video_use'] != $scene){
//清空素材排列组合及缓存视频
$VideoMaterialPailie_model = new App_Model_Douyin_MysqlVideoMaterialPailieStorage();
$VideoMaterialPailie_model->clearPailie($dv_id);
//减少场景时清除视频素材
if ($scene < $video_item['dv_video_use']) {
//清除素材
$video_meta_model = new App_Model_Douyin_MysqlVideoMaterialStorage();
$vm_where = [
['name' => 'dvm_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'dvm_dv_id', 'oper' => '=', 'value' => $dv_id],
['name' => 'dvm_material_type', 'oper' => '=', 'value' => 1], //视频素材
['name' => 'dvm_scene', 'oper' => '>', 'value' => $scene],
];
$video_meta_list = $video_meta_model->getList($vm_where, 0, 0);
foreach ($video_meta_list as $item) {
$file_path = PLUM_DIR_ROOT.$item['dvm_material_videots'];
if (is_file($file_path)) {
unlink($file_path);
}
$video_meta_model->deleteById($item['dvm_id']);
}
}
}
$this->showAjaxResult($ret, '修改');
}
/*
* 素材类型输出
*/
private function output_materail_type($da_id, $type, $video_mode){
$material_model = new App_Model_Douyin_MysqlVideoMaterialStorage($this->sid);
$template_model = new App_Model_Douyin_MysqlVideoTempVideoStorage($this->sid);
$temp_video_count = $template_model->getTempVideoCountByItem($da_id);
$type_list = [
'video' => [
'type' => 1,
'title' => '视频素材('.($material_model->getMaterialCountByVideo($da_id, 1)).')',
'url' => "/dydqtshoppc/video/materialList?dv_id={$da_id}&type=1",
],