优化管理员管理目录中菜单的样式

This commit is contained in:
2026-04-28 13:44:24 +08:00
parent 26f4151339
commit d7375222ce
7 changed files with 111 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
namespace app\admin\controller\admin;
use app\common\controller\Backend;
use support\think\Db;
use support\Response;
use Webman\Http\Request as WebmanRequest;
@@ -51,9 +52,28 @@ class AdminWallet extends Backend
->where($where)
->order($order)
->paginate($limit);
$items = $res->items();
$channelIds = [];
foreach ($items as $item) {
$channelId = intval($item['admin']['channel_id'] ?? 0);
if ($channelId > 0) {
$channelIds[] = $channelId;
}
}
$channelNames = [];
if ($channelIds !== []) {
$channelNames = Db::name('channel')
->whereIn('id', array_values(array_unique($channelIds)))
->column('name', 'id');
}
foreach ($items as &$item) {
$channelId = intval($item['admin']['channel_id'] ?? 0);
$item['channel_name'] = $channelId > 0 ? strval($channelNames[$channelId] ?? '') : '';
}
unset($item);
return $this->success('', [
'list' => $res->items(),
'list' => $items,
'total' => $res->total(),
'remark' => get_route_remark(),
]);