WebSettingYoutubeController.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @remark :
* @name :WebSettingYoutubeController.php
* @author :lyh
* @method :post
* @time :2025/3/12 15:36
*/
namespace App\Http\Controllers\Bside\SeoSetting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Models\SeoSetting\WebSettingYoutube;
class WebSettingYoutubeController extends BaseController
{
/**
* @remark :获取当前项目的youtube
* @name :getInfo
* @author :lyh
* @method :post
* @time :2025/3/12 15:37
*/
public function getYoutubeInfo(WebSettingYoutube $webSettingYoutube){
$data = $webSettingYoutube->read(['project_id'=>$this->user['project_id']]);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存youtube账号密码
* @name :saveYoutube
* @author :lyh
* @method :post
* @time :2025/3/12 15:39
* @param :account->账号;password->密码
*/
public function saveYoutube(WebSettingYoutube $webSettingYoutube){
$this->request->validate([
'account'=>'required',
'password'=>'required',
],[
'account.required' => 'account不能为空',
'password.required' => 'password不能为空',
]);
$info = $webSettingYoutube->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
$id = $webSettingYoutube->addReturnId($this->param);
}else{
$id = $info['id'];
$webSettingYoutube->edit($this->param,['project_id'=>$this->user['project_id']]);
}
$this->response('success',Code::SUCCESS,['id'=>$id]);
}
}