正在显示
1 个修改的文件
包含
13 行增加
和
24 行删除
| @@ -12,6 +12,7 @@ namespace App\Services; | @@ -12,6 +12,7 @@ namespace App\Services; | ||
| 12 | use App\Helper\Translate; | 12 | use App\Helper\Translate; |
| 13 | use App\Models\Project\ProjectAiSetting; | 13 | use App\Models\Project\ProjectAiSetting; |
| 14 | use Illuminate\Database\Eloquent\Model; | 14 | use Illuminate\Database\Eloquent\Model; |
| 15 | +use Illuminate\Support\Facades\Cache; | ||
| 15 | 16 | ||
| 16 | class AiBlogService | 17 | class AiBlogService |
| 17 | { | 18 | { |
| @@ -36,6 +37,13 @@ class AiBlogService | @@ -36,6 +37,13 @@ class AiBlogService | ||
| 36 | } | 37 | } |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | + /** | ||
| 41 | + * @remark :设置路由 | ||
| 42 | + * @name :setRoute | ||
| 43 | + * @author :lyh | ||
| 44 | + * @method :post | ||
| 45 | + * @time :2025/3/25 9:45 | ||
| 46 | + */ | ||
| 39 | public function setRoute($keyword) | 47 | public function setRoute($keyword) |
| 40 | { | 48 | { |
| 41 | $this->route = generateRoute(Translate::tran($keyword, 'en')); | 49 | $this->route = generateRoute(Translate::tran($keyword, 'en')); |
| @@ -52,11 +60,7 @@ class AiBlogService | @@ -52,11 +60,7 @@ class AiBlogService | ||
| 52 | public function createProject($project_name,$language,$profile,$company){ | 60 | public function createProject($project_name,$language,$profile,$company){ |
| 53 | $request_url = $this->url.'api/project/create'; | 61 | $request_url = $this->url.'api/project/create'; |
| 54 | $param = [ | 62 | $param = [ |
| 55 | - 'mch_id'=>$this->mch_id, | ||
| 56 | - 'title'=>$project_name, | ||
| 57 | - 'language'=>$language, | ||
| 58 | - 'profile'=>$profile, | ||
| 59 | - 'company'=>$company, | 63 | + 'mch_id'=>$this->mch_id, 'title'=>$project_name, 'language'=>$language, 'profile'=>$profile, 'company'=>$company, |
| 60 | ]; | 64 | ]; |
| 61 | $this->sign = $this->generateSign($param,$this->key); | 65 | $this->sign = $this->generateSign($param,$this->key); |
| 62 | $param['sign'] = $this->sign; | 66 | $param['sign'] = $this->sign; |
| @@ -73,13 +77,7 @@ class AiBlogService | @@ -73,13 +77,7 @@ class AiBlogService | ||
| 73 | */ | 77 | */ |
| 74 | public function updatedProject($project_name,$language,$profile,$company){ | 78 | public function updatedProject($project_name,$language,$profile,$company){ |
| 75 | $request_url = $this->url.'api/project/save'; | 79 | $request_url = $this->url.'api/project/save'; |
| 76 | - $param = [ | ||
| 77 | - 'mch_id'=>$this->mch_id, | ||
| 78 | - 'title'=>$project_name, | ||
| 79 | - 'language'=>$language, | ||
| 80 | - 'profile'=>$profile, | ||
| 81 | - 'company'=>$company, | ||
| 82 | - ]; | 80 | + $param = ['mch_id'=>$this->mch_id, 'title'=>$project_name, 'language'=>$language, 'profile'=>$profile, 'company'=>$company]; |
| 83 | $this->sign = $this->generateSign($param,$this->key); | 81 | $this->sign = $this->generateSign($param,$this->key); |
| 84 | $param['sign'] = $this->sign; | 82 | $param['sign'] = $this->sign; |
| 85 | $result = http_post($request_url,json_encode($param,true)); | 83 | $result = http_post($request_url,json_encode($param,true)); |
| @@ -92,18 +90,11 @@ class AiBlogService | @@ -92,18 +90,11 @@ class AiBlogService | ||
| 92 | * @author :lyh | 90 | * @author :lyh |
| 93 | * @method :post | 91 | * @method :post |
| 94 | * @time :2025/2/13 14:39 | 92 | * @time :2025/2/13 14:39 |
| 95 | - * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url , $title = '' | 93 | + * @param :type=(1作者2文章) keyword=关键词 subtype=blog url=回调url , title=标题 |
| 96 | */ | 94 | */ |
| 97 | public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = [],$title = ''){ | 95 | public function createTask($keyword,$type = 2,$subtype = 'Blog',$anchor = [],$title = ''){ |
| 98 | $request_url = $this->url.'api/task/create'; | 96 | $request_url = $this->url.'api/task/create'; |
| 99 | - $param = ['keyword'=>$keyword, 'type'=>$type, 'subtype'=>$subtype,]; | ||
| 100 | - if(!empty($title)){ | ||
| 101 | - $param['title'] = $title; | ||
| 102 | - } | ||
| 103 | - $param['anchor'] = $anchor; | ||
| 104 | - $param['url'] = $this->route; | ||
| 105 | - $param['mch_id'] = $this->mch_id; | ||
| 106 | - $param['template_id'] = 1; | 97 | + $param = ['keyword'=>$keyword, 'type'=>$type, 'subtype'=>$subtype,'anchor'=>$anchor,'title'=>$title,'url'=>$this->route,'mch_id'=>$this->mch_id,'template_id'=>1]; |
| 107 | $this->sign = $this->generateSign($param,$this->key); | 98 | $this->sign = $this->generateSign($param,$this->key); |
| 108 | $param['sign'] = $this->sign; | 99 | $param['sign'] = $this->sign; |
| 109 | $result = http_post($request_url,json_encode($param,true)); | 100 | $result = http_post($request_url,json_encode($param,true)); |
| @@ -119,9 +110,7 @@ class AiBlogService | @@ -119,9 +110,7 @@ class AiBlogService | ||
| 119 | */ | 110 | */ |
| 120 | public function createAuthor(){ | 111 | public function createAuthor(){ |
| 121 | $request_url = $this->url.'api/author/create'; | 112 | $request_url = $this->url.'api/author/create'; |
| 122 | - $param = [ | ||
| 123 | - 'mch_id'=>$this->mch_id, | ||
| 124 | - ]; | 113 | + $param = ['mch_id'=>$this->mch_id]; |
| 125 | $this->sign = $this->generateSign($param,$this->key); | 114 | $this->sign = $this->generateSign($param,$this->key); |
| 126 | $param['sign'] = $this->sign; | 115 | $param['sign'] = $this->sign; |
| 127 | $result = http_post($request_url,json_encode($param,true)); | 116 | $result = http_post($request_url,json_encode($param,true)); |
-
请 注册 或 登录 后发表评论