|
...
|
...
|
@@ -12,6 +12,7 @@ namespace App\Services; |
|
|
|
use App\Helper\Translate;
|
|
|
|
use App\Models\Project\ProjectAiSetting;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
|
|
|
|
class AiBlogService
|
|
|
|
{
|
|
...
|
...
|
@@ -36,6 +37,13 @@ class AiBlogService |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :设置路由
|
|
|
|
* @name :setRoute
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/3/25 9:45
|
|
|
|
*/
|
|
|
|
public function setRoute($keyword)
|
|
|
|
{
|
|
|
|
$this->route = generateRoute(Translate::tran($keyword, 'en'));
|
|
...
|
...
|
@@ -52,11 +60,7 @@ class AiBlogService |
|
|
|
public function createProject($project_name,$language,$profile,$company){
|
|
|
|
$request_url = $this->url.'api/project/create';
|
|
|
|
$param = [
|
|
|
|
'mch_id'=>$this->mch_id,
|
|
|
|
'title'=>$project_name,
|
|
|
|
'language'=>$language,
|
|
|
|
'profile'=>$profile,
|
|
|
|
'company'=>$company,
|
|
|
|
'mch_id'=>$this->mch_id, 'title'=>$project_name, 'language'=>$language, 'profile'=>$profile, 'company'=>$company,
|
|
|
|
];
|
|
|
|
$this->sign = $this->generateSign($param,$this->key);
|
|
|
|
$param['sign'] = $this->sign;
|
|
...
|
...
|
@@ -73,13 +77,7 @@ class AiBlogService |
|
|
|
*/
|
|
|
|
public function updatedProject($project_name,$language,$profile,$company){
|
|
|
|
$request_url = $this->url.'api/project/save';
|
|
|
|
$param = [
|
|
|
|
'mch_id'=>$this->mch_id,
|
|
|
|
'title'=>$project_name,
|
|
|
|
'language'=>$language,
|
|
|
|
'profile'=>$profile,
|
|
|
|
'company'=>$company,
|
|
|
|
];
|
|
|
|
$param = ['mch_id'=>$this->mch_id, 'title'=>$project_name, 'language'=>$language, 'profile'=>$profile, 'company'=>$company];
|
|
|
|
$this->sign = $this->generateSign($param,$this->key);
|
|
|
|
$param['sign'] = $this->sign;
|
|
|
|
$result = http_post($request_url,json_encode($param,true));
|
|
...
|
...
|
@@ -92,19 +90,11 @@ class AiBlogService |
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/2/13 14:39
|
|
|
|
* @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url
|
|
|
|
* @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url , title=标题
|
|
|
|
*/
|
|
|
|
public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = []){
|
|
|
|
public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = [],$title = ''){
|
|
|
|
$request_url = $this->url.'api/task/create';
|
|
|
|
$param = [
|
|
|
|
'keyword'=>$keyword,
|
|
|
|
'type'=>$type,
|
|
|
|
'subtype'=>$subtype,
|
|
|
|
];
|
|
|
|
$param['anchor'] = $anchor;
|
|
|
|
$param['url'] = $this->route;
|
|
|
|
$param['mch_id'] = $this->mch_id;
|
|
|
|
$param['template_id'] = 1;
|
|
|
|
$param = ['keyword'=>$keyword, 'type'=>$type, 'subtype'=>$subtype,'anchor'=>$anchor,'title'=>$title,'url'=>$this->route,'mch_id'=>$this->mch_id,'template_id'=>1];
|
|
|
|
$this->sign = $this->generateSign($param,$this->key);
|
|
|
|
$param['sign'] = $this->sign;
|
|
|
|
$result = http_post($request_url,json_encode($param,true));
|
|
...
|
...
|
@@ -120,9 +110,7 @@ class AiBlogService |
|
|
|
*/
|
|
|
|
public function createAuthor(){
|
|
|
|
$request_url = $this->url.'api/author/create';
|
|
|
|
$param = [
|
|
|
|
'mch_id'=>$this->mch_id,
|
|
|
|
];
|
|
|
|
$param = ['mch_id'=>$this->mch_id];
|
|
|
|
$this->sign = $this->generateSign($param,$this->key);
|
|
|
|
$param['sign'] = $this->sign;
|
|
|
|
$result = http_post($request_url,json_encode($param,true));
|
...
|
...
|
|