This commit is contained in:
wangjinlei
2023-09-12 09:12:34 +08:00
parent b2581b5bbe
commit fc64abb1d6
5 changed files with 215 additions and 7 deletions

View File

@@ -1591,6 +1591,151 @@ class User extends Base
return jsonSuccess($re);
}
/**获取期刊委员会人员列表
* @return void
*/
public function getCommittee(){
$data = $this->request->post();
$rule = new Validate([
"journal_id"=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$committees = $this->committee_to_journal_obj->join("t_user","t_user.user_id = t_committee_to_journal.user_id","left")->where('t_committee_to_journal.journal_id',$data['journal_id'])->where('t_committee_to_journal.state',0)->select();
$re['committees'] = $committees;
return jsonSuccess($re);
}
/**
* @return \think\response\Json
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function delCommittee(){
$data = $this->request->post();
$rule = new Validate([
"ctj_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->committee_to_journal_obj->where('ctj_id',$data['ctj_id'])->update(["state"=>1]);
return jsonSuccess([]);
}
/**编辑期刊编委会信息
* @return void
*/
public function editCommittee(){
$data = $this->request->post();
$rule = new Validate([
"ctj_id"=>"require",
"research_areas"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$update['research_areas'] = trim($data['research_areas']);
$this->committee_to_journal_obj->where('ctj_id',$data['ctj_id'])->update($update);
return jsonSuccess([]);
}
/**添加期刊委员会人员
* @return \think\response\Json
*/
public function addCommittee(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require",
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
if(isset($data['research_areas'])&&$data['research_areas']!=''){
$insert['research_areas'] = trim($data['research_areas']);
}
$insert['ctime'] = time();
$this->committee_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**添加期刊编辑对应信息
* @return void
*/
public function addEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"user_id"=>"require",
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$insert['user_id'] = $data['user_id'];
$insert['journal_id'] = $data['journal_id'];
if(isset($data['editor_title'])&&$data['editor_title']!=''){
$insert['editor_title'] = trim($data['editor_title']);
}
$insert['ctime'] = time();
$this->editor_to_journal_obj->insert($insert);
return jsonSuccess([]);
}
/**编辑期刊编辑对应信息
* @return \think\response\Json
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function editEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"etj_id"=>"require",
"editor_title"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->editor_to_journal_obj->where('etj_id',$data['etj_id'])->update(['editor_title'=>$data['editor_title']]);
return jsonSuccess([]);
}
/**删除期刊编辑对应信息
* @return void
*/
public function delEditorToJournal(){
$data = $this->request->post();
$rule = new Validate([
"etj_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->editor_to_journal_obj->where('etj_id',$data['etj_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**获取期刊编辑对应信息列表
* @return void
*/
public function getEditorToJournals(){
$data = $this->request->post();
$rule = new Validate([
"journal_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$es = $this->editor_to_journal_obj->join("t_user","t_user.user_id = t_editor_to_journal.user_id","left")->where("t_editor_to_journal.journal_id",$data['journal_id'])->where('t_editor_to_journal.state',0)->select();
$re['editors'] = $es;
return jsonSuccess($re);
}
private function getUserRoles($account)
{
$user_info = $this->user_obj->where('account', $account)->find();