1
This commit is contained in:
@@ -569,6 +569,92 @@ class Preaccept extends Base
|
|||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function changeH1(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"am_id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||||
|
//上一行,空行
|
||||||
|
$p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select();
|
||||||
|
if($p_list[0]['type']>0||$p_list[0]['content']!=""){
|
||||||
|
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
|
||||||
|
}
|
||||||
|
$n_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort",">",$am_info['sort'])->whereIn("state",[0,2])->order("sort asc")->limit(1)->select();
|
||||||
|
if($n_list[0]['type']>0||$n_list[0]['content']!=""){
|
||||||
|
$this->addBRow($am_info['article_id'],$data['am_id']);
|
||||||
|
}
|
||||||
|
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1]);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeH2(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"am_id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
|
||||||
|
//上一行,空行
|
||||||
|
$p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select();
|
||||||
|
if($p_list[0]['type']>0||$p_list[0]['content']!=""){
|
||||||
|
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
|
||||||
|
}
|
||||||
|
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h2"=>1]);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function changeH3(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"am_id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h3"=>1]);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addBlankRow(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"article_id"=>"require",
|
||||||
|
"am_id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$this->addBRow($data['article_id'],$data['am_id']);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function addBRow($article_id,$am_id){
|
||||||
|
if($am_id==0){//顶行
|
||||||
|
$this->article_main_obj->where("article_id",$article_id)->whereIn("state",[0,2])->inc("sort",1);
|
||||||
|
$insert['article_id'] = $article_id;
|
||||||
|
$insert['content'] = "";
|
||||||
|
$insert['sort'] = 1;
|
||||||
|
$insert['ctime'] = time();
|
||||||
|
$this->article_main_obj->insert($insert);
|
||||||
|
}else{
|
||||||
|
$am_info = $this->article_main_obj->where("am_id",$am_id)->find();
|
||||||
|
$this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->whereIn("state",[0,2])->inc("sort",1);
|
||||||
|
$insert['article_id'] = $article_id;
|
||||||
|
$insert['content'] = "";
|
||||||
|
$insert['sort'] = $am_info['sort']+1;
|
||||||
|
$insert['ctime'] = time();
|
||||||
|
$this->article_main_obj->insert($insert);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getMainImages(){
|
public function getMainImages(){
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
|
|||||||
@@ -1617,7 +1617,16 @@ class Production extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testtest(){
|
public function testtest(){
|
||||||
$this->doiTofrag(7);
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
"id"=>"require"
|
||||||
|
]);
|
||||||
|
if(!$rule->check($data)){
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$d = $this->production_article_refer_obj->where("p_refer_id",$data['id'])->find();
|
||||||
|
$res = my_doiToFrag2($d);
|
||||||
|
return jsonSuccess($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function doiTofrag($p_article_id)
|
public function doiTofrag($p_article_id)
|
||||||
|
|||||||
@@ -539,11 +539,13 @@ function myGet($url)
|
|||||||
curl_setopt($oCurl, CURLOPT_BINARYTRANSFER, true); //在启用CURLOPT_RETURNTRANSFER时候将获取数据返回
|
curl_setopt($oCurl, CURLOPT_BINARYTRANSFER, true); //在启用CURLOPT_RETURNTRANSFER时候将获取数据返回
|
||||||
$sContent = curl_exec($oCurl);
|
$sContent = curl_exec($oCurl);
|
||||||
$aStatus = curl_getinfo($oCurl); //获取页面各种信息
|
$aStatus = curl_getinfo($oCurl); //获取页面各种信息
|
||||||
|
$err = curl_error($oCurl);
|
||||||
curl_close($oCurl);
|
curl_close($oCurl);
|
||||||
if (intval($aStatus["http_code"]) == 200) {
|
if (intval($aStatus["http_code"]) == 200) {
|
||||||
return $sContent;
|
return $sContent;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return $err;
|
||||||
|
// return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -717,7 +719,8 @@ function my_doiToFrag2($data)
|
|||||||
}
|
}
|
||||||
$doi = str_replace('/', '%2F', $data['refer_doi']);
|
$doi = str_replace('/', '%2F', $data['refer_doi']);
|
||||||
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
// $url = "https://citation.crosscite.org/format?doi=$doi&style=american-veterinary-medical-association&lang=en-US";
|
||||||
$url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
|
// $url = "https://citation.crosscite.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
|
||||||
|
$url = "https://citation.doi.org/format?doi=$doi&style=cancer-translational-medicine&lang=en-US";
|
||||||
$res = myGet($url);
|
$res = myGet($url);
|
||||||
$frag = trim(substr($res, strpos($res, '.') + 1));
|
$frag = trim(substr($res, strpos($res, '.') + 1));
|
||||||
$update = [];
|
$update = [];
|
||||||
@@ -730,7 +733,6 @@ function my_doiToFrag2($data)
|
|||||||
if (mb_substr_count($frag, '.') != 3) {
|
if (mb_substr_count($frag, '.') != 3) {
|
||||||
$f = $frag . " Available at: " . PHP_EOL . "http://doi.org/" . $data['refer_doi'];
|
$f = $frag . " Available at: " . PHP_EOL . "http://doi.org/" . $data['refer_doi'];
|
||||||
$update['refer_frag'] = $f;
|
$update['refer_frag'] = $f;
|
||||||
$update['refer_type'] = "other";
|
|
||||||
$update['cs'] = 1;
|
$update['cs'] = 1;
|
||||||
} else {
|
} else {
|
||||||
$res = explode('.', $frag);
|
$res = explode('.', $frag);
|
||||||
@@ -750,6 +752,7 @@ function my_doiToFrag2($data)
|
|||||||
}
|
}
|
||||||
$p_refer_obj->where('p_refer_id', $data['p_refer_id'])->update($update);
|
$p_refer_obj->where('p_refer_id', $data['p_refer_id'])->update($update);
|
||||||
$p_refer_obj->getConnection()->close();
|
$p_refer_obj->getConnection()->close();
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bekjournal($str)
|
function bekjournal($str)
|
||||||
|
|||||||
Reference in New Issue
Block a user