作者 lyh

gx

@@ -7,7 +7,9 @@ use App\Helper\Common; @@ -7,7 +7,9 @@ use App\Helper\Common;
7 use App\Helper\Gpt; 7 use App\Helper\Gpt;
8 use App\Helper\Translate; 8 use App\Helper\Translate;
9 use App\Models\Ai\AiCommand; 9 use App\Models\Ai\AiCommand;
  10 +use App\Models\Mail\Mail;
10 use App\Models\Project\DeployOptimize; 11 use App\Models\Project\DeployOptimize;
  12 +use App\Models\User\User;
11 use App\Services\ProjectServer; 13 use App\Services\ProjectServer;
12 use Illuminate\Console\Command; 14 use Illuminate\Console\Command;
13 use Illuminate\Support\Facades\DB; 15 use Illuminate\Support\Facades\DB;
@@ -141,6 +143,18 @@ class UpdateSeoTdk extends Command @@ -141,6 +143,18 @@ class UpdateSeoTdk extends Command
141 $this->seo_tdk($project_id); 143 $this->seo_tdk($project_id);
142 } catch (\Exception $e) { 144 } catch (\Exception $e) {
143 echo date('Y-m-d H:i:s') . ' line '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL; 145 echo date('Y-m-d H:i:s') . ' line '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
  146 + $this->updateProduct($project_id);
  147 + $this->updateProductCate($project_id);
  148 + $this->updateBlogs($project_id);
  149 + $this->updateBlogCate($project_id);
  150 + $this->updateNews($project_id);
  151 + $this->updateNewsCate($project_id);
  152 + $this->updatePage($project_id);
  153 + //发送站内信
  154 + $this->send_message($project_id);
  155 + DB::disconnect('custom_mysql');
  156 + }catch (\Exception $e){
  157 + echo date('Y-m-d H:i:s') . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
144 } 158 }
145 echo date('Y-m-d H:i:s') . ' end: ' . $project_id . PHP_EOL; 159 echo date('Y-m-d H:i:s') . ' end: ' . $project_id . PHP_EOL;
146 } 160 }
@@ -174,7 +188,6 @@ class UpdateSeoTdk extends Command @@ -174,7 +188,6 @@ class UpdateSeoTdk extends Command
174 echo $field.'已有值 跳过' . PHP_EOL; 188 echo $field.'已有值 跳过' . PHP_EOL;
175 continue; 189 continue;
176 } 190 }
177 -  
178 //AI生成 191 //AI生成
179 if (!empty($ai_commands[$ai_key]['ai'])) { 192 if (!empty($ai_commands[$ai_key]['ai'])) {
180 $prompt = $this->getPrompt($project_id, $ai_commands[$ai_key]['ai'], $table, $v); 193 $prompt = $this->getPrompt($project_id, $ai_commands[$ai_key]['ai'], $table, $v);
@@ -322,4 +335,20 @@ class UpdateSeoTdk extends Command @@ -322,4 +335,20 @@ class UpdateSeoTdk extends Command
322 return Common::deal_str($text); 335 return Common::deal_str($text);
323 } 336 }
324 337
  338 + /**
  339 + * @remark :发送站内信
  340 + * @name :send_message
  341 + * @author :lyh
  342 + * @method :post
  343 + * @time :2023/11/4 10:22
  344 + */
  345 + public function send_message($project_id){
  346 + $user = new User();
  347 + $userInfo = $user->read(['project_id'=>$project_id,'role_id'=>0]);
  348 + $data["title"] = "seo更新通知---完成";
  349 + $data["user_list"] = $userInfo['id'];
  350 + $data["content"] = "seo更新成功,更新完成时间".date('Y-m-d H:i:s');
  351 + $mail = new Mail();
  352 + return $mail->add($data);
  353 + }
325 } 354 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SettingNumController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/4 11:09
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Setting;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\WebSetting\SettingNum;
  15 +
  16 +class SettingNumController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :根据类型获取数量
  20 + * @name :info
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2023/11/4 11:09
  24 + */
  25 + public function info(){
  26 + $settingNumModel = new SettingNum();
  27 + $info = $settingNumModel->read($this->param);
  28 + $this->response('success',Code::SUCCESS,$info);
  29 + }
  30 +
  31 + /**
  32 + * @remark :保存数量
  33 + * @name :save
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2023/11/4 11:10
  37 + */
  38 + public function save(){
  39 + $this->request->validate([
  40 + 'type'=>'required',
  41 + 'num'=>'required',
  42 + ],[
  43 + 'type.required' => 'type不能为空',
  44 + 'num.required' => 'num不能为空',
  45 + ]);
  46 + $settingNumModel = new SettingNum();
  47 + $info = $settingNumModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
  48 + if($info !== false){
  49 + $rs = $settingNumModel->edit($this->param,['id'=>$info['id']]);
  50 + }else{
  51 + $this->param['project_id'] = $this->user['project_id'];
  52 + $rs = $settingNumModel->add($this->param);
  53 + }
  54 + if($rs === false){
  55 + $this->fail('系统错误,请联系管理员');
  56 + }
  57 + $this->response('success');
  58 + }
  59 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SettingNum.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/4 11:07
  8 + */
  9 +
  10 +namespace App\Models\WebSetting;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :设置数量
  16 + * @name :SettingNum
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/11/4 11:08
  20 + */
  21 +class SettingNum extends Base
  22 +{
  23 + protected $table = 'gl_setting_num';
  24 + //连接数据库
  25 + protected $connection = 'custom_mysql';
  26 +}
@@ -25,7 +25,7 @@ return [ @@ -25,7 +25,7 @@ return [
25 //默认 25 //默认
26 'default_b_image' =>[ 26 'default_b_image' =>[
27 'size' => [ 27 'size' => [
28 - 'max' => 500 * 1024, // 2M 28 + 'max' => 1024 * 1024, // 1M
29 ], 29 ],
30 'path_b' => '/upload/p', 30 'path_b' => '/upload/p',
31 'path_a' => '/upload/m', 31 'path_a' => '/upload/m',
@@ -188,6 +188,10 @@ Route::middleware(['bloginauth'])->group(function () { @@ -188,6 +188,10 @@ Route::middleware(['bloginauth'])->group(function () {
188 Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit'); 188 Route::any('/edit',[\App\Http\Controllers\Bside\Setting\AggregationSettingController::class, 'edit'])->name('aggregation_edit');
189 }); 189 });
190 190
  191 + Route::prefix('num')->group(function () {
  192 + Route::any('/info', [\App\Http\Controllers\Bside\Setting\SettingNumController::class, 'info'])->name('num_info');
  193 + Route::any('/save',[\App\Http\Controllers\Bside\Setting\SettingNumController::class, 'save'])->name('num_save');
  194 + });
191 }); 195 });
192 //产品 196 //产品
193 Route::prefix('product')->group(function () { 197 Route::prefix('product')->group(function () {