优化管理员管理目录中菜单的样式
This commit is contained in:
@@ -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(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user