作者 lyh

gx

... ... @@ -7,7 +7,9 @@ use App\Helper\Common;
use App\Helper\Gpt;
use App\Helper\Translate;
use App\Models\Ai\AiCommand;
use App\Models\Mail\Mail;
use App\Models\Project\DeployOptimize;
use App\Models\User\User;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -141,6 +143,18 @@ class UpdateSeoTdk extends Command
$this->seo_tdk($project_id);
} catch (\Exception $e) {
echo date('Y-m-d H:i:s') . ' line '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
$this->updateProduct($project_id);
$this->updateProductCate($project_id);
$this->updateBlogs($project_id);
$this->updateBlogCate($project_id);
$this->updateNews($project_id);
$this->updateNewsCate($project_id);
$this->updatePage($project_id);
//发送站内信
$this->send_message($project_id);
DB::disconnect('custom_mysql');
}catch (\Exception $e){
echo date('Y-m-d H:i:s') . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
}
echo date('Y-m-d H:i:s') . ' end: ' . $project_id . PHP_EOL;
}
... ... @@ -174,7 +188,6 @@ class UpdateSeoTdk extends Command
echo $field.'已有值 跳过' . PHP_EOL;
continue;
}
//AI生成
if (!empty($ai_commands[$ai_key]['ai'])) {
$prompt = $this->getPrompt($project_id, $ai_commands[$ai_key]['ai'], $table, $v);
... ... @@ -322,4 +335,20 @@ class UpdateSeoTdk extends Command
return Common::deal_str($text);
}
/**
* @remark :发送站内信
* @name :send_message
* @author :lyh
* @method :post
* @time :2023/11/4 10:22
*/
public function send_message($project_id){
$user = new User();
$userInfo = $user->read(['project_id'=>$project_id,'role_id'=>0]);
$data["title"] = "seo更新通知---完成";
$data["user_list"] = $userInfo['id'];
$data["content"] = "seo更新成功,更新完成时间".date('Y-m-d H:i:s');
$mail = new Mail();
return $mail->add($data);
}
}
... ...
<?php
/**
* @remark :
* @name :SettingNumController.php
* @author :lyh
* @method :post
* @time :2023/11/4 11:09
*/
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\WebSetting\SettingNum;
class SettingNumController extends BaseController
{
/**
* @remark :根据类型获取数量
* @name :info
* @author :lyh
* @method :post
* @time :2023/11/4 11:09
*/
public function info(){
$settingNumModel = new SettingNum();
$info = $settingNumModel->read($this->param);
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :保存数量
* @name :save
* @author :lyh
* @method :post
* @time :2023/11/4 11:10
*/
public function save(){
$this->request->validate([
'type'=>'required',
'num'=>'required',
],[
'type.required' => 'type不能为空',
'num.required' => 'num不能为空',
]);
$settingNumModel = new SettingNum();
$info = $settingNumModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
if($info !== false){
$rs = $settingNumModel->edit($this->param,['id'=>$info['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$rs = $settingNumModel->add($this->param);
}
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
$this->response('success');
}
}
... ...
<?php
/**
* @remark :
* @name :SettingNum.php
* @author :lyh
* @method :post
* @time :2023/11/4 11:07
*/
namespace App\Models\WebSetting;
use App\Models\Base;
/**
* @remark :设置数量
* @name :SettingNum
* @author :lyh
* @method :post
* @time :2023/11/4 11:08
*/
class SettingNum extends Base
{
protected $table = 'gl_setting_num';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -25,7 +25,7 @@ return [
//默认
'default_b_image' =>[
'size' => [
'max' => 500 * 1024, // 2M
'max' => 1024 * 1024, // 1M
],
'path_b' => '/upload/p',
'path_a' => '/upload/m',
... ...
... ... @@ -188,6 +188,10 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit');
});
Route::prefix('num')->group(function () {
Route::any('/info', [\App\Http\Controllers\Bside\Setting\SettingNumController::class, 'info'])->name('num_info');
Route::any('/save',[\App\Http\Controllers\Bside\Setting\SettingNumController::class, 'save'])->name('num_save');
});
});
//产品
Route::prefix('product')->group(function () {
... ...