作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !2052
@@ -13,6 +13,7 @@ use App\Console\Commands\Domain\DomainInfo; @@ -13,6 +13,7 @@ use App\Console\Commands\Domain\DomainInfo;
13 use App\Http\Logic\Aside\Project\ProjectLogic; 13 use App\Http\Logic\Aside\Project\ProjectLogic;
14 use App\Models\Ai\AiBlog; 14 use App\Models\Ai\AiBlog;
15 use App\Models\Ai\AiBlogAuthor; 15 use App\Models\Ai\AiBlogAuthor;
  16 +use App\Models\Ai\AiCommand;
16 use App\Models\Com\NoticeLog; 17 use App\Models\Com\NoticeLog;
17 use App\Models\Com\V6WeeklyReport; 18 use App\Models\Com\V6WeeklyReport;
18 use App\Models\Product\Category; 19 use App\Models\Product\Category;
@@ -31,6 +32,7 @@ use App\Models\WebSetting\WebLanguage; @@ -31,6 +32,7 @@ use App\Models\WebSetting\WebLanguage;
31 use App\Models\WebSetting\WebSetting; 32 use App\Models\WebSetting\WebSetting;
32 use App\Models\Workchat\MessagePush; 33 use App\Models\Workchat\MessagePush;
33 use App\Services\AiBlogService; 34 use App\Services\AiBlogService;
  35 +use App\Services\AiCommandService;
34 use App\Services\ProjectServer; 36 use App\Services\ProjectServer;
35 use Illuminate\Console\Command; 37 use Illuminate\Console\Command;
36 use Illuminate\Support\Facades\Schema; 38 use Illuminate\Support\Facades\Schema;
@@ -54,6 +56,12 @@ class lyhDemo extends Command @@ -54,6 +56,12 @@ class lyhDemo extends Command
54 protected $description = '更新路由'; 56 protected $description = '更新路由';
55 57
56 public function handle(){ 58 public function handle(){
  59 + $string = '<p>Wow, the 137th Canton Fair was quite a game changer for EV Charging Pile suppliers! Seriously, it showcased some amazing growth in international participation and trade opportunities. Can you believe it? They reported a record-breaking 288,938 overseas buyers from 219 countries and regions, which is a 17.3% jump compared to the last fair. This kind of surge really highlights just how much the demand for electric vehicle infrastructure is ramping up. Industry forecasts suggest global EV sales could hit around 26 million units by 2030! And get this, export intentions at the fair climbed to a whopping $25.44 billion, marking a 3% increase. It’s clear that this fair has become a vital hub for manufacturers and suppliers in the EV Charging Pile sector, connecting them with international markets. Plus, the online platform keeps the networking going year-round, so companies can tap into new opportunities even after the fair wraps up. As everyone gears up for the 138th Canton Fair, it’s the perfect time for businesses to strategically carve out their space in the ever-growing EV charging scene.</p><img src="https://ecdn6.globalso.com/public/img/2025-05-24/9834757034_0.png" alt="Unlocking Global Opportunities at the 137th Canton Fair for Ev Charging Pile Suppliers" itemprop="image">';
  60 + $promote = AiCommand::where(['key' => 'ai_layout_design'])->first();
  61 + $promote = str_replace("{html}", $string, $promote->ai);
  62 + $aiCommandService = new AiCommandService();
  63 + $result = $aiCommandService->send_layout_design($promote);
  64 + dd($result);
57 return true; 65 return true;
58 } 66 }
59 67
@@ -6,6 +6,7 @@ namespace App\Console\Commands\Test; @@ -6,6 +6,7 @@ namespace App\Console\Commands\Test;
6 6
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Helper\FormGlobalsoApi; 8 use App\Helper\FormGlobalsoApi;
  9 +use App\Models\Ai\AiCommand;
