This commit is contained in:
walkor 2022-12-06 19:20:09 +08:00
parent 5f7ede6b28
commit a34ad835ab

View File

@ -12,7 +12,7 @@ use support\Response;
*/
class AdminController extends Crud
{
/**
* @var Admin
*/
@ -84,4 +84,21 @@ class AdminController extends Crud
return $this->json(0);
}
/**
* 格式化下拉列表
* @param $items
* @return Response
*/
protected function formatSelect($items): Response
{
$formatted_items = [];
foreach ($items as $item) {
$formatted_items[] = [
'name' => $item->nickname,
'value' => $item->id
];
}
return $this->json(0, 'ok', $formatted_items);
}
}