作者 李宇航

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

youtube账号密码设置



查看合并请求 !1411
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :WebSettingYoutubeController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/3/12 15:36
  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\WebSettingYoutube;
  15 +
  16 +class WebSettingYoutubeController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :获取当前项目的youtube
  20 + * @name :getInfo
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2025/3/12 15:37
  24 + */
  25 + public function getYoutubeInfo(WebSettingYoutube $webSettingYoutube){
  26 + $data = $webSettingYoutube->read(['project_id'=>$this->user['project_id']]);
  27 + $this->response('success',Code::SUCCESS,$data);
  28 + }
  29 +
  30 + /**
  31 + * @remark :保存youtube账号密码
  32 + * @name :saveYoutube
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2025/3/12 15:39
  36 + * @param :account->账号;password->密码
  37 + */
  38 + public function saveYoutube(WebSettingYoutube $webSettingYoutube){
  39 + $this->request->validate([
  40 + 'account'=>'required',
  41 + 'password'=>'required',
  42 + ],[
  43 + 'account.required' => 'account不能为空',
  44 + 'password.required' => 'password不能为空',
  45 + ]);
  46 + $info = $webSettingYoutube->read(['project_id'=>$this->user['project_id']]);
  47 + if($info === false){
  48 + $this->param['project_id'] = $this->user['project_id'];
  49 + $id = $webSettingYoutube->addReturnId($this->param);
  50 + }else{
  51 + $id = $info['id'];
  52 + $webSettingYoutube->edit($this->param,['project_id'=>$this->user['project_id']]);
  53 + }
  54 + $this->response('success',Code::SUCCESS,['id'=>$id]);
  55 + }
  56 +}
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :WebSettingYoutube.php 4 + * @name :WebSettingYoutubeController.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 * @time :2025/3/11 15:51 7 * @time :2025/3/11 15:51
@@ -13,7 +13,7 @@ use App\Models\Base; @@ -13,7 +13,7 @@ use App\Models\Base;
13 13
14 /** 14 /**
15 * @remark :youtube账号密码设置 15 * @remark :youtube账号密码设置
16 - * @name :WebSettingYoutube 16 + * @name :WebSettingYoutubeController
17 * @author :lyh 17 * @author :lyh
18 * @method :post 18 * @method :post
19 * @time :2025/3/11 15:51 19 * @time :2025/3/11 15:51
@@ -666,7 +666,12 @@ Route::middleware(['bloginauth'])->group(function () { @@ -666,7 +666,12 @@ Route::middleware(['bloginauth'])->group(function () {
666 Route::prefix('auto_email_content')->group(function () { 666 Route::prefix('auto_email_content')->group(function () {
667 Route::any('/getContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'getContent'])->name('auto_email_content_getContent'); 667 Route::any('/getContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'getContent'])->name('auto_email_content_getContent');
668 Route::any('/saveContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'saveContent'])->name('auto_email_content_saveContent'); 668 Route::any('/saveContent', [\App\Http\Controllers\Bside\Subscribe\AutoEmailContentController::class, 'saveContent'])->name('auto_email_content_saveContent');
  669 + });
669 670
  671 + //seo白帽 youtube账号密码设置
  672 + Route::prefix('youtube')->group(function () {
  673 + Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'getYoutubeInfo'])->name('youtube_getYoutubeInfo');
  674 + Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'saveYoutube'])->name('youtube_saveYoutube');
670 }); 675 });
671 }); 676 });
672 //无需登录验证的路由组 677 //无需登录验证的路由组