update: dump csv

This commit is contained in:
Tokumeikoi 2020-10-14 19:42:08 +08:00
parent 1116c7ef28
commit be3e808551
5 changed files with 21 additions and 19 deletions

View File

@ -124,7 +124,7 @@ class UserController extends Controller
$data = "邮箱,余额,推广佣金,总流量,剩余流量,套餐到期时间,订阅计划,订阅地址\r\n"; $data = "邮箱,余额,推广佣金,总流量,剩余流量,套餐到期时间,订阅计划,订阅地址\r\n";
$baseUrl = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))); $baseUrl = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL')));
foreach($res as $user) { foreach($res as $user) {
$expireDate = $user['expired_at'] === NULL ? '长期有效' : $user['expired_at']; $expireDate = $user['expired_at'] === NULL ? '长期有效' : date('Y-m-d H:i:s', $user['expired_at']);
$balance = $user['balance'] / 100; $balance = $user['balance'] / 100;
$commissionBalance = $user['commission_balance'] / 100; $commissionBalance = $user['commission_balance'] / 100;
$transferEnable = $user['transfer_enable'] ? $user['transfer_enable'] / 1073741824 : 0; $transferEnable = $user['transfer_enable'] ? $user['transfer_enable'] / 1073741824 : 0;
@ -197,12 +197,14 @@ class UserController extends Controller
abort(500, '生成失败'); abort(500, '生成失败');
} }
DB::commit(); DB::commit();
$data = "账号,密码,过期时间,UUID,创建时间\r\n"; $data = "账号,密码,过期时间,UUID,创建时间,订阅地址\r\n";
$baseUrl = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL')));
foreach($users as $user) { foreach($users as $user) {
$expireDate = $user['expired_at'] === NULL ? '长期有效' : $user['expired_at']; $expireDate = $user['expired_at'] === NULL ? '长期有效' : date('Y-m-d H:i:s', $user['expired_at']);
$createDate = date('Y-m-d H:i:s', $user['created_at']); $createDate = date('Y-m-d H:i:s', $user['created_at']);
$password = $request->input('password') ?? $user['email']; $password = $request->input('password') ?? $user['email'];
$data .= "{$user['email']},{$password},{$expireDate},{$user['uuid']},{$createDate}\r\n"; $subscribeUrl = $baseUrl . '/api/v1/client/subscribe?token=' . $user['token'];
$data .= "{$user['email']},{$password},{$expireDate},{$user['uuid']},{$createDate},{$subscribeUrl}\r\n";
} }
echo $data; echo $data;
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long