mirror of
https://gitee.com/niucloud-team/niucloud
synced 2026-08-14 17:35:36 +08:00
0.0.9
This commit is contained in:
@@ -41,6 +41,29 @@ class Diy extends BaseModel
|
||||
*/
|
||||
protected $name = 'diy_page';
|
||||
|
||||
/**
|
||||
* 状态字段转化:所属插件名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
public function getAddonNameAttr($value, $data)
|
||||
{
|
||||
$addon_name = '';
|
||||
$template = TemplateDict::getTemplate([
|
||||
'query' => 'addon'
|
||||
]);
|
||||
foreach ($template as $k => $v) {
|
||||
foreach ($v[ 'list' ] as $ck => $cv) {
|
||||
if ($ck == $data[ 'type' ]) {
|
||||
$addon_name = $v[ 'title' ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $addon_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态字段转化
|
||||
* @param $value
|
||||
@@ -108,6 +131,28 @@ class Diy extends BaseModel
|
||||
return $data[ 'share' ] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:自定义页面标识
|
||||
* @param $query
|
||||
* @param $value
|
||||
* @param $data
|
||||
*/
|
||||
public function searchAddonNameAttr($query, $value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
$list = [];
|
||||
$template = TemplateDict::getTemplate([
|
||||
'query' => 'addon'
|
||||
]);
|
||||
foreach ($template as $k => $v) {
|
||||
if ($k == $value) {
|
||||
$list = array_keys($v[ 'list' ]);
|
||||
}
|
||||
}
|
||||
$query->where("type", 'in', $list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器:自定义页面
|
||||
* @param $query
|
||||
@@ -121,7 +166,6 @@ class Diy extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 搜索器:自定义页面名称
|
||||
* @param $query
|
||||
|
||||
@@ -49,12 +49,26 @@ class SiteGroup extends BaseModel
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getGroupRolesDataAttr($value, $data)
|
||||
public function getAppNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['addon']))
|
||||
if (empty($data['app']))
|
||||
return [];
|
||||
return (new Addon())->where([['key', 'in', $data['addon']]])->select();
|
||||
return (new Addon())->where([['key', 'in', $data['app']]])->column('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联插件
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
public function getAddonNameAttr($value, $data)
|
||||
{
|
||||
if (empty($data['app']))
|
||||
return [];
|
||||
return (new Addon())->where([['key', 'in', $data['addon']]])->column('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
* @param $query
|
||||
|
||||
Reference in New Issue
Block a user