新增查询字段
This commit is contained in:
@@ -838,6 +838,127 @@ class Board extends Base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增编辑编委信息-新
|
||||
*/
|
||||
public function addBoardNew(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"user_id"=>"require",
|
||||
"journal_id"=>"require",
|
||||
"type"=>"require",
|
||||
"board_group_id"=>"require",
|
||||
"research_areas"=>"require",
|
||||
"realname"=>"require",
|
||||
"email"=>"require",
|
||||
"website"=>"require",
|
||||
"affiliation"=>"require",
|
||||
"technical"=>"require",
|
||||
'icon' => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$check = $this->board_to_journal_obj->where('user_id',$data['user_id'])->where('state',0)->find();
|
||||
if($check){
|
||||
return jsonError("According to TMR Publishing Group Policy, scientists are not allowed to serve on the editorial board of more than one journal at the same time.");
|
||||
}
|
||||
|
||||
//新增必填字段 chengxiaoling 20251020 start
|
||||
//必填验证
|
||||
$sField = '';
|
||||
$aFields = ['research_areas','realname','email','website','affiliation','technical','icon'];
|
||||
foreach ($aFields as $value) {
|
||||
$sInfo = empty($data[$value]) ? '' : trim($data[$value]);
|
||||
if(empty($sInfo)){
|
||||
$sField = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!empty($sField)){
|
||||
return jsonError($sField.' cannot be empty');
|
||||
}
|
||||
//新增必填字段 chengxiaoling 20251020 end
|
||||
|
||||
//添加对应关系
|
||||
$insert['user_id'] = $data['user_id'];
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['type'] = $data['type'];
|
||||
$insert['board_group_id'] = $data['board_group_id'];
|
||||
$insert['research_areas'] = trim($data['research_areas']);
|
||||
//新增必填字段 chengxiaoling 20251020 start
|
||||
$insert['realname'] = trim($data['realname']);
|
||||
$insert['email'] = trim($data['email']);
|
||||
$insert['website'] = trim($data['website']);
|
||||
$insert['affiliation'] = trim($data['affiliation']);
|
||||
$insert['technical'] = trim($data['technical']);
|
||||
$insert['icon'] = trim($data['icon']);
|
||||
//新增必填字段 chengxiaoling 20251020 end
|
||||
$this->board_to_journal_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
/**
|
||||
* 修改编辑编委信息-新
|
||||
*/
|
||||
public function editBoardNew(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"btj_id"=>"require",
|
||||
"type"=>'require',
|
||||
"board_group_id"=>"require",
|
||||
"research_areas"=>"require",
|
||||
"realname"=>"require",
|
||||
"email"=>"require",
|
||||
"website"=>"require",
|
||||
"affiliation"=>"require",
|
||||
"technical"=>"require",
|
||||
'icon' => "require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
//新增必填字段 chengxiaoling 20251020 start
|
||||
//必填验证
|
||||
$sField = '';
|
||||
$aFields = ['research_areas','realname','email','website','affiliation','technical','icon'];
|
||||
foreach ($aFields as $value) {
|
||||
$sInfo = empty($data[$value]) ? '' : trim($data[$value]);
|
||||
if(empty($sInfo)){
|
||||
$sField = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!empty($sField)){
|
||||
return jsonError($sField.' cannot be empty');
|
||||
}
|
||||
//新增必填字段 chengxiaoling 20251020 end
|
||||
$update['type'] = $data['type'];
|
||||
$update['board_group_id'] = $data['type']==2?$data['board_group_id']:0;
|
||||
$update['research_areas'] = trim($data['research_areas']);
|
||||
//新增必填字段 chengxiaoling 20251020 start
|
||||
$update['realname'] = trim($data['realname']);
|
||||
$update['email'] = trim($data['email']);
|
||||
$update['website'] = trim($data['website']);
|
||||
$update['affiliation'] = trim($data['affiliation']);
|
||||
$update['technical'] = trim($data['technical']);
|
||||
$update['icon'] = trim($data['icon']);
|
||||
//新增必填字段 chengxiaoling 20251020 end
|
||||
$this->board_to_journal_obj->where('btj_id',$data['btj_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
/**
|
||||
* 编委上传头像
|
||||
*/
|
||||
public function uploadIcon()
|
||||
{
|
||||
$file = request()->file('icon');
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'boardusericon');
|
||||
if ($info) {
|
||||
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user