ProjectCountryController.php 2.6 KB
<?php

namespace App\Http\Controllers\Bside\Setting;

use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Aside\Domain\DomainInfoLogic;
use App\Http\Logic\Bside\Setting\ProjectCountryLogic;

/**
 * @name:项目配置多语言设置
 */
class ProjectCountryController extends BaseController
{
    /**
     * @name   :(当前项目的多语言列表)lists
     * @author :lyh
     * @method :post
     * @time   :2023/4/28 14:49
     */
    public function info(ProjectCountryLogic $projectCountryLogic){
        $lists = $projectCountryLogic->country_info();
        $this->response('success',Code::SUCCESS,$lists);
    }

    /**
     * @name   :(更新当前项目多语言设置)edit
     * @author :lyh
     * @method :post
     * @time   :2023/4/28 17:53
     */
    public function save(ProjectCountryLogic $projectCountryLogic){
        $projectCountryLogic->country_save();
        $this->response('success');
    }

    /**
     * 设置语种自定义跳转链接
     * @param DomainInfoLogic $domainInfoLogic
     * @author Akun
     * @date 2024/03/05 9:47
     */
    public function custom_save(DomainInfoLogic $domainInfoLogic){
        $this->request->validate([
            'language_id'=>'required',
            'custom_domain'=>'required',
            'is_create'=>'required'
        ],[
            'language_id.required' => 'language_id不能为空',
            'custom_domain.required' => 'custom_domain不能为空',
            'is_create.required' => 'is_create不能为空'
        ]);
        $domainInfoLogic->country_custom($this->user['project_id']);
        $this->response('success');
    }


    /**
     * 清除语种自定义跳转链接
     * @param ProjectCountryLogic $projectCountryLogic
     * @author Akun
     * @date 2024/03/05 10:20
     */
    public function custom_del(ProjectCountryLogic $projectCountryLogic){
        $this->request->validate([
            'language_id'=>'required'
        ],[
            'language_id.required' => 'language_id不能为空'
        ]);

        $projectCountryLogic->country_custom_del();
        $this->response('success');
    }

    /**
     * 获取语种自定义跳转链接详情
     * @param ProjectCountryLogic $projectCountryLogic
     * @author Akun
     * @date 2024/03/06 14:37
     */
    public function custom_info(ProjectCountryLogic $projectCountryLogic){
        $this->request->validate([
            'language_id'=>'required'
        ],[
            'language_id.required' => 'language_id不能为空'
        ]);
        $info = $projectCountryLogic->country_custom_info();
        $this->response('success',Code::SUCCESS,$info);
    }
}