feat: 图片上传水印处理
This commit is contained in:
@@ -141,6 +141,44 @@ class SiteConfig
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// 根据分组获取配置
|
||||
public function getByGroupUniqueLabel($unique_label)
|
||||
{
|
||||
$configs = SysConfigModel::alias('c')
|
||||
->field([
|
||||
'c.id',
|
||||
'c.title',
|
||||
'c.name',
|
||||
'c.value',
|
||||
])
|
||||
->join(SysConfigGroupModel::getTable(). ' g', 'g.id = c.group_id')
|
||||
->where('g.language_id', '=', request()->lang_id)
|
||||
->where('g.unique_label', '=', $unique_label)
|
||||
->where('g.status', '=', 1)
|
||||
->order(['c.sort' => 'asc', 'c.id' => 'desc'])
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
// 修改字段为null的输出为空字符串
|
||||
$keys = array_keys($item->toArray());
|
||||
foreach ($keys as $key) {
|
||||
if (is_null($item[$key])) {
|
||||
$item[$key] = '';
|
||||
}
|
||||
}
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
if (!empty($configs)) {
|
||||
$configs_map = [];
|
||||
foreach ($configs as $cfg) {
|
||||
$configs_map[$cfg['name']] = $cfg;
|
||||
}
|
||||
return $configs_map;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
// 更新配置
|
||||
public function update()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user