专刊
This commit is contained in:
@@ -94,7 +94,7 @@ class Special extends Controller {
|
||||
->where('j_journal_special_to_editor.state',0)
|
||||
->select();
|
||||
foreach ($caches as $val){
|
||||
$frag = $frag == ''?$val['first_name'].' '.$val['last_name']:','.$val['first_name'].' '.$val['last_name'];
|
||||
$frag = $frag == '' ? $val['first_name'].' '.$val['last_name'] : $frag.', '.$val['first_name'].' '.$val['last_name'];
|
||||
}
|
||||
$list[$k]['editor'] = $frag;
|
||||
|
||||
@@ -179,6 +179,36 @@ class Special extends Controller {
|
||||
$re['applys'] = $applys;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按期刊+邮箱查询客座编辑是否已存在
|
||||
* @url /master/Special/getSpecialEditorByEmail
|
||||
*/
|
||||
public function getSpecialEditorByEmail(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'journal_id' => 'require|number',
|
||||
'email' => 'require',
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$email = trim($data['email']);
|
||||
$exist = $this->journal_special_editor_obj
|
||||
->where('journal_id', intval($data['journal_id']))
|
||||
->where('email', $email)
|
||||
->find();
|
||||
if (!$exist) {
|
||||
return jsonSuccess([
|
||||
'journal_special_editor_id' => 0,
|
||||
'email' => $email,
|
||||
]);
|
||||
}
|
||||
return jsonSuccess([
|
||||
'journal_special_editor_id' => intval($exist['journal_special_editor_id']),
|
||||
'email' => $email,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 客座期刊(编辑客座期刊基础信息)
|
||||
@@ -204,7 +234,12 @@ class Special extends Controller {
|
||||
$update['icon'] = $data['icon'];
|
||||
$update['abstract'] = $data['abstract'];
|
||||
$update['keywords'] = $data['keywords'];
|
||||
$update['deadline'] = $data['deadline'];
|
||||
if (isset($data['deadline'])) {
|
||||
$update['deadline'] = $data['deadline'];
|
||||
}
|
||||
if (isset($data['hasEditor'])) {
|
||||
$update['hasEditor'] = (intval($data['hasEditor']) === 1) ? 1 : 0;
|
||||
}
|
||||
$this->journal_special_obj->where('journal_special_id',$data['journal_special_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -239,8 +274,31 @@ class Special extends Controller {
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['email'] = trim($data['email']);
|
||||
$email = trim($data['email']);
|
||||
$journalId = intval($data['journal_id']);
|
||||
$exist = $this->journal_special_editor_obj
|
||||
->where('journal_id', $journalId)
|
||||
->where('email', $email)
|
||||
->find();
|
||||
if ($exist) {
|
||||
$editorId = intval($exist['journal_special_editor_id']);
|
||||
$update = [
|
||||
'first_name' => trim($data['first_name']),
|
||||
'last_name' => trim($data['last_name']),
|
||||
'address' => trim($data['address']),
|
||||
'interests' => isset($data['interests'])?trim($data['interests']):'',
|
||||
'website' => isset($data['website'])?trim($data['website']):'',
|
||||
'orcid' => isset($data['orcid'])?trim($data['orcid']):'',
|
||||
];
|
||||
if (isset($data['specialIcon']) && trim($data['specialIcon']) !== '') {
|
||||
$update['icon'] = trim($data['specialIcon']);
|
||||
}
|
||||
$this->journal_special_editor_obj->where('journal_special_editor_id', $editorId)->update($update);
|
||||
return jsonSuccess(['journal_special_editor_id' => $editorId]);
|
||||
}
|
||||
|
||||
$insert['journal_id'] = $journalId;
|
||||
$insert['email'] = $email;
|
||||
$insert['first_name'] = trim($data['first_name']);
|
||||
$insert['last_name'] = trim($data['last_name']);
|
||||
$insert['address'] = trim($data['address']);
|
||||
@@ -248,8 +306,11 @@ class Special extends Controller {
|
||||
$insert['website'] = isset($data['website'])?trim($data['website']):'';
|
||||
$insert['orcid'] = isset($data['orcid'])?trim($data['orcid']):'';
|
||||
$insert['icon'] = isset($data['specialIcon'])?trim($data['specialIcon']):'';
|
||||
$this->journal_special_editor_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
$editorId = $this->journal_special_editor_obj->insertGetId($insert);
|
||||
if (!$editorId) {
|
||||
return jsonError('add special editor failed');
|
||||
}
|
||||
return jsonSuccess(['journal_special_editor_id' => intval($editorId)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,12 +409,28 @@ class Special extends Controller {
|
||||
*/
|
||||
public function addSpecialToEditor(){
|
||||
$data = $this->request->post();
|
||||
$insert['journal_special_id'] = $data['journal_special_id'];
|
||||
$insert['journal_special_editor_id'] = $data['journal_special_editor_id'];
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
|
||||
$specialId = intval($data['journal_special_id']);
|
||||
$editorId = intval($data['journal_special_editor_id']);
|
||||
$journalId = intval($data['journal_id']);
|
||||
|
||||
$exist = $this->journal_special_to_editor_obj
|
||||
->where('journal_special_id', $specialId)
|
||||
->where('journal_special_editor_id', $editorId)
|
||||
->find();
|
||||
if ($exist) {
|
||||
if (intval($exist['state']) !== 0) {
|
||||
$this->journal_special_to_editor_obj
|
||||
->where('journal_special_to_editor_id', $exist['journal_special_to_editor_id'])
|
||||
->update(['state' => 0]);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
$insert['journal_special_id'] = $specialId;
|
||||
$insert['journal_special_editor_id'] = $editorId;
|
||||
$insert['journal_id'] = $journalId;
|
||||
$this->journal_special_to_editor_obj->insert($insert);
|
||||
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -375,6 +452,68 @@ class Special extends Controller {
|
||||
->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 客座期刊编辑(按邮箱解除客座期刊与作者的对应关系)
|
||||
* @description 客座期刊编辑(按邮箱解除客座期刊与作者的对应关系)
|
||||
* @author wangjinlei
|
||||
* @url /master/Special/delSpecialToEditorByEmail
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_special_id type:int require:1 desc:客座期刊id
|
||||
* @param name:email type:string require:1 desc:客座编辑邮箱
|
||||
*/
|
||||
public function delSpecialToEditorByEmail(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'journal_special_id' => 'require|number',
|
||||
'email' => 'require',
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$specialId = intval($data['journal_special_id']);
|
||||
$email = trim($data['email']);
|
||||
$editorIds = $this->journal_special_editor_obj
|
||||
->where('email', $email)
|
||||
->where('state', 0)
|
||||
->column('journal_special_editor_id');
|
||||
if(empty($editorIds)){
|
||||
return jsonError('editor not found');
|
||||
}
|
||||
|
||||
$this->journal_special_to_editor_obj
|
||||
->where('journal_special_id', $specialId)
|
||||
->where('journal_special_editor_id', 'in', $editorIds)
|
||||
->where('state', '<>', 1)
|
||||
->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 客座期刊编辑(解除专刊下全部客座编辑绑定)
|
||||
* @description 客座期刊编辑(解除专刊下全部客座编辑绑定)
|
||||
* @author wangjinlei
|
||||
* @url /master/Special/delAllSpecialToEditor
|
||||
* @method POST
|
||||
*
|
||||
* @param name:journal_special_id type:int require:1 desc:客座期刊id
|
||||
*/
|
||||
public function delAllSpecialToEditor(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'journal_special_id' => 'require|number',
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->journal_special_to_editor_obj
|
||||
->where('journal_special_id', $data['journal_special_id'])
|
||||
->where('state', '<>', 1)
|
||||
->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 客座期刊编辑(通过申请)
|
||||
|
||||
Reference in New Issue
Block a user