AiVideoService.php 1.1 KB
<?php
/**
 * @remark :
 * @name   :AiVideoService.php
 * @author :lyh
 * @method :post
 * @time   :2025/4/29 17:39
 */

namespace App\Services;

use App\Helper\Translate;
use App\Models\Project\ProjectAiSetting;

class AiVideoService
{
    public $url = 'https://ai-extend.ai.cc/';

    public $mch_id = 1;//默认配置
    public $sign = '';//签名
    public $key = 'b3e4c722b821';//默认key
    public $route = '';//回调地址
    public $task_id = '';//任务id
    public $author_id = '';//作者id

    public function __construct($project_id = 0)
    {
        if($project_id){
            $projectAiSettingModel = new ProjectAiSetting();
            $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
            $this->mch_id = $aiSettingInfo['mch_id'];
            $this->key = $aiSettingInfo['key'];
        }
    }

    /**
     * @remark :设置路由
     * @name   :setRoute
     * @author :lyh
     * @method :post
     * @time   :2025/3/25 9:45
     */
    public function setRoute($keyword)
    {
        $this->route = generateRoute(Translate::tran($keyword, 'en'));
        return $this;
    }
}