From 594e94661eb2571c4911e9a4d015d0c607490b1c Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 10 May 2023 10:38:51 +0800 Subject: [PATCH] 1 --- application/api/controller/Article.php | 24 +++++++++++ application/api/controller/Promotion.php | 52 +++++++++++++++++++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php index 0a2ce0c..dcbcdf0 100644 --- a/application/api/controller/Article.php +++ b/application/api/controller/Article.php @@ -2223,8 +2223,12 @@ class Article extends Base $authors = $this->article_author_obj->where('article_id', $article_id)->where('is_report', 1)->where('state', 0)->select(); $user_id = $article_info['user_id']; $g_index = 0; + $google_time = 0; foreach ($authors as $v) { $c_user = $this->user_obj->where('email', $v['email'])->find(); + if($google_time<$c_user['google_time']){//应对h指数为0的用户文章,先取是否填写过h指数为0的情况 + $google_time = $c_user['google_time']; + } if ($c_user['google_index'] >= $g_index) { $user_id = $c_user['user_id']; $g_index = $c_user['google_index']; @@ -2275,6 +2279,26 @@ class Article extends Base $b_fen = 0; } + //当h指数为0 并且是编辑填写的 + if($user_info['google_index']==0&&$google_time>0){ + if($all_num>=8){ + $b_fen = 4; + }elseif ($all_num==7){ + $b_fen = 3.5; + }elseif ($all_num==6){ + $b_fen = 3; + }elseif ($all_num==5){ + $b_fen = 2; + }elseif ($all_num==4){ + $b_fen = 1.5; + }elseif ($all_num >= 1){ + $b_fen = 1; + }else{ + $b_fen = 0; + } + } + + $fen += $b_fen; //国家 $c_fen = 0; diff --git a/application/api/controller/Promotion.php b/application/api/controller/Promotion.php index c461f82..efeef51 100644 --- a/application/api/controller/Promotion.php +++ b/application/api/controller/Promotion.php @@ -4,6 +4,7 @@ namespace app\api\controller; use app\api\controller\Base; use think\Db; +use think\Exception; use think\Queue; use think\Validate; class Promotion extends Base @@ -43,19 +44,66 @@ class Promotion extends Base /**筛选用户库目标数量 * @return void + * @throws Exception */ public function getLibUsers(){ $data = $this->request->post(); $rule = new Validate([ "lib"=>"require", - '' + 'category'=>"require", + "body"=>"require" ]); if(!$rule->check($data)){ return jsonError($rule->getError()); } + $count = 0; + if($data['lib']=="user"){//用户库选择为正式库 + $where['t_user.state'] = 0; + $where['t_user.no_email'] = 0; + if($data['category']=="major"){ + $where['t_user_reviewer_info.major'] = ['in',$this->majorids($data['body'])]; + }else{ + $where["t_user_reviewer_info.field"] = ["like","%".$data['body']."%"]; + } + $count=$this->user_obj->join("t_user_reviewer_info","t_user.user_id = t_user_reviewer_info.reviewer_id","left")->where($where)->count(); + }elseif($data['lib']=="author"){//用户库选择为作者库 + $where['t_user.state'] = 0; + $where['t_user.no_email'] = 0; + if($data['category']=="major"){ + $where['t_user_reviewer_info.major'] = ['in',$this->majorids($data['body'])]; + }else{ + $where["t_user_reviewer_info.field"] = ["like","%".$data['body']."%"]; + } + $exist = "select * from t_user_author where user_id = t_user.user_id"; + $count=$this->user_obj->join("t_user_reviewer_info","t_user.user_id = t_user_reviewer_info.reviewer_id","left")->where($where)->whereExists($exist)->count(); + }else{//灰库 + $where["t_user_ash.state"] = 0 ; + $where['t_user_ash.no_email'] = 0; + if($data['category']=="major"){ + $where['t_user_ash.major'] = ['in',$this->majorids($data['body'])]; + }else { + $where['t_use_ash.field'] = ['like',"%".$data['body']."%"]; + } + $count=$this->user_ash_obj->where($where)->count(); + } + $re['count'] = $count; + + return jsonSuccess($re); + } + + /**退订推广邮件 + * @return void + */ + public function NoEmail(){ + + } + + /**获取邮件模版列表 + * @return void + */ + public function getEmailModel(){ } - } \ No newline at end of file