where('enable', 1)->get(); # 获取书城信息 $platformList = config('platform'); foreach ($list as $item) { # 处理书城信息 $item->platform = isset($platformList[$item->platform_id]) ? $platformList[$item->platform_id] : '未知'; # 处理公众账号信息 $accountInfo = $accountList->where('platform_id', $item->platform_id) ->where('channel_id', $item->channel_id) ->first(); $item->nickname = isset($accountInfo->nickname) ? $accountInfo->nickname : '-'; # 处理价格信息 $item->price = $item->price / 100; # 处理下单时间 $platformCreatedAt = strtotime($item->platform_created_at); $item->platform_created_at = $platformCreatedAt ? date('Y-m-d', $platformCreatedAt) : ''; # 处理注册时间 $userCreatedAt = strtotime($item->user_created_at); $item->user_created_at = $userCreatedAt ? date('Y-m-d', $userCreatedAt) : ''; } return [$list, $count, $accountList, $platformList, $condition]; } }