first commit
This commit is contained in:
100
app/api/logic/LanguageLogic.php
Normal file
100
app/api/logic/LanguageLogic.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\logic;
|
||||
|
||||
use app\common\enum\YesNoEnum;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\setting\Language;
|
||||
use app\common\model\setting\LanguagePag;
|
||||
|
||||
|
||||
/**
|
||||
* 文章逻辑
|
||||
* Class LanguageLogic
|
||||
* @package app\api\logic
|
||||
*/
|
||||
class LanguageLogic extends BaseLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 语言详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 17:09
|
||||
*/
|
||||
public static function detail($params)
|
||||
{
|
||||
// 语言详情
|
||||
$field = ['id','name_loc as name','symbol','precision'];
|
||||
$where = ['symbol' => $params['name']];
|
||||
$language = Language::field($field)
|
||||
->where($where)
|
||||
->findOrEmpty()
|
||||
->toArray();
|
||||
|
||||
return $language;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 语言数据
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:53
|
||||
*/
|
||||
public static function getAllData()
|
||||
{
|
||||
$field = ['id','name_loc as name','symbol','precision','time_format'];
|
||||
$langs = Language::field($field)
|
||||
->where(['is_show' => YesNoEnum::YES])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $langs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 语言包数据
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:53
|
||||
*/
|
||||
public static function getPagAllData($params)
|
||||
{
|
||||
//查询语言
|
||||
$language = Language::where(['symbol' => $params['lang']])->findOrEmpty();
|
||||
if ($language->isEmpty()) {
|
||||
throw new \Exception('network.parameterAbnormality');//参数异常
|
||||
}
|
||||
|
||||
$field = ['type','name','value'];
|
||||
$pags = LanguagePag::field($field)
|
||||
->where(['lang' => $params['lang']])
|
||||
->order(['type' => 'asc','name' => 'asc', 'value' => 'asc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $pags;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user