初始化仓库

This commit is contained in:
wangxiaowei
2025-04-22 14:09:52 +08:00
commit 8b100110bb
5155 changed files with 664201 additions and 0 deletions

View File

@ -0,0 +1,84 @@
<?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\adminapi\logic\setting\dict;
use app\common\logic\BaseLogic;
use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
/**
* 字典数据逻辑
* Class DictDataLogic
* @package app\adminapi\logic\DictData
*/
class DictDataLogic extends BaseLogic
{
/**
* @notes 添加编辑
* @param array $params
* @return DictData|\think\Model
* @author 段誉
* @date 2022/6/20 17:13
*/
public static function save(array $params)
{
$data = [
'name' => $params['name'],
'value' => $params['value'],
'sort' => $params['sort'] ?? 0,
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
];
if (!empty($params['id'])) {
return DictData::where(['id' => $params['id']])->update($data);
} else {
$dictType = DictType::findOrEmpty($params['type_id']);
$data['type_id'] = $params['type_id'];
$data['type_value'] = $dictType['type'];
return DictData::create($data);
}
}
/**
* @notes 删除字典数据
* @param array $params
* @return bool
* @author 段誉
* @date 2022/6/20 17:01
*/
public static function delete(array $params)
{
return DictData::destroy($params['id']);
}
/**
* @notes 获取字典数据详情
* @param $params
* @return array
* @author 段誉
* @date 2022/6/20 17:01
*/
public static function detail($params): array
{
return DictData::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,111 @@
<?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\adminapi\logic\setting\dict;
use app\common\enum\YesNoEnum;
use app\common\logic\BaseLogic;
use app\common\model\dict\DictData;
use app\common\model\dict\DictType;
/**
* 字典类型逻辑
* Class DictTypeLogic
* @package app\adminapi\logic\dict
*/
class DictTypeLogic extends BaseLogic
{
/**
* @notes 添加字典类型
* @param array $params
* @return DictType|\think\Model
* @author 段誉
* @date 2022/6/20 16:08
*/
public static function add(array $params)
{
return DictType::create([
'name' => $params['name'],
'type' => $params['type'],
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
]);
}
/**
* @notes 编辑字典类型
* @param array $params
* @author 段誉
* @date 2022/6/20 16:10
*/
public static function edit(array $params)
{
DictType::update([
'id' => $params['id'],
'name' => $params['name'],
'type' => $params['type'],
'status' => $params['status'],
'remark' => $params['remark'] ?? '',
]);
DictData::where(['type_id' => $params['id']])
->update(['type_value' => $params['type']]);
}
/**
* @notes 删除字典类型
* @param array $params
* @author 段誉
* @date 2022/6/20 16:23
*/
public static function delete(array $params)
{
DictType::destroy($params['id']);
}
/**
* @notes 获取字典详情
* @param $params
* @return array
* @author 段誉
* @date 2022/6/20 16:23
*/
public static function detail($params): array
{
return DictType::findOrEmpty($params['id'])->toArray();
}
/**
* @notes 角色数据
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/10/13 10:44
*/
public static function getAllData()
{
return DictType::where(['status' => YesNoEnum::YES])
->order(['id' => 'desc'])
->select()
->toArray();
}
}