20201112
This commit is contained in:
30
application/master/controller/Article.php
Normal file
30
application/master/controller/Article.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\master\controller;
|
||||||
|
|
||||||
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 文章接口
|
||||||
|
* @description 文章相关操作
|
||||||
|
* @group 文章相关
|
||||||
|
*/
|
||||||
|
class Article extends Controller {
|
||||||
|
//put your code here
|
||||||
|
protected $admin_obj = '';
|
||||||
|
protected $journal_obj = '';
|
||||||
|
protected $journal_topic_obj = '';
|
||||||
|
protected $journal_stage_obj = '';
|
||||||
|
|
||||||
|
public function __construct(\think\Request $request = null) {
|
||||||
|
parent::__construct($request);
|
||||||
|
$this->admin_obj = Db::name('admin');
|
||||||
|
$this->journal_obj = Db::name('journal');
|
||||||
|
$this->journal_topic_obj = Db::name('journal_topic');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,12 +15,14 @@ class Journal extends Controller {
|
|||||||
protected $admin_obj = '';
|
protected $admin_obj = '';
|
||||||
protected $journal_obj = '';
|
protected $journal_obj = '';
|
||||||
protected $journal_topic_obj = '';
|
protected $journal_topic_obj = '';
|
||||||
|
protected $journal_stage_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null) {
|
public function __construct(\think\Request $request = null) {
|
||||||
parent::__construct($request);
|
parent::__construct($request);
|
||||||
$this->admin_obj = Db::name('admin');
|
$this->admin_obj = Db::name('admin');
|
||||||
$this->journal_obj = Db::name('journal');
|
$this->journal_obj = Db::name('journal');
|
||||||
$this->journal_topic_obj = Db::name('journal_topic');
|
$this->journal_topic_obj = Db::name('journal_topic');
|
||||||
|
$this->journal_stage_obj = Db::name('journal_stage');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -424,5 +426,87 @@ class Journal extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 添加期刊分期
|
||||||
|
* @description 添加期刊分期
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/addStage
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_id type:int require:1 desc:期刊id
|
||||||
|
* @param name:stage_name type:string require:1 desc:期刊分期名
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function addStage(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$insert_data['journal_id'] = $data['journal_id'];
|
||||||
|
$insert_data['stage_name'] = $data['stage_name'];
|
||||||
|
$res = $this->journal_stage_obj->insert($insert_data);
|
||||||
|
if($res){
|
||||||
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>1,'msg'=>'system error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 获取期刊分期
|
||||||
|
* @description 获取期刊分期
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/getStageList
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_id type:int require:1 desc:期刊id
|
||||||
|
*
|
||||||
|
* @return stage_list:array#
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function getStageList(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$stage_list = $this->journal_stage_obj->where('journal_id',$data['journal_id'])->where('state',0)->select();
|
||||||
|
return json(['code'=>0,'msg'=>'success','data'=>['stage_list'=>$stage_list]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 删除期刊分期
|
||||||
|
* @description 删除期刊分期
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/delStage
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_stage_id type:int require:1 desc:期刊分期id
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function delStage(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$res = $this->journal_stage_obj->where('journal_stage_id',$data['journal_stage_id'])->update(['state'=>1]);
|
||||||
|
if($res){
|
||||||
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>1,'msg'=>'system error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @title 更改期刊分期
|
||||||
|
* @description 更改期刊分期
|
||||||
|
* @author wangjinlei
|
||||||
|
* @url /master/Journal/editStage
|
||||||
|
* @method POST
|
||||||
|
*
|
||||||
|
* @param name:journal_stage_id type:int require:1 desc:期刊分期id
|
||||||
|
* @param name:stage_name type:string require:1 desc:期刊分期名字
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function editStage(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$res = $this->journal_stage_obj->where('journal_stage_id',$data['journal_stage_id'])->update(['stage_name'=>$data['stage_name']]);
|
||||||
|
if($res){
|
||||||
|
return json(['code'=>0,'msg'=>'success']);
|
||||||
|
}else{
|
||||||
|
return json(['code'=>1,'msg'=>'system error']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user