1
This commit is contained in:
@@ -711,6 +711,38 @@ function addUserScoreLog($user_id, $score, $content, $ctime, $act = '+')
|
||||
}
|
||||
|
||||
|
||||
function getPaystationToken()
|
||||
{
|
||||
$client_id = $_ENV['CLIENT_ID'];
|
||||
$client_secret = $_ENV['CLIENT_SECRET'];
|
||||
$access_token_url = $_ENV['API_URL'] . '/oauth/token';
|
||||
$guzzle = new Client(['base_uri' => $access_token_url]);
|
||||
try {
|
||||
$raw_response = $guzzle->post('', [
|
||||
'headers' => ['Content-type' => 'application/json'],
|
||||
'body' => json_encode([
|
||||
'client_id' => $client_id,
|
||||
'client_secret' => $client_secret,
|
||||
'grant_type' => 'client_credentials',
|
||||
'scope' => 'write'
|
||||
]),
|
||||
]);
|
||||
$response = $raw_response->getBody()->getContents();
|
||||
if ($response) {
|
||||
$response_decoded = json_decode($response);
|
||||
if ($response_decoded && isset($response_decoded->access_token)) {
|
||||
return $response_decoded->access_token;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
} catch (\GuzzleHttp\Exception\GuzzleException $e) {
|
||||
//@todo: Replace with your own error handling
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function my_doiToFrag2($data)
|
||||
{
|
||||
$p_refer_obj = Db::name('production_article_refer');
|
||||
|
||||
Reference in New Issue
Block a user