作者 李宇航

合并分支 'lyh-server' 到 'master'

未续费项目增加搜索



查看合并请求 !2647
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Template\ATemplateLogic; 7 use App\Http\Logic\Aside\Template\ATemplateLogic;
8 use App\Http\Requests\Aside\Template\ATemplateRequest; 8 use App\Http\Requests\Aside\Template\ATemplateRequest;
  9 +use App\Models\Manage\ManageHr;
9 use App\Models\Template\TemplateLabel; 10 use App\Models\Template\TemplateLabel;
10 11
11 /** 12 /**
@@ -26,12 +27,14 @@ class ATemplateController extends BaseController @@ -26,12 +27,14 @@ class ATemplateController extends BaseController
26 public function lists(ATemplateLogic $aTemplateLogic){ 27 public function lists(ATemplateLogic $aTemplateLogic){
27 $templateLabel = new TemplateLabel(); 28 $templateLabel = new TemplateLabel();
28 $this->map = $this->searchLabelName($templateLabel); 29 $this->map = $this->searchLabelName($templateLabel);
29 - $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; 30 + $filed = ['id','name','image','url','status','upload_id','sort','deleted_status','test_model','created_at','project_id'];
30 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); 31 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed);
31 if(!empty($lists) && !empty($lists['list'])){ 32 if(!empty($lists) && !empty($lists['list'])){
  33 + $manageModel = new ManageHr();
32 foreach ($lists['list'] as $k => $v){ 34 foreach ($lists['list'] as $k => $v){
33 $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5); 35 $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5);
34 $v['image_link'] = getImageUrl($v['image']); 36 $v['image_link'] = getImageUrl($v['image']);
  37 + $v['upload_name'] = $manageModel->getName($v['upload_id']);
35 $lists['list'][$k] = $v; 38 $lists['list'][$k] = $v;
36 } 39 }
37 } 40 }
@@ -93,14 +93,33 @@ class GeoQuestionResLogic extends BaseLogic @@ -93,14 +93,33 @@ class GeoQuestionResLogic extends BaseLogic
93 $core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0; 93 $core_question_count = $questionTotalCount = $urlTotalCount = $keywordsTotalCount = 0;
94 $keywordArr = []; 94 $keywordArr = [];
95 $questionLogModel = new GeoQuestionLog(); 95 $questionLogModel = new GeoQuestionLog();
96 - $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);  
97 - $coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'hit'=>['!=',0]]); 96 + if($this->user['project_id'] == 4533){
  97 + $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0]]);
98 foreach ($list as $item){ 98 foreach ($list as $item){
99 $questionTotalCount += count($item['question'] ?? []); 99 $questionTotalCount += count($item['question'] ?? []);
100 //核心问题数 100 //核心问题数
101 if(strpos($item['label'],'核心问题') !== false){ 101 if(strpos($item['label'],'核心问题') !== false){
102 $core_question_count += count($item['question'] ?? []); 102 $core_question_count += count($item['question'] ?? []);
103 } 103 }
  104 + foreach ($item['keywords'] as $keyWordItem){
  105 + if (!array_key_exists($keyWordItem, $keywordArr)) {
  106 + $keywordArr[$keyWordItem] = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'keywords'=>['like','%"'.$keyWordItem.'"%']]);
  107 + }
  108 + }
  109 + }
  110 + $coreKeywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'label'=>['like','%核心问题%'],'is_match'=>1,'hit'=>['!=',0]]);
  111 + $data = [
  112 + 'question_count'=>$questionTotalCount,//问题总数
  113 + 'core_question_count'=>$core_question_count,//核心问题总数
  114 + 'keywords_url_count'=>$keywordUrlCount,
  115 + 'keywords_arr' => $keywordArr,
  116 + 'core_keyword_url_count'=>$coreKeywordUrlCount ?? 0
  117 + ];
  118 + return $this->success($data);
  119 + }else{
  120 + $keywordUrlCount = $questionLogModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0]]);
  121 + foreach ($list as $item){
  122 + $questionTotalCount += count($item['question'] ?? []);
104 $keywordsTotalCount += count($item['keywords'] ?? []); 123 $keywordsTotalCount += count($item['keywords'] ?? []);
105 $urlTotalCount += count($item['url'] ?? []); 124 $urlTotalCount += count($item['url'] ?? []);
106 foreach ($item['keywords'] as $keyWordItem){ 125 foreach ($item['keywords'] as $keyWordItem){
@@ -110,16 +129,15 @@ class GeoQuestionResLogic extends BaseLogic @@ -110,16 +129,15 @@ class GeoQuestionResLogic extends BaseLogic
110 } 129 }
111 } 130 }
112 $data = [ 131 $data = [
  132 + 'question_count'=>$questionTotalCount,
113 'keywords_count'=>$keywordsTotalCount, 133 'keywords_count'=>$keywordsTotalCount,
114 'url_count'=>$urlTotalCount, 134 'url_count'=>$urlTotalCount,
115 - 'question_count'=>$questionTotalCount,  
116 'keywords_url_count'=>$keywordUrlCount, 135 'keywords_url_count'=>$keywordUrlCount,
117 'keywords_arr' => $keywordArr, 136 'keywords_arr' => $keywordArr,
118 - 'core_question_count'=>$core_question_count,  
119 - 'core_keyword_url_count'=>$coreKeywordUrlCount  
120 ]; 137 ];
121 return $this->success($data); 138 return $this->success($data);
122 } 139 }
  140 + }
123 141
124 /** 142 /**
125 * @remark :按平台统计问题数量 143 * @remark :按平台统计问题数量
@@ -134,8 +152,12 @@ class GeoQuestionResLogic extends BaseLogic @@ -134,8 +152,12 @@ class GeoQuestionResLogic extends BaseLogic
134 $list = $platformModel->list(['status'=>1],'id',['name','en_name']); 152 $list = $platformModel->list(['status'=>1],'id',['name','en_name']);
135 $questionResModel = new GeoQuestionLog(); 153 $questionResModel = new GeoQuestionLog();
136 foreach ($list as $item){ 154 foreach ($list as $item){
  155 + if($this->user['project_id'] == 4533){
  156 + $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'is_match'=>1,'hit'=>['!=',0],'platform'=>$item['en_name']]);
  157 + }else{
137 $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]); 158 $data[$item['name']] = $questionResModel->counts(['project_id'=>$this->user['project_id'],'hit'=>['!=',0],'platform'=>$item['en_name']]);
138 } 159 }
  160 + }
139 return $this->success($data); 161 return $this->success($data);
140 } 162 }
141 163