ProjectGscController.php 2.7 KB
<?php

namespace App\Http\Controllers\Aside\Project;

use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Project\GscLogic;
use App\Http\Requests\Aside\User\GscRequest;

/**
 * @remark :优化gsc账号
 * @name   :ProjectGscController
 * @author :lyh
 * @time   :2023/6/19 11:25
 */
class ProjectGscController extends BaseController
{

    /**
     * @remark :gsc账号列表
     * @name   :lists
     * @author :lyh
     * @method :post
     * @time   :2023/6/19 11:25
     */
    public function lists(GscLogic $gscLogic){
        $this->request->validate([
            'project_id'=>'required'
        ],[
            'project_id.required' => '项目ID不能为空'
        ]);
        $lists = $gscLogic->GscLists($this->map,$this->page,$this->row,$this->order);
        $this->response('success',Code::SUCCESS,$lists);
    }

    /**
     * @remark :根据gsc账号获取域名
     * @name   :lists
     * @author :lyh
     * @method :post
     * @time   :2023/6/19 10:48
     */
    public function domainLists(GscLogic $gscLogic){
        $this->request->validate([
            'gsc_id'=>'required'
        ],[
            'gsc_id.required' => 'GSC账号ID不能为空'
        ]);
        $lists = $gscLogic->DomainLists($this->map,$this->page,$this->row,$this->order);
        $this->response('success',Code::SUCCESS,$lists);
    }

    /**
     * @remark :获取gsc账号详情
     * @name   :read
     * @author :lyh
     * @method :post
     * @time   :2023/6/19 16:55
     */
    public function read(GscLogic $gscLogic){
        $this->request->validate([
            'gsc_id'=>'required'
        ],[
            'gsc_id.required' => 'GSC账号ID不能为空'
        ]);
        $info = $gscLogic->GscRead();
        $this->response('success',Code::SUCCESS,$info);
    }

    /**
     * @remark :添加/编辑gsc账号
     * @name   :add
     * @author :lyh
     * @method :post
     * @time   :2023/6/19 16:28
     */
    public function save(GscRequest $gscRequest,GscLogic $gscLogic){
        if(isset($this->param['id'])){
            $this->request->validate([
                'id'=>'required'
            ],[
                'id.required' => 'GSC账号ID不能为空'
            ]);
        }
        $gscRequest->validated();
        $gscLogic->GscSave();
        $this->response('success');
    }

    /**
     * @remark :逻辑删除gsc账号
     * @name   :del
     * @author :lyh
     * @method :post
     * @time   :2023/6/19 16:30
     */
    public function del(GscLogic $gscLogic){
        $this->request->validate([
            'id'=>'required'
        ],[
            'id.required' => 'GSC账号ID不能为空'
        ]);
        $gscLogic->GscDel();
        $this->response('success');
    }

}