作者 赵彬吉
... ... @@ -57,36 +57,15 @@ class lyhDemo extends Command
public function handle(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
ProjectServer::useProject($item['id']);
$authorModel = new AiBlogAuthor();
$author_list = $authorModel->list(['id'=>['>',0]]);
if(empty($author_list)){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$item['id']]);
if($aiSettingInfo === false){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$aiBlogService = new AiBlogService($item['id']);
foreach ($author_list as $val){
$aiBlogService->author_id = $val['author_id'];
$result = $aiBlogService->getAuthorDetail();
if(isset($result['status']) && $result['status'] == 200){
//当前作者的页面
$aiBlogAuthorModel = new AiBlogAuthor();
$authorInfo = $aiBlogAuthorModel->read(['author_id'=>$val['author_id']],['id','route']);
if($authorInfo !== false && !empty($result['data']['section'])){
$aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$val['author_id']]);
}
}
$webSettingModel = new WebSetting();
$info = $webSettingModel->read(['project_id'=>$item['id']]);
if($info === false){
$webSettingModel->addReturnId(['project_id'=>$item['id']]);
echo '当前数据为空:'.$item['id'].PHP_EOL;
}
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic
public function setting_read(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$info = [];
$this->model->addReturnId(['project_id'=>$this->user['project_id']]);
$info =$this->model->read(['project_id'=>$this->user['project_id']]);
}
return $this->success($info);
}
... ...
<?php
/**
* @remark :
* @name :AiCommandService.php
* @author :lyh
* @method :post
* @time :2025/5/26 17:01
*/
namespace App\Services;
/**
* @remark :AI指令返回数据
* @name :AiCommandService
* @author :lyh
* @method :post
* @time :2025/5/26 17:01
* Class AiCommandService
* @package App\Services
*/
class AiCommandService
{
... ... @@ -22,16 +11,22 @@ class AiCommandService
public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
/**
* @var string gemini 模型
* https://gemini.google.com/app
* gemini-2.0-flash-lite
* gemini-2.5-pro-preview-05-06
* gemini-2.5-flash-preview-05-20
* gemini-2.5-flash-preview-04-17
*/
public $model = 'gemini-2.0-flash-lite';
public $supplier = 'google';
/**
* @remark :Ai一键排版
* @name :ai_click_layout
* @author :lyh
* @method :post
* @time :2025/5/26 17:03
* AI排版
* @param $content
* @return array
*/
public function send_layout_design($content){
$param = [
... ...