接口调整
This commit is contained in:
@@ -37,14 +37,17 @@ class Preaccept extends Base
|
|||||||
}
|
}
|
||||||
$dois = $this->production_article_refer_obj->where("p_article_id", $production_info['p_article_id'])->where("refer_doi","<>","")->where("state",0)->group("refer_doi")->having("count(*)>1")->column("refer_doi");
|
$dois = $this->production_article_refer_obj->where("p_article_id", $production_info['p_article_id'])->where("refer_doi","<>","")->where("state",0)->group("refer_doi")->having("count(*)>1")->column("refer_doi");
|
||||||
$list = $this->production_article_refer_obj->where("p_article_id", $production_info['p_article_id'])->where('state', 0)->order("index")->select();
|
$list = $this->production_article_refer_obj->where("p_article_id", $production_info['p_article_id'])->where('state', 0)->order("index")->select();
|
||||||
|
$aRepeat = [];
|
||||||
foreach ($list as $k => $v){
|
foreach ($list as $k => $v){
|
||||||
if(in_array($v['refer_doi'],$dois)){
|
if(in_array($v['refer_doi'],$dois)){
|
||||||
$list[$k]['is_repeat'] = 1;
|
$list[$k]['is_repeat'] = 1;
|
||||||
|
$aRepeat[$v['refer_doi']][] = $v['index'];
|
||||||
}else{
|
}else{
|
||||||
$list[$k]['is_repeat'] = 0;
|
$list[$k]['is_repeat'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$re["refers"] = $list;
|
$re["refers"] = $list;
|
||||||
|
$re['repeat'] = empty($aRepeat) ? [] : $aRepeat;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -752,44 +755,23 @@ class Preaccept extends Base
|
|||||||
}
|
}
|
||||||
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
||||||
$journal_info = $this->journal_obj->where("journal_id",$article_info['journal_id'])->find();
|
$journal_info = $this->journal_obj->where("journal_id",$article_info['journal_id'])->find();
|
||||||
if(intval($journal_info['fee'])==0||$article_info['ctime']<1735660800){//非收费期刊的文章直接返回
|
|
||||||
$re['state'] = 1;
|
|
||||||
$re['order'] = null;
|
|
||||||
$re["fee"] = 0;
|
|
||||||
return jsonSuccess($re);
|
|
||||||
}
|
|
||||||
$order_info = $this->order_obj->where("article_id",$article_info['article_id'])->find();
|
$order_info = $this->order_obj->where("article_id",$article_info['article_id'])->find();
|
||||||
if($order_info==null){//这里有疑问
|
$paystation = $this->paystation_obj->where("ps_id",$order_info['ps_id'])->find();
|
||||||
$re['state'] = 1;
|
$order_info['paystation'] = $paystation;
|
||||||
$re['order'] = null;
|
if($order_info['state']==0){
|
||||||
$re["fee"] = 0;
|
$res = xml_to_array(paystationLookup($paystation['merchant_session']));
|
||||||
return jsonSuccess($re);
|
if(isset($res['PaystationQuickLookup']['LookupResponse']['Authentication']['auth_Status'])&&$res['PaystationQuickLookup']['LookupResponse']['Authentication']['auth_Status']=="Y"){
|
||||||
}
|
$this->article_obj->where("article_id",$order_info['article_id'])->update(['is_buy'=>1]);
|
||||||
// if($order_info['pay_type']==2){
|
$this->order_obj->where("order_id",$order_info['order_id'])->update(['state'=>1]);
|
||||||
$paystation = $this->paystation_obj->where("ps_id",$order_info['ps_id'])->find();
|
$article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
|
||||||
$order_info['paystation'] = $paystation;
|
|
||||||
if($order_info['state']==0){
|
|
||||||
$res = object_to_array(json_decode(paystationLookup($paystation['transaction_id'])));
|
|
||||||
if(isset($res['result']['success'])&&$res['result']['success']){
|
|
||||||
$this->article_obj->where("article_id",$order_info['article_id'])->update(['is_buy'=>1]);
|
|
||||||
$this->order_obj->where("order_id",$order_info['order_id'])->update(['state'=>1]);
|
|
||||||
$re['state'] = 1;
|
|
||||||
$re['fee'] = $journal_info['fee'];
|
|
||||||
$re['order'] = $order_info;
|
|
||||||
return jsonSuccess($re);
|
|
||||||
}else{
|
|
||||||
$re['state'] = 0;
|
|
||||||
$re['fee'] = $journal_info['fee'];
|
|
||||||
$re['order'] = $order_info;
|
|
||||||
return jsonSuccess($re);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$re['state'] = 1;
|
|
||||||
$re['fee'] = $journal_info['fee'];
|
|
||||||
$re['order'] = $order_info;
|
|
||||||
return jsonSuccess($re);
|
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
|
$re['state'] = $article_info['is_buy'];
|
||||||
|
$re['order'] = $order_info;
|
||||||
|
$re["fee"] = $article_info['fee'];
|
||||||
|
$re['article'] = $article_info;
|
||||||
|
$re['journal'] = $journal_info;
|
||||||
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1633,9 +1615,9 @@ return null;
|
|||||||
if(empty($p_article_id)){
|
if(empty($p_article_id)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
//查询参考文献
|
// //查询参考文献
|
||||||
$aWhere = ['p_article_id' => $p_article_id,'article_id' => $article_id,'state' => 0,'refer_doi' => ['<>','']];
|
// $aWhere = ['p_article_id' => $p_article_id,'article_id' => $article_id,'state' => 0,'refer_doi' => ['<>','']];
|
||||||
$aRefer = Db::name('production_article_refer')->where($aWhere)->column('refer_doi');
|
// $aRefer = Db::name('production_article_refer')->where($aWhere)->column('refer_doi');
|
||||||
$extension = substr($afile, strrpos($afile, '.') + 1);
|
$extension = substr($afile, strrpos($afile, '.') + 1);
|
||||||
vendor("PHPExcel.PHPExcel");
|
vendor("PHPExcel.PHPExcel");
|
||||||
if ($extension == 'xlsx') {
|
if ($extension == 'xlsx') {
|
||||||
@@ -1660,13 +1642,13 @@ return null;
|
|||||||
}
|
}
|
||||||
$aa['refer_doi'] = trim($aa['refer_doi']);
|
$aa['refer_doi'] = trim($aa['refer_doi']);
|
||||||
$aa['refer_content'] = trim($aa['refer_content']);
|
$aa['refer_content'] = trim($aa['refer_content']);
|
||||||
//判断是否添加过
|
// //判断是否添加过
|
||||||
$doiLinkPattern = '/^(https?:\/\/)?([a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+\.[a-zA-Z]{2,}(\/.*)?$/i';
|
// $doiLinkPattern = '/^(https?:\/\/)?([a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+\.[a-zA-Z]{2,}(\/.*)?$/i';
|
||||||
if(preg_match($doiLinkPattern, $aa['refer_doi'], $matches)){
|
// if(preg_match($doiLinkPattern, $aa['refer_doi'], $matches)){
|
||||||
if(in_array($aa['refer_doi'], $aRefer)){
|
// if(in_array($aa['refer_doi'], $aRefer)){
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
$aa['p_article_id'] = $p_article_id;
|
$aa['p_article_id'] = $p_article_id;
|
||||||
$aa['article_id'] = $article_id;
|
$aa['article_id'] = $article_id;
|
||||||
$aa['index'] = $k;
|
$aa['index'] = $k;
|
||||||
@@ -1674,7 +1656,7 @@ return null;
|
|||||||
$aa['index'] = $k;
|
$aa['index'] = $k;
|
||||||
$aa['refer_frag'] = $aa['refer_content'];
|
$aa['refer_frag'] = $aa['refer_content'];
|
||||||
$aa['refer_type'] = 'other';
|
$aa['refer_type'] = 'other';
|
||||||
$aa['is_change'] = 2;
|
$aa['is_deal'] = 2;
|
||||||
$k++;
|
$k++;
|
||||||
$frag[] = $aa;
|
$frag[] = $aa;
|
||||||
}
|
}
|
||||||
@@ -1697,23 +1679,30 @@ return null;
|
|||||||
}
|
}
|
||||||
//查询参考文献数据
|
//查询参考文献数据
|
||||||
$aWhere = ['p_article_id' => $iPArticleId,'article_id' => $iArticleId,'state' => 0];
|
$aWhere = ['p_article_id' => $iPArticleId,'article_id' => $iArticleId,'state' => 0];
|
||||||
$iCount = Db::name('production_article_refer')->where($aWhere)->count();
|
$aRefer = Db::name('production_article_refer')->where($aWhere)->select();
|
||||||
if(empty($iCount)){
|
if(empty($aRefer)){
|
||||||
return json_encode(array('status' => 3,'msg' => 'Reference is empty','data' => ['total' => 0,'unprocessed_total' => 0,'processed_total' => 0]));
|
return json_encode(array('status' => 3,'msg' => 'Reference is empty','data' => ['total' => 0,'unprocessed_total' => 0,'processed_total' => 0]));
|
||||||
}
|
}
|
||||||
//获取未处理的数据
|
//获取总数量
|
||||||
$aWhere['is_deal'] = 2;
|
$iCount = empty($aRefer) ? 0 : count($aRefer);
|
||||||
$aUnprocessed = Db::name('production_article_refer')->where($aWhere)->select();
|
$aWhere["refer_doi"] = ["<>",""];
|
||||||
//获取已处理的数据
|
$aDoi = Db::name('production_article_refer')->field('count(p_article_id) as num,refer_doi')->where($aWhere)->group('refer_doi')->select();
|
||||||
$aWhere['is_deal'] = 1;
|
$aDoi = empty($aDoi) ? [] : array_column($aDoi, 'num','refer_doi');
|
||||||
$aProcessed = Db::name('production_article_refer')->where($aWhere)->select();
|
//数据处理
|
||||||
//未处理的数量
|
$iUnprocessed = $iProcessed = 0;
|
||||||
$iUnprocessed = empty($aUnprocessed) ? 0 : count($aUnprocessed);
|
foreach ($aRefer as $key => $value) {
|
||||||
//已处理的数量
|
if($value['is_deal'] == 1){
|
||||||
$iProcessed = empty($aProcessed) ? 0 : count($aProcessed);
|
$iProcessed++;
|
||||||
|
}
|
||||||
//数据组合
|
if($value['is_deal'] == 2){
|
||||||
$aRefer = array_merge($aUnprocessed,$aProcessed);
|
$iUnprocessed++;
|
||||||
|
}
|
||||||
|
$iIsRepat = 0;
|
||||||
|
if(!empty($value['refer_doi']) && (!empty($aDoi[$value['refer_doi']]) && $aDoi[$value['refer_doi']] > 1)){
|
||||||
|
$iIsRepat = 1;
|
||||||
|
}
|
||||||
|
$aRefer[$key]['is_repeat'] = $iIsRepat;
|
||||||
|
}
|
||||||
$aRefer = ['total' => $iCount,'unprocessed_total' => $iUnprocessed,'processed_total' => $iProcessed,'refer' => $aRefer];
|
$aRefer = ['total' => $iCount,'unprocessed_total' => $iUnprocessed,'processed_total' => $iProcessed,'refer' => $aRefer];
|
||||||
return json_encode(['status' => 1,'msg' => 'success','data' => $aRefer]);
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aRefer]);
|
||||||
}
|
}
|
||||||
@@ -1733,10 +1722,10 @@ return null;
|
|||||||
if(empty($aArticle)){
|
if(empty($aArticle)){
|
||||||
return jsonError('No article information found');
|
return jsonError('No article information found');
|
||||||
}
|
}
|
||||||
$iIsBuy = empty($aArticle['is_buy']) ? 0 : $aArticle['is_buy'];
|
// $iIsBuy = empty($aArticle['is_buy']) ? 0 : $aArticle['is_buy'];
|
||||||
if($iIsBuy != 1){
|
// if($iIsBuy != 1){
|
||||||
return jsonError('Article unpaid');
|
// return jsonError('Article unpaid');
|
||||||
}
|
// }
|
||||||
$aWhere = ['article_id' => $iArticleId,'state' => 0];
|
$aWhere = ['article_id' => $iArticleId,'state' => 0];
|
||||||
$aProductionArticle = $this->production_article_obj->field('p_article_id')->where($aWhere)->find();
|
$aProductionArticle = $this->production_article_obj->field('p_article_id')->where($aWhere)->find();
|
||||||
if(!empty($aProductionArticle)) {
|
if(!empty($aProductionArticle)) {
|
||||||
@@ -1751,4 +1740,5 @@ return null;
|
|||||||
}
|
}
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user