124 lines
3.0 KiB
PHP
124 lines
3.0 KiB
PHP
<?php
|
|
namespace app\adminapi\controller\setting;
|
|
|
|
|
|
use app\adminapi\controller\BaseAdminController;
|
|
use app\adminapi\lists\setting\LanguageLists;
|
|
use app\adminapi\logic\setting\LanguageLogic;
|
|
use app\adminapi\validate\setting\LanguageValidate;
|
|
|
|
|
|
/**
|
|
* 语言包控制器
|
|
* Class LanguageController
|
|
* @package app\adminapi\controller\setting
|
|
*/
|
|
class LanguageController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取语言包列表
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2023/11/30 13:59
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new LanguageLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加语言包
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2023/11/30 13:59
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new LanguageValidate())->post()->goCheck('add');
|
|
$result = LanguageLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(LanguageLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑语言包
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2023/11/30 13:59
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new LanguageValidate())->post()->goCheck('edit');
|
|
$result = LanguageLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(LanguageLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除语言包
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2023/11/30 13:59
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new LanguageValidate())->post()->goCheck('delete');
|
|
LanguageLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取语言详情
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2023/11/30 13:59
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params = (new LanguageValidate())->goCheck('detail');
|
|
$result = LanguageLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 更改状态
|
|
* @return \think\response\Json
|
|
* @author BD
|
|
* @date 2024/2/22 10:18
|
|
*/
|
|
public function updateStatus()
|
|
{
|
|
$params = (new LanguageValidate())->post()->goCheck('status');
|
|
$result = LanguageLogic::updateStatus($params);
|
|
if (true === $result) {
|
|
return $this->success('修改成功', [], 1, 1);
|
|
}
|
|
return $this->fail(LanguageLogic::getError());
|
|
}
|
|
|
|
/**
|
|
* @notes 获取所有语言
|
|
* @return \think\response\Json
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @author BD
|
|
* @date 2024/10/13 10:54
|
|
*/
|
|
public function all()
|
|
{
|
|
$result = LanguageLogic::getAllData();
|
|
return $this->data($result);
|
|
}
|
|
|
|
} |