抖音seo矩阵系统源代码分享

一、  用到的API列表(部分)

用户管理

API

描述

获取用户公开信息

该接口获取用户的抖音公开信息,包含昵称、头像、性别和地区。

适用于抖音。

粉丝判断

开发者应用下授权的抖音账号可根据其他用户的 openid 判断其是否关注了当前抖音账号,即为当前抖音账号的粉丝。

视频管理

API

描述

查询授权账号视频列表

该接口用于分页获取用户所有视频的数据,返回的数据是实时的。

查询特定视频的视频数据

该接口用于查询用户特定视频的数据,如点赞数、播放数等,返回的数据是实时的。

查询视频分享结果及数据

该接口用获取 share_id。

查询视频携带的地点信息

该接口用于查询 POI 信息。

互动管理

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);

技术开发注意事项:

  1. 确定业务需求:在开发前,需要明确抖音矩阵系统的业务需求,了解用户的需求和使用习惯,明确系统的功能、性能和安全需求。

  2. 选择合适的技术方案:根据系统的需求和复杂度,选择合适的开发语言和技术框架,确保系统可以高效、稳定地运行,并且易于维护。

  3. 设计可扩展的架构:抖音矩阵系统需要支持大量的用户和数据处理,因此需要设计一个可扩展的架构,以便在需要时可以方便地扩展系统的容量和性能。

  4. 保证数据安全:抖音矩阵系统需要处理大量的用户数据,因此需要采取多重安全措施,包括加密存储、访问控制、漏洞扫描等,确保用户数据的安全性。

  5. 优化系统性能:为了提高系统的性能,可以采用多种优化技术,包括缓存、负载均衡、异步处理等,以确保系统的响应速度和吞吐量。

  6. 测试和调试:在开发和部署系统之前,需要对系统进行全面的测试和调试,以确保系统的稳定性、安全性和性能优化。

  7. 持续集成和部署:由于抖音矩阵系统需要不断更新和发布,因此需要采用持续集成和部署技术,确保系统的发布过程和质量控制。

猜你喜欢

转载自blog.csdn.net/wangwentao611/article/details/131382107