This commit is contained in:
wangjinlei
2020-12-07 14:25:31 +08:00
parent 63c7fe6111
commit efbe9e40db
2 changed files with 134 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ class Journal extends Controller {
protected $article_obj = '';
protected $journal_topic_obj = '';
protected $journal_stage_obj = '';
protected $journal_notices_obj = '';
protected $journal_abs_obj = '';
protected $article_to_topic_obj = '';
@@ -27,6 +28,7 @@ class Journal extends Controller {
$this->article_obj = Db::name('article');
$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->article_to_topic_obj = Db::name('article_to_topic');
}
@@ -705,5 +707,82 @@ class Journal extends Controller {
}
}
/**
* @title 增加期刊消息
* @description 增加期刊消息
* @author wangjinlei
* @url /master/Journal/addNotices
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
* @param name:title type:string require:1 desc:消息标题
* @param name:content type:string require:1 desc:内容
*
*/
public function addNotices(){
$data = $this->request->post();
$insert['journal_id'] = $data['journal_id'];
$insert['title'] = $data['title'];
$insert['content'] = $data['content'];
$insert['ctime'] = time();
$res = $this->journal_notices_obj->insert($insert);
if($res){
return json(['code'=>0,'msg'=>'success']);
}else{
return json(['code'=>1,'msg'=>'system error']);
}
}
/**
* @title 删除期刊消息
* @description 删除期刊消息
* @author wangjinlei
* @url /master/Journal/delNotices
* @method POST
*
* @param name:journal_notices_id type:int require:1 desc:期刊id
*
*/
public function delNotices(){
$data = $this->request->post();
$this->journal_notices_obj->where('journal_notices_id',$data['journal_notices_id'])->update(['state'=>1]);
return json(['code'=>0,'msg'=>'success']);
}
/**
* @title 更改期刊消息
* @description 更改期刊消息
* @author wangjinlei
* @url /master/Journal/changeNotices
* @method POST
*
* @param name:journal_notices_id type:int require:1 desc:期刊消息id
* @param name:title type:string require:1 desc:消息标题
* @param name:content type:string require:1 desc:内容
*
*/
public function changeNotices(){
$data = $this->request->post();
$this->journal_notices_obj->where('journal_notices_id',$data['journal_notices_id'])->update(['title'=>$data['title'],'content'=>$data['content']]);
return json(['code'=>0,'msg'=>'success']);
}
/**
* @title 获取期刊消息
* @description 获取期刊消息
* @author wangjinlei
* @url /master/Journal/getNotices
* @method POST
*
* @param name:journal_id type:int require:1 desc:期刊id
*
* @return notices:消息list
*
*/
public function getNotices(){
$data = $this->request->post();
$list = $this->journal_notices_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
return jsonSuccess(['notices'=>$list]);
}
}