1
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\master\controller;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Queue;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* @title 期刊接口
|
||||
@@ -33,6 +34,7 @@ class Journal extends Controller {
|
||||
protected $board_group_obj = '';
|
||||
protected $base_topic_obj = '';
|
||||
protected $subscribe_base_topic_obj = '';
|
||||
protected $journal_for_author;
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
@@ -56,6 +58,7 @@ class Journal extends Controller {
|
||||
$this->board_group_obj = Db::name('board_group');
|
||||
$this->base_topic_obj = Db::name('base_topic');
|
||||
$this->subscribe_base_topic_obj = Db::name('subscribe_base_topic');
|
||||
$this->journal_for_author = Db::name('journal_for_author');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -969,6 +972,95 @@ class Journal extends Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取期刊forAuthor
|
||||
*/
|
||||
public function getForAuthorList(){
|
||||
$data = $this->request->post();
|
||||
// 验证规则
|
||||
$rule = new Validate([
|
||||
'journal_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$journals[]=0;
|
||||
if($data['journal_id']!=0){
|
||||
$journals[]=$data['journal_id'];
|
||||
}
|
||||
$list = $this->journal_for_author->where('journal_id','in',$journals)->where('pid',0)->where('jfa_state',0)->order("sort desc")->select();
|
||||
foreach($list as $k => $v){
|
||||
$cache_list = $this->journal_for_author->where('journal_id','in',$journals)->where('pid',$v['jfa_id'])->where('jfa_state',0)->order("sort desc")->select();
|
||||
foreach($cache_list as $key => $val){
|
||||
$cache_list[$key]['p_title'] = $v['jfa_title'];
|
||||
}
|
||||
$list[$k]['children'] = $cache_list;
|
||||
}
|
||||
$re['forAuthors'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加forauthor
|
||||
*/
|
||||
public function addForAuthor(){
|
||||
$data = $this->request->post();
|
||||
// 验证规则
|
||||
$rule = new Validate([
|
||||
'journal_id' => 'require',
|
||||
'pid'=>'require',
|
||||
'jfa_title'=>'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['journal_id'] = $data['journal_id'];
|
||||
$insert['pid'] = $data['pid'];
|
||||
$insert['jfa_title'] = $data['jfa_title'];
|
||||
$insert['content'] = $data['content'];
|
||||
$insert['sort'] = isset($data['sort'])?$data['sort']:0;
|
||||
$insert['jfa_ctime'] = time();
|
||||
$this->journal_for_author->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑forauthor
|
||||
*/
|
||||
public function editForAuthor(){
|
||||
$data = $this->request->post();
|
||||
// 验证规则
|
||||
$rule = new Validate([
|
||||
'jfa_id' => 'require',
|
||||
'jfa_title'=>'require',
|
||||
'sort'=>'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['jfa_title'] = $data['jfa_title'];
|
||||
$update['content'] = $data['content'];
|
||||
$update['sort'] = $data['sort'];
|
||||
$this->journal_for_author->where('jfa_id',$data['jfa_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除forAuthor
|
||||
*/
|
||||
public function delForAuthor(){
|
||||
$data = $this->request->post();
|
||||
// 验证规则
|
||||
$rule = new Validate([
|
||||
'jfa_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->journal_for_author->where('jfa_id',$data['jfa_id'])->update(['jfa_state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title line图片上传
|
||||
|
||||
Reference in New Issue
Block a user