From 75ca1abe78dc35614d9475f4d0a3513d8e6804ae Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 28 May 2025 15:36:10 +0800 Subject: [PATCH] =?UTF-8?q?major=20=E5=B0=8F=E7=89=88=E6=9C=AC=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Base.php | 22 ++++++++++++++++++++++ application/api/controller/Preaccept.php | 2 +- application/api/controller/Production.php | 13 +++++++++++-- application/api/controller/Ucenter.php | 15 +++++++++++---- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/application/api/controller/Base.php b/application/api/controller/Base.php index 390c8a8..e663b6b 100644 --- a/application/api/controller/Base.php +++ b/application/api/controller/Base.php @@ -237,6 +237,28 @@ class Base extends Controller return $frag; } + + /** + * @param $user_id + * @param $majors "1,2,3" + * @return void + */ + public function updateUserMajor($user_id,$majors){ + $news = explode(",",$majors); + $has = $this->major_to_user_obj->where("user_id",$user_id)->where("state",0)->column("major_id"); + $del_list = array_diff($has,$news); + $update_list = array_diff($news,$has); + foreach ($del_list as $v){ + $this->major_to_user_obj->where("user_id",$user_id)->where("major_id",$v)->update(['state'=>1]); + } + foreach ($update_list as $v){ + $insert['user_id'] = $user_id; + $insert['major_id'] = $v; + $insert['ctime'] = time(); + $this->major_to_user_obj->insert($insert); + } + } + public function delOneRefer($p_refer_id) { diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php index b1af7e6..98fef9a 100644 --- a/application/api/controller/Preaccept.php +++ b/application/api/controller/Preaccept.php @@ -762,7 +762,7 @@ class Preaccept extends Base } $order_info['paystation'] = $paystation; } - $re['state'] = $order_info?$order_info['state']:0; + $re['state'] = $order_info?$order_info['state']:$article_info['is_buy']; $re['fee'] = $journal_info['fee']; $re['order'] = $order_info; return jsonSuccess($re); diff --git a/application/api/controller/Production.php b/application/api/controller/Production.php index 5da3ed1..bf03e43 100644 --- a/application/api/controller/Production.php +++ b/application/api/controller/Production.php @@ -1314,6 +1314,7 @@ class Production extends Base $typesetInfo['author'] = $au_res['author']; $typesetInfo['authorAddress'] = $au_res['address']; + $typesetInfo['authorAddressList'] = $au_res['addressList1']; $typesetInfo['authorContribution'] = $p_info['author_contribution']; //查询通讯作者 @@ -1371,19 +1372,21 @@ class Production extends Base if($item['type']==1){ $info = $this->article_main_image_obj->where("ami_id",$item['ami_id'])->find(); $arr['image'] = $info['url']; + $arr['title'] = "".$info['title'].""; $arr['note'] = $info['note']; $images[$info['ami_id']] = $arr; $main_string = ""; }else if($item['type']==2){ $info = $this->article_main_table_obj->where("amt_id",$item['amt_id'])->find(); - $arr_table['title'] = $info['title']; + $arr_table['title'] = "".strip_tags($info['title']).""; $arr_table['table_data'] = $info['table_data']; $arr_table['note'] = $info['note']; $tables[$info['amt_id']] = $arr_table; $main_string = ""; }else{ if($item['is_h1']==1){ - $main_string = "".$item['content'].""; +// $main_string = "".$item['content'].""; + $main_string = "".strip_tags($item['content']).""; }else if($item['is_h2']==1||$item['is_h3']==1){ $main_string = "".$item['content'].""; }else{ @@ -2190,12 +2193,18 @@ class Production extends Base } //组装address $address_str = ''; + $address1 = []; foreach ($address as $k => $v) { $address_str .= ($k + 1) . ' ' . $v . ' '; + $address1[] = [ + "k"=>$k + 1, + "content"=>$v + ]; } $frag['author'] = $author; $frag['address'] = $address_str; $frag['addressList'] = $address; + $frag['addressList1'] = $address1; return $frag; } diff --git a/application/api/controller/Ucenter.php b/application/api/controller/Ucenter.php index 37e387b..203f4c9 100644 --- a/application/api/controller/Ucenter.php +++ b/application/api/controller/Ucenter.php @@ -59,8 +59,8 @@ class Ucenter extends Base{ ->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']); +// $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']); @@ -354,7 +354,7 @@ class Ucenter extends Base{ 'realname'=>'require', 'technical'=>'require', 'country'=>'require', - 'major'=>'require|number', + 'major'=>'require', 'field'=>'require' ]); if(!$rule->check($data)){ @@ -369,17 +369,24 @@ class Ucenter extends Base{ $updata1=[ 'technical'=>$data['technical'], 'country'=>$data['country'], - 'major'=>$data['major'], +// 'major'=>$data['major'], 'field'=>$data['field'], 'introduction'=>isset($data['introduction'])?$data['introduction']:'', "website"=>isset($data['website'])?$data["website"]:"", 'company'=>$data['company'] ]; $this->user_reviewer_info_obj->where(['reviewer_id'=>$data['user_id']])->update($updata1); + self::updateUserMajor($data['user_id'],$data['major']); return jsonSuccess([]); } + + public function up_test(){ + $res = self::updateUserMajor(20837,"16,14"); + return jsonSuccess($res); + } + /** * Notes: 修改 asReviewe 信息 * User: wangzhaocui