admin_obj = Db::name('admin'); $this->journal_obj = Db::name('journal'); $this->article_obj = Db::name('article'); $this->article_author_obj = Db::name('article_author'); $this->journal_topic_obj = Db::name('journal_topic'); $this->journal_stage_obj = Db::name('journal_stage'); $this->journal_notices_obj = Db::name('journal_notices'); $this->journal_abs_obj = Db::name('journal_abstracting'); $this->journal_special_obj = Db::name('journal_special'); $this->journal_special_editor_obj = Db::name('journal_special_editor'); $this->journal_special_to_editor_obj = Db::name('journal_special_to_editor'); $this->journal_special_alert_obj = Db::name('journal_special_alert'); $this->article_to_topic_obj = Db::name('article_to_topic'); $this->sys_scient_obj = Db::name('system_scient'); $this->sys_book_obj = Db::name('system_books'); } /** * @title 客座期刊(获取列表) * @description 客座期刊(获取列表) * @author wangjinlei * @url /master/Special/getSpecialList * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * @param name:state type:int require:0 desc:状态 * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 * * @return journal:期刊信息 * @return count:总数 * @return specials:客座期刊列表array# */ public function getSpecialList(){ $data = $this->request->post(); $journal_info = $this->journal_obj->where('journal_id',$data['journal_id'])->find(); $where['journal_id'] = $data['journal_id']; if(isset($data['state'])&&$data['state']!=-1){ $where['state'] = $data['state']; }else{ $where['state'] = ['<>',1]; } $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $list = $this->journal_special_obj ->where($where) ->order(['state','journal_special_id desc']) ->limit($limit_start,$data['pageSize']) ->select(); //获取作者 foreach ($list as $k => $v){ $frag = ''; $caches = $this->journal_special_to_editor_obj ->field('j_journal_special_editor.*') ->join('j_journal_special_editor','j_journal_special_editor.journal_special_editor_id = j_journal_special_to_editor.journal_special_editor_id','LEFT') ->where('j_journal_special_to_editor.journal_special_id',$v['journal_special_id']) ->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']; } $list[$k]['editor'] = $frag; $sq = $this->journal_special_to_editor_obj->where('journal_special_id',$v['journal_special_id'])->where('state',2)->select(); if(count($sq)>0){ $list[$k]['has_sq'] = 1; }else{ $list[$k]['has_sq'] = 0; } } $count = $this->journal_special_obj->where($where)->count(); $re['journal'] = $journal_info; $re['count'] = $count; $re['specials'] = $list; return jsonSuccess($re); } /** * 获取期刊的专刊列表 */ public function getSpecialByIssn(){ $data = $this->request->post(); $rule = new Validate([ 'journal_issn' => 'require' ]); if(!$rule->check($data)){ return jsonError($rule->getError()); } $journal_info = $this->journal_obj->where('issn',$data['journal_issn'])->find(); $list = $this->journal_special_obj->where('journal_id',$journal_info['journal_id'])->where('state',2)->select(); $re['specials'] = $list; return jsonSuccess($re); } /** * @title 客座期刊(更改状态) * @description 客座期刊(更改状态) * @author wangjinlei * @url /master/Special/changeSpecialState * @method POST * * @param name:journal_special_id type:int require:1 desc:客座期刊id * @param name:state type:int require:1 desc:状态(0:初始1:拒绝2:通过) */ public function changeSpecialState(){ $data = $this->request->post(); $this->journal_special_obj->where('journal_special_id',$data['journal_special_id'])->update(['state'=>$data['state']]); return jsonSuccess([]); } /** * @title 客座期刊(获取详情信息) * @description 客座期刊(获取详情信息) * @author wangjinlei * @url /master/Special/getSpecialDetail * @method POST * * @param name:journal_special_id type:int require:1 desc:客座期刊id * * @return special:客座期刊信息 * @return editors:作者array# * @return applys:申请array# */ public function getSpecialDetail(){ $data = $this->request->post(); $special_info = $this->journal_special_obj->where('journal_special_id',$data['journal_special_id'])->find(); $editor_list = $this->journal_special_to_editor_obj->field('j_journal_special_editor.*,j_journal_special_editor.icon specialIcon') ->join('j_journal_special_editor','j_journal_special_editor.journal_special_editor_id = j_journal_special_to_editor.journal_special_editor_id','LEFT') ->where('j_journal_special_to_editor.journal_special_id',$data['journal_special_id']) ->where('j_journal_special_to_editor.state',0) ->select(); $applys = $this->journal_special_to_editor_obj->field('j_journal_special_to_editor.journal_special_to_editor_id,j_journal_special_editor.*') ->join('j_journal_special_editor','j_journal_special_editor.journal_special_editor_id = j_journal_special_to_editor.journal_special_editor_id','LEFT') ->where('j_journal_special_to_editor.journal_special_id',$data['journal_special_id']) ->where('j_journal_special_to_editor.state',2) ->select(); $re['special'] = $special_info; $re['editors'] = $editor_list; $re['applys'] = $applys; return jsonSuccess($re); } /** * @title 客座期刊(编辑客座期刊基础信息) * @description 客座期刊(编辑客座期刊基础信息) * @author wangjinlei * @url /master/Special/editSpecialBasic * @method POST * * @param name:journal_special_id type:int require:1 desc:客座期刊id * @param name:title type:string require:1 desc:标题 * @param name:intro type:string require:1 desc:简介 * @param name:abstract type:string require:1 desc:描述 * @param name:keywords type:string require:1 desc:关键字 * @param name:deadline type:int require:1 desc:截止日期 * * @return special:客座期刊信息 * @return editors:作者array# */ public function editSpecialBasic(){ $data = $this->request->post(); $update['title'] = $data['title']; $update['intro'] = $data['intro']; $update['abstract'] = $data['abstract']; $update['keywords'] = $data['keywords']; $update['deadline'] = $data['deadline']; $this->journal_special_obj->where('journal_special_id',$data['journal_special_id'])->update($update); return jsonSuccess([]); } /** * @title 客座期刊编辑(添加编辑) * @description 客座期刊编辑(添加编辑) * @author wangjinlei * @url /master/Special/addSpecialEditor * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * @param name:email type:string require:1 desc:邮箱 * @param name:first_name type:string require:1 desc:名字 * @param name:last_name type:string require:1 desc:名字 * @param name:address type:string require:1 desc:地址 * @param name:interests type:string require:0 desc:兴趣 * @param name:website type:string require:0 desc:编辑主页 * @param name:orcid type:string require:0 desc:orcid * @param name:specialIcon type:string require:1 desc:客座编辑头像 */ public function addSpecialEditor(){ $data = $this->request->post(); $insert['journal_id'] = $data['journal_id']; $insert['email'] = trim($data['email']); $insert['first_name'] = trim($data['first_name']); $insert['last_name'] = trim($data['last_name']); $insert['address'] = trim($data['address']); $insert['interests'] = trim($data['interests']); $insert['website'] = trim($data['website']); $insert['orcid'] = trim($data['orcid']); $insert['icon'] = trim($data['specialIcon']); $this->journal_special_editor_obj->insert($insert); return jsonSuccess([]); } /** * @title 客座期刊编辑(更改编辑) * @description 客座期刊编辑(更改编辑) * @author wangjinlei * @url /master/Special/editSpecialEditor * @method POST * * @param name:journal_special_editor_id type:int require:1 desc:客座期刊编辑id * @param name:email type:string require:1 desc:邮箱 * @param name:first_name type:string require:1 desc:名字 * @param name:last_name type:string require:1 desc:名字 * @param name:address type:string require:1 desc:地址 * @param name:interests type:string require:0 desc:兴趣 * @param name:website type:string require:0 desc:编辑主页 * @param name:orcid type:string require:0 desc:orcid * @param name:specialIcon type:string require:1 desc:客座编辑头像 */ public function editSpecialEditor(){ $data = $this->request->post(); $update['email'] = trim($data['email']); $update['first_name'] = trim($data['first_name']); $update['last_name'] = trim($data['last_name']); $update['address'] = trim($data['address']); $update['interests'] = trim($data['interests']); $update['website'] = trim($data['website']); $update['orcid'] = trim($data['orcid']); $update['icon'] = trim($data['specialIcon']); $this->journal_special_editor_obj->where('journal_special_editor_id',$data['journal_special_editor_id'])->update($update); return jsonSuccess([]); } /** * @title 客座期刊编辑(获取编辑列表,除去已经建立联系的) * @description 客座期刊编辑(获取编辑列表,除去已经建立联系的) * @author wangjinlei * @url /master/Special/getSpecialEditors * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * @param name:journal_special_id type:int require:1 desc:客座期刊编辑id * @param name:pageIndex type:int require:1 desc:当前页码数 * @param name:pageSize type:int require:1 desc:单页数据条数 * * @return count:总数 * @return editors:编辑列表array# */ public function getSpecialEditors(){ $data = $this->request->post(); $limit_start = ($data['pageIndex'] - 1) * $data['pageSize']; $cids = $this->journal_special_to_editor_obj->where('journal_special_id',$data['journal_special_id'])->where('state','<>',1)->column('journal_special_editor_id'); $list = $this->journal_special_editor_obj->where('journal_special_editor_id','not in',$cids)->where('state',0)->limit($limit_start,$data['pageSize'])->select(); $count = $this->journal_special_editor_obj->where('journal_special_editor_id','not in',$cids)->where('state',0)->count(); foreach ($list as $k => $v){ $list[$k]['specialIcon'] = $v['icon']; } $re['count'] = $count; $re['editors'] = $list; return jsonSuccess($re); } /** * @title 客座期刊编辑(添加客座期刊与作者的对应关系) * @description 客座期刊编辑(添加客座期刊与作者的对应关系) * @author wangjinlei * @url /master/Special/addSpecialToEditor * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * @param name:journal_special_id type:int require:1 desc:客座期刊id * @param name:journal_special_editor_id type:int require:1 desc:客座期刊编辑id */ 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']; $this->journal_special_to_editor_obj->insert($insert); return jsonSuccess([]); } /** * @title 客座期刊编辑(删除客座期刊与作者的对应关系) * @description 客座期刊编辑(删除客座期刊与作者的对应关系) * @author wangjinlei * @url /master/Special/delSpecialToEditor * @method POST * * @param name:journal_special_id type:int require:1 desc:客座期刊id * @param name:journal_special_editor_id type:int require:1 desc:期刊编辑id */ public function delSpecialToEditor(){ $data = $this->request->post(); $this->journal_special_to_editor_obj ->where('journal_special_id',$data['journal_special_id']) ->where('journal_special_editor_id',$data['journal_special_editor_id']) ->update(['state'=>1]); return jsonSuccess([]); } /** * @title 客座期刊编辑(通过申请) * @description 客座期刊编辑(通过申请) * @author wangjinlei * @url /master/Special/adoptEditor * @method POST * * @param name:journal_special_to_editor_id type:int require:1 desc:期刊编辑链接id */ public function adoptEditor(){ $data = $this->request->post(); $this->journal_special_to_editor_obj->where('journal_special_to_editor_id',$data['journal_special_to_editor_id'])->update(['state'=>0]); return jsonSuccess([]); } /** * @title 客座期刊编辑(拒绝申请) * @description 客座期刊编辑(拒绝申请) * @author wangjinlei * @url /master/Special/refuseEditor * @method POST * * @param name:journal_special_to_editor_id type:int require:1 desc:期刊编辑链接id */ public function refuseEditor(){ $data = $this->request->post(); $this->journal_special_to_editor_obj->where('journal_special_to_editor_id',$data['journal_special_to_editor_id'])->update(['state'=>1]); return jsonSuccess([]); } /** * @title 客座期刊提示语(获取) * @description 客座期刊提示语(获取) * @author wangjinlei * @url /master/Special/getSpecialAlert * @method POST * * @param name:journal_id type:int require:1 desc:期刊id * * @return alertInfo:提示语信息# */ public function getSpecialAlert(){ $data = $this->request->post(); $info = $this->journal_special_alert_obj->where('journal_id',$data['journal_id'])->find(); if($info==null){ $insert['journal_id'] = $data['journal_id']; $insert['agreement'] = ''; $insert['alert'] = ''; $insert['intro'] = ''; $this->journal_special_alert_obj->insert($insert); } $d = $this->journal_special_alert_obj->where('journal_id',$data['journal_id'])->find(); $re['alertInfo'] = $d; return jsonSuccess($re); } /** * @title 客座期刊提示语(编辑) * @description 客座期刊提示语(编辑) * @author wangjinlei * @url /master/Special/editSpecialAlert * @method POST * * @param name:special_alert_id type:int require:1 desc:客座提示语id * @param name:agreement type:string require:1 desc:需知 * @param name:alert type:string require:1 desc:成功提示 * @param name:intro type:string require:1 desc:投稿简介 */ public function editSpecialAlert(){ $data = $this->request->post(); $update['agreement'] = $data['agreement']; $update['alert'] = $data['alert']; $update['intro'] = $data['intro']; $this->journal_special_alert_obj->where('special_alert_id',$data['special_alert_id'])->update($update); return jsonSuccess([]); } /** * @title 头像图片上传 * @description 头像图片上传 * @author wangjinlei * @url /master/Special/up_icon_file * @method POST * * @param name:name type:string require:1 default:specialIcon desc:文件域名称 * * @return upurl:图片地址 */ public function up_icon_file() { $file = request()->file('specialIcon'); if ($file) { $info = $file->move(ROOT_PATH . 'public' . DS . 'specialIcon'); if ($info) { return json(['code' => 0, 'msg' => 'success', 'upurl' => str_replace("\\", "/", $info->getSaveName())]); } else { return json(['code' => 1, 'msg' => $file->getError()]); } } } }