This commit is contained in:
wangjinlei
2022-09-29 07:50:12 +08:00
parent 63d4ffffaf
commit 949fa3f9b3
5 changed files with 121 additions and 9 deletions

View File

@@ -5,6 +5,7 @@ namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Validate;
/**
* @title 编委相关接口
@@ -33,6 +34,8 @@ class Board extends Controller {
protected $chief_msg_obj = '';
protected $article_to_board_obj = '';
protected $login_auto_obj = '';
protected $user_index_obj = '';
protected $user_email_index_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
@@ -58,6 +61,8 @@ class Board extends Controller {
$this->article_to_board_obj = Db::name('article_to_board');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->login_auto_obj = Db::name('login_auto');
$this->user_index_obj = Db::name('user_index');
$this->user_email_index_obj = Db::name('user_email_index');
}
/**
@@ -258,6 +263,33 @@ class Board extends Controller {
$re['reviewers'] = $revs;
return jsonSuccess($re);
}
/**
* 编辑/添加H指数
*/
public function editIndex(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'year'=>'require',
'index'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$check = $this->user_index_obj->where('user_id',$data['user_id'])->where('year',$data['year'])->where('state',0)->find();
if($check){
$this->user_index_obj->where('in_id',$check['in_id'])->update(['h_index'=>$data['index']]);
}else{
$insert['user_id'] = $data['user_id'];
$insert['year'] = $data['year'];
$insert['h_index'] = $data['index'];
$this->user_index_obj->insert($insert);
}
return jsonSuccess([]);
}
/**
* @title 编委导入--通过账号搜索用户