update: new feature

This commit is contained in:
tokumeikoi 2021-07-31 02:05:39 +09:00
parent 1adb1bcfa0
commit ebf98d42a8
5 changed files with 14 additions and 9 deletions

View File

@ -68,7 +68,7 @@ class UserController extends Controller
$res[$i]['plan_name'] = $plan[$k]['name'];
}
}
$res[$i]['subscribe_url'] = config('v2board.subscribe_url', config('v2board.app_url', env('APP_URL'))) . '/api/v1/client/subscribe?token=' . $res[$i]['token'];
$res[$i]['subscribe_url'] = Helper::getSubscribeHost() . '/api/v1/client/subscribe?token=' . $res[$i]['token'];
}
return response([
'data' => $res,

View File

@ -118,12 +118,7 @@ class UserController extends Controller
abort(500, __('Subscription plan does not exist'));
}
}
$subscribeUrl = config('v2board.app_url');
$subscribeUrls = explode(',', config('v2board.subscribe_url'));
if ($subscribeUrls && $subscribeUrls[0]) {
$subscribeUrl = $subscribeUrls[rand(0, count($subscribeUrls) - 1)];
}
$user['subscribe_url'] = "{$subscribeUrl}/api/v1/client/subscribe?token={$user['token']}";
$user['subscribe_url'] = Helper::getSubscribeHost() . "/api/v1/client/subscribe?token={$user['token']}";
$user['reset_day'] = $this->getResetDay($user);
return response([
'data' => $user

View File

@ -95,4 +95,14 @@ class Helper
return round($byte, 2) . ' B';
}
}
public static function getSubscribeHost()
{
$subscribeUrl = config('v2board.app_url');
$subscribeUrls = explode(',', config('v2board.subscribe_url'));
if ($subscribeUrls && $subscribeUrls[0]) {
$subscribeUrl = $subscribeUrls[rand(0, count($subscribeUrls) - 1)];
}
return $subscribeUrl;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long