作者 lyh

gxshuju

  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