This commit is contained in:
wangjinlei
2023-07-14 15:41:27 +08:00
parent 87464357c2
commit 3f289cebec
7 changed files with 100 additions and 13 deletions

View File

@@ -649,6 +649,22 @@ class Base extends Controller
}
/**创建空production实例应对main和refers
* @return void
*/
public function createEmptyProduction($web_article){
$insert['title'] = $web_article['title'];
$insert['type'] = $web_article['type'];
$ree = explode("/",$web_article['doi']);
$insert['doi'] = isset($ree[1])?$ree[1]:'';
$insert['w_article_id'] = $web_article['article_id'];
$insert['proof_state'] = 2;
$insert['state'] = 2;
return $this->production_article_obj->insertGetId($insert);
}
}
?>

View File

@@ -61,6 +61,21 @@ class Preaccept extends Base
return jsonSuccess([]);
}
/**清空引用文献byp_article_id
* @return void
*/
public function discardRefersByParticleid(){
$data = $this->request->post();
$rule = new Validate([
"p_article_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->production_article_refer_obj->where('p_article_id',$data['p_article_id'])->update(["state"=>1]);
return jsonSuccess([]);
}
/**添加refer
* @return \think\response\Json
* @throws \think\Exception
@@ -84,6 +99,7 @@ class Preaccept extends Base
$insert['p_article_id'] = $p_info['p_article_id'];
$insert['index'] = $pre_refer['index'] + 1;
$insert['ctime'] = time();
$insert['is_change'] = 1;
$insert['refer_type'] = $data['refer_type'];
if($data['refer_type']=="journal"){
$insert['refer_doi'] = isset($data['doi'])?$data['doi']:'';
@@ -230,6 +246,7 @@ class Preaccept extends Base
}
$old_refer_info = $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->find();
$updata['refer_type'] = $data['refer_type'];
$updata['is_change'] = 1;
if($data['refer_type']=="journal"){
$updata['refer_doi'] = isset($data['doi'])?$data['doi']:'';
$updata['author'] = trim($data['author']);

View File

@@ -1323,7 +1323,7 @@ class Production extends Base
return jsonError($rule->getError());
}
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->find();
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
//清空之前的引用条目
$this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->update(['state' => 1]);

View File

@@ -70,9 +70,12 @@ class Publish extends Base
}
$pro_info = $this->production_article_obj->where('doi',$a[1])->where('state',2)->find();
if (!$pro_info){
$pid = $this->createEmptyProduction($v);
$articles[$k]['refers'] = [];
$articles[$k]['p_article_id'] = $pid;
continue;
}
$articles[$k]['p_article_id'] = $pro_info['p_article_id'];
$articles[$k]['refers'] = $this->production_article_refer_obj->where("p_article_id",$pro_info['p_article_id'])->where('state',0)->order("index")->select();
}
@@ -159,6 +162,29 @@ class Publish extends Base
return jsonSuccess($re);
}
/**添加refer通过拷贝word的形式
* @return void
*/
public function addRefersByWord(){
$data = $this->request->post();
$rule = new Validate([
"p_article_id"=>"require",
"contents"=>"require|array"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
foreach ($data['contents'] as $k => $v){
$insert['p_article_id'] = $data['p_article_id'];
$insert['refer_frag'] = $v;
$insert['refer_type'] = "other";
$insert['cs'] = 0;
$insert['index'] = $k;
$this->production_article_refer_obj->insert($insert);
}
return jsonSuccess([]);
}
/**
* 编辑文章的客座期刊信息
*/

View File

@@ -37,6 +37,12 @@ class Ucenter extends Base{
// 基本信息
$baseInfo = $this->user_obj->where(['user_id' => $data['user_id']])->find();
//用户推荐码
if($baseInfo['code']==''){
$d['code'] = $this->creatUserCode($baseInfo['user_id']).$baseInfo['user_id'];
$this->user_obj->where('user_id',$baseInfo['user_id'])->update($d);
}
//检查用户reviewer的info信息
$reviewer_info = $this->user_reviewer_info_obj->where('reviewer_id',$data['user_id'])->find();
if(!$reviewer_info){
@@ -463,18 +469,28 @@ class Ucenter extends Base{
*/
private function getAsAuthor($userId){
// 作者发表文章总数
$user_info = $this->user_obj->where('user_id',$userId)->find();
$manuscriptNum = $this->article_obj->where(['user_id'=>$userId])->count();
$journal = $this->article_obj->field('t_journal.title,t_journal.abbr')
->join('t_journal','t_journal.journal_id = t_article.journal_id','RIGHT')
->where(['user_id'=>$userId])
->distinct('t_article.journal_id')
->select();
//推荐总数
if($user_info['code']!=''){
$tj_num = $this->article_obj->where("code",$user_info['code'])->count();
}else{
$tj_num = 0 ;
}
// 发表文章通过数
$accept = $this->article_obj->where(['user_id'=>$userId,'state'=>5])->count();
$indexs = $this->user_index_log_obj->where('user_id',$userId)->where('state',0)->count();
$res = [
'manuscriptNum'=>$manuscriptNum,
'accept'=>$accept,
"tj"=>$tj_num,
'journal'=>$journal,
'index'=>$indexs
];

View File

@@ -26,16 +26,16 @@ class User extends Base
public function cusercode(){
$data = $this->request->post();
$rule = new Validate([
"num"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->user_obj->where('state',0)->page($data['num'],1000)->select();
// $data = $this->request->post();
// $rule = new Validate([
// "num"=>"require"
// ]);
// if(!$rule->check($data)){
// return jsonError($rule->getError());
// }
$list = $this->user_obj->where('state',0)->select();
foreach ($list as $v){
$d['code'] = $this->creatUserCode($v['user_id']);
$d['code'] = $this->creatUserCode($v['user_id']).$v['user_id'];
$this->user_obj->where('user_id',$v['user_id'])->update($d);
}
echo 'done';

View File

@@ -95,9 +95,9 @@ class Web extends Base
}
$article_info = $this->article_obj->where('article_id',$p_info['article_id'])->find();
//只显示2023年5。1之后的文章流程
if($article_info['rtime']<1682870400){
return jsonError("time error");
}
// if($article_info['rtime']<1682870400){
// return jsonError("time error");
// }
$msgs = $this->article_msg_obj->where('article_id',$article_info['article_id'])->select();
@@ -143,6 +143,18 @@ class Web extends Base
];
}
//没有接收。添加
//如果没有proof增加
if($p_info['proof_stime']>0){
$frag[] = [
"type"=>7,
"time"=>$p_info['proof_stime']
];
}
//没有online添加
//冒泡排序法
for ($i = 0; $i < count($frag) -1; $i++) {//循环对比的轮数
for ($j = 0; $j < count($frag) - $i - 1; $j++) {//当前轮相邻元素循环对比