mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
feature: dump csv
This commit is contained in:
parent
7a2967f41c
commit
a00eca2fda
@ -107,7 +107,7 @@ class UserController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
public function dumpCSV(Request $request)
|
||||
{
|
||||
$userModel = new User();
|
||||
$this->filter($request, $userModel);
|
||||
@ -120,6 +120,20 @@ class UserController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = "邮箱,余额,推广佣金,总流量,剩余流量,套餐到期时间,订阅计划,订阅地址\r\n";
|
||||
$baseUrl = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL')));
|
||||
foreach($res as $user) {
|
||||
$expireDate = $user['expired_at'] === NULL ? '长期有效' : $user['expired_at'];
|
||||
$balance = $user['balance'] / 100;
|
||||
$commissionBalance = $user['commission_balance'] / 100;
|
||||
$transferEnable = $user['transfer_enable'] ? $user['transfer_enable'] / 1073741824 : 0;
|
||||
$notUseFlow = (($user['transfer_enable'] - ($user['u'] + $user['d'])) / 1073741824) ?? 0;
|
||||
$planName = $user['plan_name'] ?? '无订阅';
|
||||
$subscribeUrl = $baseUrl . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||
$data .= "{$user['email']},{$balance},{$commissionBalance},{$transferEnable},{$notUseFlow},{$expireDate},{$planName},{$subscribeUrl}\r\n";
|
||||
}
|
||||
echo $data;
|
||||
}
|
||||
|
||||
public function generate(UserGenerate $request)
|
||||
|
@ -68,6 +68,7 @@ class AdminRoute
|
||||
$router->post('/user/update', 'Admin\\UserController@update');
|
||||
$router->get ('/user/getUserInfoById', 'Admin\\UserController@getUserInfoById');
|
||||
$router->post('/user/generate', 'Admin\\UserController@generate');
|
||||
$router->post('/user/dumpCSV', 'Admin\\UserController@dumpCSV');
|
||||
// Stat
|
||||
$router->get ('/stat/getOverride', 'Admin\\StatController@getOverride');
|
||||
// Notice
|
||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user