This commit is contained in:
wangjinlei
2024-11-13 16:10:14 +08:00
parent ef91e9de61
commit 11560a503c
4 changed files with 108 additions and 47 deletions

View File

@@ -579,23 +579,21 @@ class User extends Base
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'realname'=>'require',
'wos_index'=>'require',
'google_index'=>'require'
'realname'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
$updata = [];
if($data['wos_index']!=$user_info['wos_index']){
$updata['wos_index'] = $data['wos_index'];
$updata['wos_time'] = time();
}
if($data['google_index']!=$user_info['google_index']){
$updata['google_index'] = $data['google_index'];
$updata['google_time'] = time();
}
// if($data['wos_index']!=$user_info['wos_index']){
// $updata['wos_index'] = $data['wos_index'];
// $updata['wos_time'] = time();
// }
// if($data['google_index']!=$user_info['google_index']){
// $updata['google_index'] = $data['google_index'];
// $updata['google_time'] = time();
// }
$updata['realname'] = trim($data['realname']);
$updata['localname'] = trim($data['localname']);
if(count($updata)>0){
@@ -604,6 +602,42 @@ class User extends Base
return jsonSuccess([]);
}
/**修改用户scopus的H指数
* @return void
*/
public function editUserIndex(){
$data = $this->request->post();
$rule = new Validate([
"type"=>"require",
"user_id"=>"require",
"editor_id"=>"require",
"index"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$user_info = $this->user_obj->where("user_id",$data['user_id'])->find();
$editor_info = $this->user_obj->where("user_id",$data['editor_id'])->find();
if($data['type']==0){//wos
$user_info['wos_index'] = $data['index'];
$user_info['wos_time'] = time();
}elseif ($data['type']==1){//scopus
$user_info['scopus_index'] = $data['index'];
$user_info['scopus_time'] = time();
$user_info['scopus_website'] = $data['website'];
$user_info['scopus_editor'] = $editor_info['realname'];
}else{//google
$user_info['google_index'] = $data['index'];
$user_info['google_time'] = time();
$user_info['g_author'] = $data['g_author'];
$user_info['g_website'] = $data['website'];
$user_info['google_editor'] = $editor_info['realname'];
}
$this->user_obj->update($user_info);
return jsonSuccess($user_info);
}
/**
* 编辑灰库人员信息
*/