From aff3123377be5624276187292e6db6ee4df9d5b4 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Tue, 11 Feb 2025 09:19:24 +0800 Subject: [PATCH] 1 --- application/api/controller/Base.php | 4 +++ application/api/controller/Monitor.php | 8 +++--- application/api/controller/Preaccept.php | 10 +++---- application/api/controller/Publish.php | 10 ++++++- application/api/controller/Ucenter.php | 15 ++++++++--- application/api/controller/User.php | 34 ++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 13 deletions(-) diff --git a/application/api/controller/Base.php b/application/api/controller/Base.php index 746cf32..fa8eee2 100644 --- a/application/api/controller/Base.php +++ b/application/api/controller/Base.php @@ -84,6 +84,8 @@ class Base extends Controller protected $order_obj = ""; protected $article_main_log_obj = ""; protected $article_main_check_obj = ""; + protected $major_to_user_obj = ""; + protected $major_to_article_obj = ""; public function __construct(\think\Request $request = null) @@ -163,6 +165,8 @@ class Base extends Controller $this->order_obj = Db::name("order"); $this->article_main_log_obj = Db::name("article_main_log"); $this->article_main_check_obj = Db::name("article_main_check"); + $this->major_to_user_obj = Db::name("major_to_user"); + $this->major_to_article_obj = Db::name("major_to_article"); } diff --git a/application/api/controller/Monitor.php b/application/api/controller/Monitor.php index 173fb0c..b4b5f3c 100644 --- a/application/api/controller/Monitor.php +++ b/application/api/controller/Monitor.php @@ -203,8 +203,8 @@ class Monitor extends Base if($abbr=="PD"&&$year<2024){ $abbr = "PR"; } - $n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->count(); - $nj = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->where("journal_id","<>",$v['journal_id'])->count(); + $n = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->where("state",">",-1)->count(); + $nj = $this->article_obj->where("ctime",">",$s_time)->where("ctime","<",$e_time)->where("accept_sn","like",$abbr."%")->where("state",">",-1)->where("journal_id","<>",$v['journal_id'])->count(); $frag[$year] = $n."/".$nj; $year++; } @@ -293,8 +293,8 @@ class Monitor extends Base while ($yeararticle_obj->where("ctime",">",$s_time)->where("state",">",-1)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->count(); - $nj = $this->article_obj->where("ctime",">",$s_time)->where("state",">",-1)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->where("journal_id","<>",$v['journal_id'])->count(); + $n = $this->article_obj->where("ctime",">",$s_time)->where("state",">",-1)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->where("state",">",-1)->count(); + $nj = $this->article_obj->where("ctime",">",$s_time)->where("state",">",-1)->where("ctime","<",$e_time)->where("accept_sn","like",$v['abbr']."%")->where("state",">",-1)->where("journal_id","<>",$v['journal_id'])->count(); $frag[$year."-".$month] = $n."/".$nj; if($month==12){ $year++; diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php index be5b6db..7a03ad6 100644 --- a/application/api/controller/Preaccept.php +++ b/application/api/controller/Preaccept.php @@ -757,14 +757,14 @@ class Preaccept extends Base $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); //上一行,空行 $p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select(); - if($p_list[0]['type']>0||$p_list[0]['content']!=""){ + if($p_list&&($p_list[0]['type']>0||$p_list[0]['content']!="")){ $this->addBRow($am_info['article_id'],$p_list[0]['am_id']); } $n_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort",">",$am_info['sort'])->whereIn("state",[0,2])->order("sort asc")->limit(1)->select(); if($n_list[0]['type']>0||$n_list[0]['content']!=""){ $this->addBRow($am_info['article_id'],$data['am_id']); } - $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"content"=>"".$am_info['content'].""]); + $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"is_h2"=>0,"is_h3"=>0,"content"=>"".$am_info['content'].""]); return jsonSuccess([]); } @@ -779,10 +779,10 @@ class Preaccept extends Base $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); //上一行,空行 $p_list = $this->article_main_obj->where("article_id",$am_info['article_id'])->where("sort","<",$am_info['sort'])->whereIn("state",[0,2])->order("sort desc")->limit(1)->select(); - if($p_list[0]['type']>0||$p_list[0]['content']!=""){ + if($p_list&&($p_list[0]['type']>0||$p_list[0]['content']!="")){ $this->addBRow($am_info['article_id'],$p_list[0]['am_id']); } - $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h2"=>1,"content"=>"".$am_info['content'].""]); + $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>1,"is_h3"=>0,"content"=>"".$am_info['content'].""]); return jsonSuccess([]); } @@ -795,7 +795,7 @@ class Preaccept extends Base return jsonError($rule->getError()); } $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); - $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h3"=>1,"content"=>"".$am_info['content'].""]); + $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>1,"content"=>"".$am_info['content'].""]); return jsonSuccess([]); } diff --git a/application/api/controller/Publish.php b/application/api/controller/Publish.php index 85269de..edc5291 100644 --- a/application/api/controller/Publish.php +++ b/application/api/controller/Publish.php @@ -180,7 +180,15 @@ class Publish extends Base $pra = []; $pra['article_id'] = $data['article_id']; $res = object_to_array(json_decode(myPost($url, $pra))); - $re['detail'] = $res['data']["detail"]; + $detail = $res['data']["detail"]; + + if($detail['html_type']==2){ + $product = $this->production_article_obj->where("w_article_id",$data['article_id'])->find(); + $check = $this->article_main_obj->where("article_id",$product['article_id'])->find(); + $detail['has_html'] = $check?1:0; + } + + $re['detail'] = $detail; return jsonSuccess($re); } diff --git a/application/api/controller/Ucenter.php b/application/api/controller/Ucenter.php index 5ca79aa..7478684 100644 --- a/application/api/controller/Ucenter.php +++ b/application/api/controller/Ucenter.php @@ -54,9 +54,18 @@ class Ucenter extends Base{ ->join('t_user_reviewer_info','t_user.user_id = t_user_reviewer_info.reviewer_id','left') ->where('t_user.user_id',$data['user_id']) ->find(); - + //获取用户的领域 $userInfo['baseInfo']['majorshu'] = $userInfo['baseInfo']['major']==0?'':getMajorShu($userInfo['baseInfo']['major']); $userInfo['baseInfo']['majorStr'] = $userInfo['baseInfo']['major']==0?'':getMajorStr($userInfo['baseInfo']['major']); + $majors = $this->major_to_user_obj->where("user_id",$data['user_id'])->where("state",0)->select(); + foreach ($majors as $k => $v){ + $majors[$k]['shu'] = $this->getMajorShu($v['major_id']); + $majors[$k]['str'] = $this->getMajorStr($v['major_id']); + } + $userInfo['baseInfo']['majors'] = $majors; + + + //cv信息 $cvs = $this->user_cv_obj->where('user_id',$data['user_id'])->where('state',0)->select(); $userInfo['cvs'] = $cvs; @@ -557,8 +566,8 @@ class Ucenter extends Base{ if(!$rule->check($data)){ return jsonError($rule->getError()); } - $major = $this->major_obj->where('major_id',$data['major_id'])->find(); - $major['children'] = $this->major_obj->where('pid',$major['major_id'])->select(); + $major = $this->major_obj->where('major_id',$data['major_id'])->where("major_state",0)->find(); + $major['children'] = $this->major_obj->where('pid',$major['major_id'])->where("major_state",0)->select(); $re['major'] = $major; return jsonSuccess($re); } diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 71e0cd6..e953963 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -1458,6 +1458,40 @@ class User extends Base return jsonSuccess($re); } + + + public function addUserMajor(){ + $data = $this->request->post(); + $rule = new Validate([ + "user_id"=>"require", + "major_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $check = $this->major_to_user_obj->where("user_id",$data['user_id'])->where("major_id",$data['major_id'])->where("state",0)->find(); + if($check){ + return jsonError("Repeat addition"); + } + $insert['user_id'] = $data['user_id']; + $insert['major_id'] = $data['major_id']; + $insert['ctime'] = time(); + $this->major_to_user_obj->insert($insert); + return jsonSuccess([]); + } + + public function delUserMajor(){ + $data = $this->request->post(); + $rule = new Validate([ + "mtu_id"=>"require" + ]); + if(!$rule->check($data)){ + return jsonError($rule->getError()); + } + $this->major_to_user_obj->where("mtu_id",$data['mtu_id'])->update(['state'=>1]); + return jsonSuccess([]); + } + /** * 获取用户所有客座专刊 */