|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :WebSettingYoutubeController.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/3/12 15:36
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bside\Setting;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Bside\BaseController;
|
|
|
|
use App\Models\WebSetting\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]);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|