新增期卷号处理
This commit is contained in:
@@ -850,6 +850,29 @@ function my_doiToFrag2($data)
|
|||||||
$update['refer_type'] = "journal";
|
$update['refer_type'] = "journal";
|
||||||
$update['is_ja'] = $joura == trim($bj[0]) ? 0 : 1;
|
$update['is_ja'] = $joura == trim($bj[0]) ? 0 : 1;
|
||||||
$update['dateno'] = str_replace(' ', '', str_replace('-', '–', trim($bj[1])));
|
$update['dateno'] = str_replace(' ', '', str_replace('-', '–', trim($bj[1])));
|
||||||
|
//新增处理 期卷页码 20251127 start
|
||||||
|
if(!empty($update['dateno'])){
|
||||||
|
$sStr = $update['dateno'];
|
||||||
|
$aStr = explode(':', $sStr);
|
||||||
|
if(!empty($aStr[1])){
|
||||||
|
$parts = explode('–', $aStr[1]);
|
||||||
|
if(count($parts) == 2){
|
||||||
|
$prefix = empty($parts[0]) ? 0 : intval($parts[0]);
|
||||||
|
$suffix = empty($parts[1]) ? 0 : intval($parts[1]);
|
||||||
|
if($prefix > $suffix){
|
||||||
|
$prefixLen = strlen($prefix);
|
||||||
|
$suffixLen = strlen($sufix);
|
||||||
|
$missingLen = $prefixLen - $suffixLen;
|
||||||
|
if ($missingLen > 0) {
|
||||||
|
$fillPart = substr($prefix, 0, $missingLen);
|
||||||
|
$newSuffix = $fillPart . $suffix;
|
||||||
|
$update['dateno'] = $aStr[0].':'.$prefix.'-'.$newSuffix;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//新增处理 期卷页码 20251127 end
|
||||||
$update['doilink'] = strpos($data['refer_doi'],"http")===false?"https://doi.org/" . $data['refer_doi']:$data['refer_doi'];
|
$update['doilink'] = strpos($data['refer_doi'],"http")===false?"https://doi.org/" . $data['refer_doi']:$data['refer_doi'];
|
||||||
$update['cs'] = 1;
|
$update['cs'] = 1;
|
||||||
}
|
}
|
||||||
@@ -998,27 +1021,54 @@ function aliemail($email,$title,$content,$has_hb=1){
|
|||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function paystationLookup($transactionId){
|
//function paystationLookup($transactionId){
|
||||||
$curl = curl_init();
|
// $curl = curl_init();
|
||||||
curl_setopt_array($curl, array(
|
// curl_setopt_array($curl, array(
|
||||||
CURLOPT_URL => 'https://api.paystation.co.nz/v1/transactions/'.$transactionId,
|
// CURLOPT_URL => 'https://api.paystation.co.nz/v1/transactions/'.$transactionId,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
// CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => '',
|
// CURLOPT_ENCODING => '',
|
||||||
CURLOPT_MAXREDIRS => 10,
|
// CURLOPT_MAXREDIRS => 10,
|
||||||
CURLOPT_TIMEOUT => 0,
|
// CURLOPT_TIMEOUT => 0,
|
||||||
CURLOPT_FOLLOWLOCATION => true,
|
// CURLOPT_FOLLOWLOCATION => true,
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
// CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
// CURLOPT_CUSTOMREQUEST => 'GET',
|
||||||
CURLOPT_HTTPHEADER => array(
|
// CURLOPT_HTTPHEADER => array(
|
||||||
'Content-Type: application/json',
|
// 'Content-Type: application/json',
|
||||||
'Authorization: Bearer '.createPayStationToken()
|
// 'Authorization: Bearer '.createPayStationToken()
|
||||||
)
|
// )
|
||||||
));
|
// ));
|
||||||
$response = curl_exec($curl);
|
// $response = curl_exec($curl);
|
||||||
curl_close($curl);
|
// curl_close($curl);
|
||||||
|
// return $response;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
function paystationLookup($ms){
|
||||||
|
$url = "https://payments.paystation.co.nz/lookup/";
|
||||||
|
$time = time();
|
||||||
|
$params = [
|
||||||
|
"pi" => "616562",
|
||||||
|
"ms" => $ms,
|
||||||
|
"pstn_HMACTimestamp" => $time
|
||||||
|
];
|
||||||
|
$secret_key = Env::get("paystation.hmac");// 使用提供的HMAC认证密钥
|
||||||
|
$query_string = http_build_query($params);
|
||||||
|
$hmac_signature = hash_hmac('sha256', $time."paystation".$query_string,$secret_key);
|
||||||
|
$params["pstn_HMAC"] = $hmac_signature;
|
||||||
|
$url_with_params = $url . '?' . http_build_query($params);
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $url_with_params);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if(curl_errno($ch)) {
|
||||||
|
echo 'Error:' . curl_error($ch);
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function createPayStationToken(){
|
function createPayStationToken(){
|
||||||
$bodyParams = [
|
$bodyParams = [
|
||||||
'client_id' => Env::get("paystation.client_id"),
|
'client_id' => Env::get("paystation.client_id"),
|
||||||
@@ -1122,7 +1172,7 @@ function add_usermsg($userid, $content, $url)
|
|||||||
return $msg_obj->insert($msgdata);
|
return $msg_obj->insert($msgdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
function jsonSuccess($data)
|
function jsonSuccess($data=[])
|
||||||
{
|
{
|
||||||
return json(['code' => 0, 'msg' => 'success', 'data' => $data]);
|
return json(['code' => 0, 'msg' => 'success', 'data' => $data]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user