This commit is contained in:
wangjinlei
2023-02-17 09:28:11 +08:00
parent 689581f685
commit 45a6caadb0
6 changed files with 350 additions and 76 deletions

View File

@@ -20,6 +20,8 @@ class Ucenter extends Controller{
protected $major_obj = "";
protected $major_to_journal_obj = '';
protected $user_cv_obj = '';
protected $apply_board_obj = '';
protected $apply_yboard_obj = '';
public function __construct(\think\Request $request = null)
{
@@ -35,6 +37,8 @@ class Ucenter extends Controller{
$this->major_obj = Db::name("major");
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->user_cv_obj = Db::name('user_cv');
$this->apply_board_obj = Db::name('apply_board');
$this->apply_yboard_obj = Db::name('apply_yboard');
}
@@ -95,6 +99,75 @@ class Ucenter extends Controller{
return jsonSuccess($userInfo);
}
public function getCanApplyJournal(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journals = $this->apply_board_obj->where('user_id',$data['user_id'])->where('state',0)->column("journal_id");
$js = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->column('journal_id');
$list = $this->journal_obj->where('journal_id','not in',$journals)->where('journal_id','not in',$js)->where('state',0)->select();
$re['journals'] = $list;
return jsonSuccess($re);
}
public function getCanApplyYjournal(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$ids = $this->reviewer_to_journal_obj->where('reviewer_id',$data['user_id'])->where('state',0)->where('is_yboard',0)->column('journal_id');
$journals = $this->journal_obj->where('journal_id','in',$ids)->where('state',0)->select();
$re['journals'] = $journals;
return jsonSuccess($re);
}
public function applyYboard(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'journal_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$check = $this->apply_yboard_obj->where('user_id',$data['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
if($check){
return jsonError("Your application for Editorial Board is processing. Please do not repeat it.");
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
$insert['ctime'] = time();
$this->apply_yboard_obj->insert($insert);
return jsonSuccess([]);
}
public function applyBoard(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'journal_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$check = $this->apply_board_obj->where('user_id',$data['user_id'])->where('journal_id',$data['journal_id'])->where('state',0)->find();
if($check){
return jsonError("");
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
$insert['ctime'] = time();
$this->apply_board_obj->insert($insert);
return jsonSuccess([]);
}
/**
* 增加用户cv
*/