This commit is contained in:
wangjinlei
2022-11-04 13:30:16 +08:00
parent 6058d5d32f
commit 45532ef702
7 changed files with 102 additions and 112 deletions

View File

@@ -33,8 +33,6 @@ 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 = '';
protected $user_register_check_obj = '';
public function __construct(\think\Request $request = null)
@@ -56,8 +54,6 @@ 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');
$this->user_register_check_obj = Db::name('user_register_check');
}
@@ -153,6 +149,35 @@ class User extends Controller
}
}
/**
* 编辑用户指数信息
*/
public function editUserMsg(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'wos_index'=>'require',
'google_index'=>'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(count($updata)>0){
$this->user_obj->where('user_id',$data['user_id'])->update($updata);
}
return jsonSuccess([]);
}
/**
* @title 获取所有用户
* @description 获取所有用户
@@ -256,14 +281,12 @@ class User extends Controller
if (!$rules->check($data)) {
return jsonError($rules->getError());
}
$check = $this->user_obj
->where('state', 0)
->where('account = "' . trim($data['account']) . '" or email = "' . trim($data['email']) . '"')
->find();
if ($check) {
return jsonError('用户已经存在');
return jsonError('The user already exists');
}
$inser_data['account'] = $data['account'];
$inser_data['password'] = md5($data['password']);
@@ -476,12 +499,12 @@ class User extends Controller
}
if ($data['role_type'] == 'special') {
if (!isset($data['special_id'])) {
return jsonError("添加客座编辑身份时客座id是必传项");
return jsonError("When adding a passenger editing identity, the passenger ID is required");
}
$check = $this->user_to_special_obj->where("user_id", $data['user_id'])->where('special_id', $data['special_id'])->where('uts_state', 0)->find();
if ($check) {
return jsonError("不可重复添加");
return jsonError("Cannot be added repeatedly");
}
$insert_uts['user_id'] = $data['user_id'];
$insert_uts['special_id'] = $data['special_id'];
@@ -591,52 +614,6 @@ 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 降级青年编委至审稿人