This commit is contained in:
wangjinlei
2021-01-12 10:31:21 +08:00
parent 18e00ce354
commit 0f9ca2468c
2 changed files with 55 additions and 0 deletions

View File

@@ -46,4 +46,57 @@ class Special extends Controller {
$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 count:总数
* @return specials:客座期刊列表array#
*/
public function getSpecialList(){
$data = $this->request->post();
$where['journal_id'] = $data['journal_id'];
if(isset($data['state'])){
$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['count'] = $count;
$re['specials'] = $list;
return jsonSuccess($re);
}
}