This commit is contained in:
wangjinlei
2022-09-29 18:12:49 +08:00
5 changed files with 123 additions and 9 deletions

View File

@@ -33,6 +33,8 @@ class User extends Controller
protected $article_author_obj = '';
protected $user_black_obj = '';
protected $user_to_special_obj = '';
protected $user_index_obj = '';
protected $user_email_index_obj = '';
public function __construct(\think\Request $request = null)
{
@@ -53,6 +55,8 @@ class User extends Controller
$this->article_author_obj = Db::name('article_author');
$this->user_black_obj = Db::name('user_black');
$this->user_to_special_obj = Db::name('user_to_special');
$this->user_index_obj = Db::name('user_index');
$this->user_email_index_obj = Db::name('user_email_index');
}
public function pstest(){
@@ -580,6 +584,52 @@ class User extends Controller
return jsonSuccess([]);
}
/**
* 编辑/添加指数by邮箱
*/
public function editIndexByEmail(){
$data = $this->request->post();
$rule = new Validate([
'email'=>'require',
'year'=>'require',
'index'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$check = $this->user_email_index_obj->where('email',$data['email'])->where('year',$data['year'])->where('state',0)->find();
if($check){
$this->user_email_index_obj->where('ein_id',$check['ein_id'])->update(['h_index'=>$data['index']]);
}else{
$insert['email'] = $data['email'];
$insert['year'] = $data['year'];
$insert['h_index'] = $data['index'];
$this->user_email_index_obj->insert($insert);
}
return jsonSuccess([]);
}
/**
* 获取指数通过邮箱
*/
public function getIndexByEmail(){
$data = $this->request->post();
$rule = new Validate([
'email'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->user_email_index_obj
->where('email',$data['email'])
->where('state',0)
->order('year')
->select();
$re['indexs'] = $list;
return jsonSuccess($re);
}
/**
* @title 降级青年编委至审稿人
* @description 降级青年编委至审稿人