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

@@ -34,8 +34,6 @@ 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);
@@ -61,8 +59,6 @@ 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');
}
/**
@@ -245,16 +241,18 @@ class Board extends Controller {
$frag = [];
foreach($boards as $k => $v){
$cache_user = $this->user_obj->where('user_id',$v['tuser_id'])->find();
$h_index = $this->user_index_obj->where('user_id',$cache_user['user_id'])->where('year',date('Y'))->find();
$h_index_num = 0;
$gh_index_num = 0;
if($h_index){
$h_index_num = $h_index['h_index'];
$h_index_num = $h_index['gh_index'];
}
$boards[$k]['phone'] = $cache_user['phone'];
$boards[$k]['hindex'] = $h_index_num;
$boards[$k]['ghindex'] = $gh_index_num;
// $h_index = $this->user_index_obj->where('user_id',$cache_user['user_id'])->where('year',date('Y'))->find();
// $h_index_num = 0;
// $gh_index_num = 0;
// if($h_index){
// $h_index_num = $h_index['h_index'];
// $h_index_num = $h_index['gh_index'];
// }
// $boards[$k]['phone'] = $cache_user['phone'];
$boards[$k]['wos_index'] = $cache_user['wos_index'];
$boards[$k]['wos_time'] = $cache_user['wos_time'];
$boards[$k]['google_index'] = $cache_user['google_index'];
$boards[$k]['google_time'] = $cache_user['google_time'];
}
foreach ($boards as $v) {
@@ -553,27 +551,27 @@ class Board extends Controller {
/**
* 编辑/添加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([]);
}
// 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([]);
// }