作者 赵彬吉
@@ -57,36 +57,15 @@ class lyhDemo extends Command @@ -57,36 +57,15 @@ class lyhDemo extends Command
57 57
58 public function handle(){ 58 public function handle(){
59 $projectModel = new Project(); 59 $projectModel = new Project();
60 - $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']); 60 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
61 foreach ($lists as $item){ 61 foreach ($lists as $item){
62 - echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; 62 +// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
63 ProjectServer::useProject($item['id']); 63 ProjectServer::useProject($item['id']);
64 - $authorModel = new AiBlogAuthor();  
65 - $author_list = $authorModel->list(['id'=>['>',0]]);  
66 - if(empty($author_list)){  
67 - echo '跳过的项目id:'.$item['id'].PHP_EOL;  
68 - DB::disconnect('custom_mysql');  
69 - continue;  
70 - }  
71 - $projectAiSettingModel = new ProjectAiSetting();  
72 - $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$item['id']]);  
73 - if($aiSettingInfo === false){  
74 - echo '跳过的项目id:'.$item['id'].PHP_EOL;  
75 - DB::disconnect('custom_mysql');  
76 - continue;  
77 - }  
78 - $aiBlogService = new AiBlogService($item['id']);  
79 - foreach ($author_list as $val){  
80 - $aiBlogService->author_id = $val['author_id'];  
81 - $result = $aiBlogService->getAuthorDetail();  
82 - if(isset($result['status']) && $result['status'] == 200){  
83 - //当前作者的页面  
84 - $aiBlogAuthorModel = new AiBlogAuthor();  
85 - $authorInfo = $aiBlogAuthorModel->read(['author_id'=>$val['author_id']],['id','route']);  
86 - if($authorInfo !== false && !empty($result['data']['section'])){  
87 - $aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$val['author_id']]);  
88 - }  
89 - } 64 + $webSettingModel = new WebSetting();
  65 + $info = $webSettingModel->read(['project_id'=>$item['id']]);
  66 + if($info === false){
  67 + $webSettingModel->addReturnId(['project_id'=>$item['id']]);
  68 + echo '当前数据为空:'.$item['id'].PHP_EOL;
90 } 69 }
91 DB::disconnect('custom_mysql'); 70 DB::disconnect('custom_mysql');
92 } 71 }
@@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic @@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic
24 public function setting_read(){ 24 public function setting_read(){
25 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 25 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
26 if($info === false){ 26 if($info === false){
27 - $info = []; 27 + $this->model->addReturnId(['project_id'=>$this->user['project_id']]);
  28 + $info =$this->model->read(['project_id'=>$this->user['project_id']]);
28 } 29 }
29 return $this->success($info); 30 return $this->success($info);
30 } 31 }
1 <?php 1 <?php
2 -/**  
3 - * @remark :  
4 - * @name :AiCommandService.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2025/5/26 17:01  
8 - */  
9 -  
10 namespace App\Services; 2 namespace App\Services;
11 3
12 /** 4 /**
13 - * @remark :AI指令返回数据  
14 - * @name :AiCommandService  
15 - * @author :lyh  
16 - * @method :post  
17 - * @time :2025/5/26 17:01 5 + * Class AiCommandService
  6 + * @package App\Services
18 */ 7 */
19 class AiCommandService 8 class AiCommandService
20 { 9 {
@@ -22,16 +11,22 @@ class AiCommandService @@ -22,16 +11,22 @@ class AiCommandService
22 11
23 public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg'; 12 public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
24 13
  14 + /**
  15 + * @var string gemini 模型
  16 + * https://gemini.google.com/app
  17 + * gemini-2.0-flash-lite
  18 + * gemini-2.5-pro-preview-05-06
  19 + * gemini-2.5-flash-preview-05-20
  20 + * gemini-2.5-flash-preview-04-17
  21 + */
25 public $model = 'gemini-2.0-flash-lite'; 22 public $model = 'gemini-2.0-flash-lite';
26 23
27 public $supplier = 'google'; 24 public $supplier = 'google';
28 25
29 /** 26 /**
30 - * @remark :Ai一键排版  
31 - * @name :ai_click_layout  
32 - * @author :lyh  
33 - * @method :post  
34 - * @time :2025/5/26 17:03 27 + * AI排版
  28 + * @param $content
  29 + * @return array
35 */ 30 */
36 public function send_layout_design($content){ 31 public function send_layout_design($content){
37 $param = [ 32 $param = [