Files
journal/application/master/controller/Special.php
wangjinlei e8cdb8884a 20201112
2021-01-13 09:53:09 +08:00

165 lines
6.2 KiB
PHP

<?php
namespace app\master\controller;
use think\Controller;
use think\Db;
/**
* @title 客座期刊
* @description 客座期刊
* @group 客座期刊
*/
class Special extends Controller {
//put your code here
protected $admin_obj = '';
protected $journal_obj = '';
protected $article_obj = '';
protected $article_author_obj = '';
protected $journal_topic_obj = '';
protected $journal_stage_obj = '';
protected $journal_notices_obj = '';
protected $journal_abs_obj = '';
protected $journal_special_obj = '';
protected $journal_special_editor_obj = '';
protected $journal_special_to_editor_obj = '';
protected $article_to_topic_obj = '';
protected $sys_scient_obj = '';
protected $sys_book_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->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->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;
}
$count = $this->journal_special_obj->where($where)->count();
$re['journal'] = $journal_info;
$re['count'] = $count;
$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#
*/
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.*')
->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();
$re['special'] = $special_info;
$re['editors'] = $editor_list;
return jsonSuccess($re);
}
/**
* @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#
*/
public function editSpecial(){
}
}