59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
namespace app\api\controller;
|
|
|
|
use app\api\controller\Base;
|
|
use think\Db;
|
|
/**
|
|
* @title 补充接口
|
|
* @description 文章接口
|
|
*/
|
|
class Supplementary extends Base
|
|
{
|
|
|
|
public function __construct(\think\Request $request = null) {
|
|
|
|
parent::__construct($request);
|
|
}
|
|
|
|
/**
|
|
* @title 获取期刊编辑
|
|
* @description 获取期刊编辑接口
|
|
*/
|
|
|
|
public function getJournalBoard(){
|
|
|
|
|
|
//获取参数
|
|
$aParam = $this->request->post();
|
|
|
|
//参数验证
|
|
$sIssn = empty($aParam['issn']) ? '' : $aParam['issn'];
|
|
if(empty($sIssn)){
|
|
return json_encode(['status' => 2,'msg' => 'Please select an journal']);
|
|
}
|
|
|
|
//根据期刊issn查询期刊ID
|
|
$aWhere = ['state' => 0,'issn' => $sIssn];
|
|
$aJournal = Db::name('journal')->field('journal_id')->where($aWhere)->find();
|
|
if(empty($aJournal)){
|
|
return json_encode(['status' => 3,'msg' => 'No journal information found']);
|
|
}
|
|
|
|
//查询期刊编辑信息
|
|
$aWhere = ['state' => 0,'journal_id' => $aJournal['journal_id']];
|
|
if(isset($aParam['type'])){//编辑类型
|
|
$aWhere['type'] = $aParam['type'];
|
|
}
|
|
$aJournalBoard = Db::name('board_to_journal')->where($aWhere)->column('user_id');
|
|
if(empty($aJournalBoard)){
|
|
return json_encode(['status' => 4,'msg' => 'No editorial information was found for the journal']);
|
|
}
|
|
|
|
//查询编辑详情
|
|
$aWhere = ['state' => 0,'user_id' => ['in',$aJournalBoard]];
|
|
$aUser = Db::name('user')->field('user_id,realname')->where($aWhere)->select();
|
|
return json_encode(['status' => 1,'msg' => 'success','data' => $aUser]);
|
|
}
|
|
|
|
}
|
|
?>
|