一、 用到的API列表(部分)
用户管理
视频管理
互动管理
二、视频批量生成,文字转语音部分
$breadcrumbs = [
['title' => 'AI视频创意', 'link' => '#'],
['title' => '开始创作', 'link' => ''],
];
$this->buildBreadcrumbs($breadcrumbs);
//搜索专用
$keyword_type = $this->request->getStrParam('keyword_type');
$keyword = $this->request->getStrParam('keyword');
$this->output['keyword_type'] = $keyword_type;
$this->output['keyword'] = $keyword;
$dv_id = $this->request->getIntParam('dv_id'); //视频工程ID
$this->output['dv_id'] = $dv_id;
$type = $this->request->getIntParam('type', 0); //素材类型
$scene = $this->request->getIntParam('scene', 1);
$this->output['scene'] = $scene;
//获取视频信息
$video_model = new App_Model_Douyin_MysqlVideoStorage();
$video_info = $video_model->getRowByIdSid($dv_id, $this->sid);
if (empty($video_info)) {
plum_redirect_with_msg('视频创意工程不存在');
}
$mixed_video_mode = $video_info['dv_video_mode'];
if (in_array($mixed_video_mode, [11])) { //智能图片组合
$type = in_array($type, [0, 1]) ? 3 : $type; //默认为图片素材类型
} else {
$type = in_array($type, [0, 3]) ? 1 : $type; //默认为视频素材类型
}
//获取素材列表
$where = [
['name' => 'dvm_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'dvm_dv_id', 'oper' => '=', 'value' => $dv_id],
['name' => 'dvm_material_type', 'oper' => '=', 'value' => $type]
];
//视频类型,区分混剪模式
if ($type == 1) {
$where[] = ['name' => 'dvm_video_mixed_mode', 'oper' => '=', 'value' => $video_info['dv_video_mode']];
}
if (!empty($keyword_type)) {
$where[] = ['name' => $keyword_type, 'oper' => 'like', 'value' => "%{$keyword}%"];
}
//智能场景组合,视频素材加场景值筛选
if ($type == 1 && $mixed_video_mode == 4) {
$scene_model = new App_Model_Douyin_MysqlVideoSceneStorage();
$scene_count = $scene_model->getCountByDvid($dv_id);
if ($scene_count == 0 && $video_info['dv_video_use'] > 0) {
for ($i = 1; $i <= $video_info['dv_video_use']; $i++) {
$indata = [
'dvs_ds_id' => $this->sid,
'dvs_dv_id' => $dv_id,
'dvs_name' => "场景" . $i,
'dvs_duration' => $video_info['dv_video_shot'] * 1000,
'dvs_
三、同城拓客,扫码发视频关键词投稿布局
$platform = $this->request->getStrParam('platform','douyin'); //平台类型:douyin、kuaishou
//携带状态
$state = ['active_id' => $id];
/************生成活动推广url************/
//抖音开放平台二维码
if($platform == 'douyin'){
$plugin = new App_Plugin_Douyin_OpenPlugin($this->manager['ds_agent_id']);
$app_info = $plugin->getAppInfo();
$redirect_uri = $app_info['douyin_domain'].'/dydqtclient/user/userLogin';
$scope = $app_info['publish_scope'];
$url = $plugin->getOauthCode($redirect_uri, $scope, json_encode($state));
}
//快手开放平台二维码
if($platform == 'kuaishou'){
$plugin = new App_Plugin_Kuaishou_OpenPlugin($this->manager['ds_agent_id']);
$app_info = $plugin->getAppInfo();
$redirect_uri = $app_info['kuaishou_domain'].'/dydqtclient/user/kuaishouUserLogin';
$scope = 'user_info,user_base,user_video_publish,user_video_info';
$url = $plugin->getWebOauthCode($redirect_uri, $scope, json_encode($state));
}
//输出二维码图片
$outfile_arr = $this->makeQrcodePath($id,$platform);
$uri = self::GATEWAY.'/platform/oauth/connect/';
$scope = trim($scope, ',');
$params = [
'client_key' => $this->client_key,
'response_type' => 'code',
'scope' => $scope,
'redirect_uri' => $redirect_uri,
];
if (!is_null($state))
$params['state'] = $state;
$code = $uri."?".http_build_query($params);
return $code;
四、 企业号私信管理/群聊管理/意向客户管理
$daid = $this->request->getIntParam('daid', 0);
//应用类型输出
$where = [
['name' => 'cl_ds_id', 'oper' => '=', 'value' => $this->sid],
];
if (!empty($daid)) {
$where[] = ['name' => 'dl_qyh_uid', 'oper' => '=', 'value' => $daid];
}
$this->output['enter_id'] = $daid;
$sort = ['cl_create_time' => 'DESC'];
$chat_list_model = new App_Model_Douyin_MysqlChatListStorage();
$chat_result = $chat_list_model->getList($where, $this->index, $this->count, $sort);
$intent_model = new App_Model_Douyin_MysqlIntentUserStorage();
#$account_model = new App_Model_Douyin_MysqlDyAccountStorage();
$chat_list = [];
foreach ($chat_result as $item) {
#$account = $account_model->getRowByIdSid($item['cl_qyh_uid'], $this->sid);
$intention = $intent_model->getUserByOpenId($this->sid, $item['cl_from_openid']);
$each = [
'user_nickname' => empty($intention) ? '匿名' : $intention['iu_nickname'],
'user_avatar' => empty($intention) ? parent::TEMPLATE_PLACEHOLDER_IMAGE : $intention['iu_avatar'],
'user_newmsg' => $item['cl_new_text'],
'user_newtime' => date('Y-m-d H:i:s', $item['cl_new_time']),
'user_openid' => $item['cl_from_openid'],
'qyh_uid' => $item['cl_qyh_uid'],
'undo_count' => $item['cl_undo_count'],
];
array_push($chat_list, $each);
}
$this->displayJson($chat_list);
$from_openid = $this->request->getStrParam('from_openid');
$qyh_uid = $this->request->getIntParam('qyh_uid');
$letter_model = new App_Model_Douyin_MysqlLetterStorage();
$detail_result = $letter_model->getChatListOrder($from_openid, $qyh_uid, $this->sid, $this->index, $this->count);
$chat_detail = [];
foreach ($detail_result as $item) {
$each = [
'msg_type' => $item['dl_msg_type'],
'msg_content' => $item['dl_msg_content'],
'msg_time' => date('Y-m-d H:i:s', $item['dl_create_time']),
'send_receive' => intval($item['dl_send_receive']), //1收到的消息,2发送的消息
];
array_push($chat_detail, $each);
}
$account_model = new App_Model_Douyin_MysqlDyAccountStorage();
$qyh_account = $account_model->getRowByIdSid($qyh_uid, $this->sid);
$intent_model = new App_Model_Douyin_MysqlIntentUserStorage();
$from_account = $intent_model->getUserByOpenId($this->sid, $from_openid, $qyh_uid);
$return_data = [
'from_user' => [
'nickname' => empty($from_account) ? '匿名' : $from_account['iu_nickname'],
'avatar' => empty($from_account) ? parent::TEMPLATE_PLACEHOLDER_IMAGE : $from_account['iu_avatar'],
'openid' => $from_openid,
],
'to_user' => [
'nickname' => $qyh_account['da_nickname'],
'avatar' => $qyh_account['da_avatar'],
'qyh_uid' => $qyh_uid,
],
'chat_detail' => $chat_detail
];
$chat_list_model = new App_Model_Douyin_MysqlChatListStorage();
$cl_where = [
['name' => 'cl_ds_id', 'oper' => '=', 'value' => $this->sid],
['name' => 'cl_qyh_uid', 'oper' => '=', 'value' => $qyh_uid],
['name' => 'cl_from_openid', 'oper' => '=', 'value' => $from_openid],
];
$chat_list_model->updateValue(['cl_undo_count' => 0], $cl_where);
$this->displayJson($return_data);
技术开发注意事项:
-
确定业务需求:在开发前,需要明确抖音矩阵系统的业务需求,了解用户的需求和使用习惯,明确系统的功能、性能和安全需求。
-
选择合适的技术方案:根据系统的需求和复杂度,选择合适的开发语言和技术框架,确保系统可以高效、稳定地运行,并且易于维护。
-
设计可扩展的架构:抖音矩阵系统需要支持大量的用户和数据处理,因此需要设计一个可扩展的架构,以便在需要时可以方便地扩展系统的容量和性能。
-
保证数据安全:抖音矩阵系统需要处理大量的用户数据,因此需要采取多重安全措施,包括加密存储、访问控制、漏洞扫描等,确保用户数据的安全性。
-
优化系统性能:为了提高系统的性能,可以采用多种优化技术,包括缓存、负载均衡、异步处理等,以确保系统的响应速度和吞吐量。
-
测试和调试:在开发和部署系统之前,需要对系统进行全面的测试和调试,以确保系统的稳定性、安全性和性能优化。
-
持续集成和部署:由于抖音矩阵系统需要不断更新和发布,因此需要采用持续集成和部署技术,确保系统的发布过程和质量控制。