9 use App\Models\Domain\DomainInfo; 10 use App\Models\Domain\DomainInfo;
10 use App\Models\HomeCount\Count; 11 use App\Models\HomeCount\Count;
11 use App\Models\Inquiry\InquiryFormData; 12 use App\Models\Inquiry\InquiryFormData;
@@ -17,6 +18,7 @@ use App\Models\Project\ProjectUpdateTdk; @@ -17,6 +18,7 @@ use App\Models\Project\ProjectUpdateTdk;
17 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel; 18 use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
18 use App\Models\WebSetting\Translate as TranslateModel; 19 use App\Models\WebSetting\Translate as TranslateModel;
19 use App\Models\WebSetting\WebLanguage; 20 use App\Models\WebSetting\WebLanguage;
  21 +use App\Services\AiCommandService;
20 use App\Services\ProjectServer; 22 use App\Services\ProjectServer;
21 use Carbon\Carbon; 23 use Carbon\Carbon;
22 use Illuminate\Console\Command; 24 use Illuminate\Console\Command;
@@ -60,6 +62,13 @@ class Test extends Command @@ -60,6 +62,13 @@ class Test extends Command
60 */ 62 */
61 public function handle() 63 public function handle()
62 { 64 {
  65 + $string = '';
  66 + $promote = AiCommand::where(['key' => 'ai_layout_design'])->frist();
  67 + $promote = str_replace("{html}", $string, $promote->ai);
  68 + $aiCommandService = new AiCommandService();
  69 + $result = $aiCommandService->send_layout_design($promote);
  70 + dd($result);
  71 +
63 $string = 'eyJpdiI6ImxDWW96VUdGVk5QcEZ5dnRyd2lzVkE9PSIsInZhbHVlIjoiRGJSRXdQZDdtMFp1Tjh5c21jTWRKbjh4SWNMeWpRR1hWdE1HdVR3cEI5MjNYdjA0d2hKemV5ZjFoNUd4enNKaklaNXZwUUFtbDhIUkxyckVwYTJ6YnE3V2pMdmUyeU5lblNPQXNsbHl2U0hFOTZ1NERTTStUb2dnQmhMTzZMMXVCV0REeiszQ3NcL0l1ZGhTSkI5a3J3TkRoVFhteHpFcXpcL3FwRkVGVG1sN2xBTlFJemZiZ3N1Sk1PT3Z2T1Jld2MiLCJtYWMiOiIzZmU5OTRiZTMyNWZhNzczMzUzZTc1YjFlODg0MGFhNDJlM2Q2MDhhMDY4YWQxNWFlNjNlYjczYmJmZThkOWJlIn0%3D'; 72 $string = 'eyJpdiI6ImxDWW96VUdGVk5QcEZ5dnRyd2lzVkE9PSIsInZhbHVlIjoiRGJSRXdQZDdtMFp1Tjh5c21jTWRKbjh4SWNMeWpRR1hWdE1HdVR3cEI5MjNYdjA0d2hKemV5ZjFoNUd4enNKaklaNXZwUUFtbDhIUkxyckVwYTJ6YnE3V2pMdmUyeU5lblNPQXNsbHl2U0hFOTZ1NERTTStUb2dnQmhMTzZMMXVCV0REeiszQ3NcL0l1ZGhTSkI5a3J3TkRoVFhteHpFcXpcL3FwRkVGVG1sN2xBTlFJemZiZ3N1Sk1PT3Z2T1Jld2MiLCJtYWMiOiIzZmU5OTRiZTMyNWZhNzczMzUzZTc1YjFlODg0MGFhNDJlM2Q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XBOK0hKa0JvcFlVQklDWE9yR3hEdEVBPT0iLCJtYWMiOiI3NDg5ZDViMjJiNzM3ZjAyZDUxZTAxODVlYjdhYWVmZWFjZDM2ZTE0M2NkNjEwODdjNTJjNmM1NmNlOTUxYjdiIn0='; 74 $string_fob = 'eyJpdiI6IlBwOXRPL1ZUV1F1SHZpVnpaQkUwSWc9PSIsInZhbHVlIjoiVGFxcTFmSDBvL0hkSldEWkh0elRlaXpkOHJTQW1OeWlDZmMvMndaeXF0SE5YYXd1YjE3MWpPTTZuVEdlSEYzY3VmeXdSbmI5T0d0ZkxXZTRxb3laNWpCdFJxQ2dlQlExemZrRVFFeStxQm40a2VuNWxpUmFpdFoyZjJxMzRLYXBOK0hKa0JvcFlVQklDWE9yR3hEdEVBPT0iLCJtYWMiOiI3NDg5ZDViMjJiNzM3ZjAyZDUxZTAxODVlYjdhYWVmZWFjZDM2ZTE0M2NkNjEwODdjNTJjNmM1NmNlOTUxYjdiIn0=';
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateModuleRandomController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:33
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Template;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\BTemplate\BTemplateModuleRandomLogic;
  15 +use Illuminate\Http\Request;
  16 +
  17 +class BTemplateModuleRandomController extends BaseController
  18 +{
  19 + public function __construct(Request $request)
  20 + {
  21 + parent::__construct($request);
  22 + $this->logic = new BTemplateModuleRandomLogic();
  23 + }
  24 +
  25 + /**
  26 + * @remark :获取当前项目所有随机模块
  27 + * @name :getRandomList
  28 + * @author :lyh
  29 + * @method :post
  30 + * @time :2025/5/27 16:00
  31 + */
  32 + public function getRandomList(){
  33 + $this->request->validate([
  34 + 'project_id'=>'required',
  35 + ],[
  36 + 'project_id.required' => 'project_id不能为空',
  37 + ]);
  38 + $data = $this->logic->getRandomList();
  39 + $this->response('success',Code::SUCCESS,$data);
  40 + }
  41 +
  42 + /**
  43 + * @remark :设置为随机模块
  44 + * @name :saveRandomModule
  45 + * @author :lyh
  46 + * @method :post
  47 + * @time :2025/5/27 15:34
  48 + */
  49 + public function saveRandomModule(){
  50 + $this->request->validate([
  51 + 'module_id'=>'required',
  52 + 'uuid'=>'required',
  53 + 'project_id'=>'required',
  54 + 'html'=>'required',
  55 + ],[
  56 + 'module_id.required' => '左侧模块id不能为空',
  57 + 'uuid.required' => 'uuid唯一不能为空',
  58 + 'project_id.required' => 'project_id不能为空',
  59 + 'html.required' => 'html不能为空',
  60 + ]);
  61 + $data = $this->logic->saveRandomModule();
  62 + $this->response('success',Code::SUCCESS,$data);
  63 + }
  64 +
  65 + /**
  66 + * @remark :获取当前随机模块详情
  67 + * @name :getRandomInfo
  68 + * @author :lyh
  69 + * @method :post
  70 + * @time :2025/5/27 15:47
  71 + */
  72 + public function getRandomInfo(){
  73 + $this->request->validate([
  74 + 'module_id'=>'required',
  75 + 'uuid'=>'required',
  76 + 'project_id'=>'required',
  77 + ],[
  78 + 'module_id.required' => '左侧模块id不能为空',
  79 + 'uuid.required' => 'uuid唯一不能为空',
  80 + 'project_id.required' => 'project_id不能为空',
  81 + ]);
  82 + $data = $this->logic->getRandomInfo();
  83 + $this->response('success',Code::SUCCESS,$data);
  84 + }
  85 +
  86 +
  87 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateModuleRandomLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:36
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\BTemplate;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Template\TemplateModuleRandom;
  14 +
  15 +class BTemplateModuleRandomLogic extends BaseLogic
  16 +{
  17 + public function __construct()
  18 + {
  19 + parent::__construct();
  20 + $this->model = new TemplateModuleRandom();
  21 + $this->param = $this->requestAll;
  22 + }
  23 +
  24 + /**
  25 + * @remark :保存为随机模块
  26 + * @name :saveRandomModule
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2025/5/27 15:38
  30 + */
  31 + public function saveRandomModule(){
  32 + //查询当前uuid是否已存在
  33 + $info = $this->model->read(['project_id'=>$this->user['project_id'],'uuid'=>$this->param['uuid'],'module_id'=>$this->param['module_id']]);
  34 + try {
  35 + if($info === false){
  36 + //执行新增数据
  37 + $this->model->add($this->param);
  38 + }else{
  39 + //执行编辑
  40 + $this->model->edit(['html'=>$this->param['html']],['id'=>$this->param['id']]);
  41 + }
  42 + }catch (\Exception $e){
  43 + $this->fail('保存失败,请联系管理员');
  44 + }
  45 + return $this->success();
  46 + }
  47 +
  48 + /**
  49 + * @remark :获取当前项目的所有随机模块
  50 + * @name :getRandomList
  51 + * @author :lyh
  52 + * @method :post
  53 + * @time :2025/5/27 15:59
  54 + */
  55 + public function getRandomList(){
  56 + $data = $this->model->list(['project_id'=>$this->user['project_id']],'id',['id','uuid','project_id','module_id']);
  57 + return $this->success($data);
  58 + }
  59 +
  60 + /**
  61 + * @remark :获取当前模块是否为随机模块
  62 + * @name :getIsRandomModule
  63 + * @author :lyh
  64 + * @method :post
  65 + * @time :2025/5/27 15:47
  66 + */
  67 + public function getRandomInfo(){
  68 + $info = $this->model->read(['project_id'=>$this->user['project_id'],'uuid'=>$this->param['uuid'],'module_id'=>$this->param['module_id']]);
  69 + if($info === false){
  70 + $info = [];
  71 + }
  72 + return $this->success($info);
  73 + }
  74 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateModuleRandom.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/5/27 15:31
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :随机模块
  16 + * @name :TemplateModuleRandom
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/5/27 15:32
  20 + */
  21 +class TemplateModuleRandom extends Base
  22 +{
  23 + protected $table = 'gl_public_template_module_random';
  24 +}
@@ -49,7 +49,14 @@ class AiCommandService @@ -49,7 +49,14 @@ class AiCommandService
49 "Content-Type:application/json;charset=utf-8", 49 "Content-Type:application/json;charset=utf-8",
50 ); 50 );
51 $result = http_post($this->url,json_encode($param,true),$header); 51 $result = http_post($this->url,json_encode($param,true),$header);
52 - return $result; 52 + $data = $result['content'][0]['data'] ?? '';
  53 + $data = trim($data, "\"\n");
  54 + $data = preg_replace('/^```html\s*/', '', $data); // 去除开头
  55 + $data = preg_replace('/\s*```$/', '', $data); // 去除结尾
  56 + $data = str_replace("\\n", "\n", $data);
  57 + $data = str_replace('\"', '"', $data);
  58 +
  59 + return ['data'=>$data];
53 } 60 }
54 61
55 } 62 }
@@ -443,7 +443,13 @@ Route::middleware(['bloginauth'])->group(function () { @@ -443,7 +443,13 @@ Route::middleware(['bloginauth'])->group(function () {
443 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save'); 443 Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save');
444 Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del'); 444 Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del');
445 }); 445 });
446 - 446 + //随机模块
  447 + Route::prefix('random')->group(function () {
  448 + //获取所有左侧模版
  449 + Route::any('/getRandomList', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomList'])->name('template_random_getRandomList');
  450 + Route::any('/getRandomInfo', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomInfo'])->name('template_random_getRandomInfo');
  451 + Route::any('/saveRandomModule', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'saveRandomModule'])->name('template_random_saveRandomModule');
  452 + });
447 //编辑记录 453 //编辑记录
448 Route::prefix('log')->group(function () { 454 Route::prefix('log')->group(function () {
449 //获取所有左侧模版 455 //获取所有左侧模版