1
This commit is contained in:
@@ -17,7 +17,7 @@ use think\Validate;
|
||||
* @title 领域接口
|
||||
* @description 领域接口
|
||||
*/
|
||||
class Major extends Controller {
|
||||
class Major extends Base {
|
||||
|
||||
protected $article_obj = '';
|
||||
protected $user_obj = '';
|
||||
@@ -393,6 +393,57 @@ class Major extends Controller {
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function getMajorByArticleId(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$majors = $this->major_to_article_obj->where("article_id",$data['article_id'])->where("state",0)->select();
|
||||
foreach ($majors as $k => $v){
|
||||
$majors[$k]["ids"] = getMajorShu($v['major_id']);
|
||||
$majors[$k]['str'] = getMajorStr($v['major_id']);
|
||||
}
|
||||
$re['majors'] = $majors;
|
||||
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
public function addMajorByArticleIdForEditor(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"article_id"=>"require",
|
||||
"major_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$check = $this->major_to_article_obj->where("article_id",$data['article_id'])->where("major_id",$data['major_id'])->where("state",0)->find();
|
||||
if($check){
|
||||
return jsonError("Repeat addition");
|
||||
}
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['major_id'] = $data['major_id'];
|
||||
$insert['ctime'] = time();
|
||||
$this->major_to_article_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
public function delMajorByArticleIdForEditor(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"mta_id"=>"require"
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->major_to_article_obj->where("mta_id",$data['mta_id'])->update(['state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取期刊领域树
|
||||
* @description 获取期刊领域树
|
||||
|
||||
Reference in New Issue
Block a user