正在显示
4 个修改的文件
包含
54 行增加
和
7 行删除
| @@ -66,7 +66,7 @@ class BaseController extends Controller | @@ -66,7 +66,7 @@ class BaseController extends Controller | ||
| 66 | $this->param['id'] = $id; | 66 | $this->param['id'] = $id; |
| 67 | } | 67 | } |
| 68 | } | 68 | } |
| 69 | - if(isset($this->param['project_id']) && !empty($this->param['project_id'])){ | 69 | + if(isset($this->param['project_id']) && !empty($this->param['project_id']) && !is_array($this->param['project_id'])){ |
| 70 | if (preg_match('/^[A-Za-z]/', $this->param['project_id'])) { | 70 | if (preg_match('/^[A-Za-z]/', $this->param['project_id'])) { |
| 71 | $id = Cache::get('project_'.$this->param['project_id']); | 71 | $id = Cache::get('project_'.$this->param['project_id']); |
| 72 | if(empty($id)){ | 72 | if(empty($id)){ |
| @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Bside\HomeCount; | @@ -5,6 +5,8 @@ namespace App\Http\Controllers\Bside\HomeCount; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Bside\BaseController; | 6 | use App\Http\Controllers\Bside\BaseController; |
| 7 | use App\Http\Logic\Bside\HomeCount\CountLogic; | 7 | use App\Http\Logic\Bside\HomeCount\CountLogic; |
| 8 | +use App\Models\Project\Project; | ||
| 9 | + | ||
| 8 | class CountController extends BaseController | 10 | class CountController extends BaseController |
| 9 | { | 11 | { |
| 10 | const STATUS_ERROR = 400; | 12 | const STATUS_ERROR = 400; |
| @@ -15,10 +17,6 @@ class CountController extends BaseController | @@ -15,10 +17,6 @@ class CountController extends BaseController | ||
| 15 | * @time :2023/5/23 17:23 | 17 | * @time :2023/5/23 17:23 |
| 16 | */ | 18 | */ |
| 17 | public function count(CountLogic $countLogic){ | 19 | public function count(CountLogic $countLogic){ |
| 18 | - if($this->user['project_id'] == 5172){ | ||
| 19 | - $this->user['project_id'] = 3298; | ||
| 20 | - $this->user['domain'] = 'https://www.annorobots.com/'; | ||
| 21 | - } | ||
| 22 | $data = []; | 20 | $data = []; |
| 23 | //TODO::昨日数据统计 | 21 | //TODO::昨日数据统计 |
| 24 | $data['yesterday'] = $countLogic->yesterday_count(); | 22 | $data['yesterday'] = $countLogic->yesterday_count(); |
| @@ -42,4 +40,16 @@ class CountController extends BaseController | @@ -42,4 +40,16 @@ class CountController extends BaseController | ||
| 42 | $data['enterprise_service'] = $countLogic->enterprise_service(); | 40 | $data['enterprise_service'] = $countLogic->enterprise_service(); |
| 43 | return $this->response('success',Code::SUCCESS,$data); | 41 | return $this->response('success',Code::SUCCESS,$data); |
| 44 | } | 42 | } |
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * @remark : | ||
| 46 | + * @name :info5172count | ||
| 47 | + * @author :lyh | ||
| 48 | + * @method :post | ||
| 49 | + * @time :2025/11/6 15:10 | ||
| 50 | + */ | ||
| 51 | + public function info5172count() | ||
| 52 | + { | ||
| 53 | + | ||
| 54 | + } | ||
| 45 | } | 55 | } |
| @@ -121,10 +121,11 @@ class GeoLogic extends BaseLogic | @@ -121,10 +121,11 @@ class GeoLogic extends BaseLogic | ||
| 121 | if(empty($geo_question_count)){ | 121 | if(empty($geo_question_count)){ |
| 122 | $geo_question_count = 0; | 122 | $geo_question_count = 0; |
| 123 | } | 123 | } |
| 124 | - $geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->count(); | 124 | + $geo_pr_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_NEWS)->count(); |
| 125 | + $geo_link_count = GeoLink::where('project_id',$this->param['project_id'])->where('type',GeoLink::TYPE_LINK)->count(); | ||
| 125 | $geo_writings_count = GeoWritings::where('project_id',$this->param['project_id'])->count(); | 126 | $geo_writings_count = GeoWritings::where('project_id',$this->param['project_id'])->count(); |
| 126 | $geo_writings_count += GeoArticle::where('project_id',$this->param['project_id'])->count(); | 127 | $geo_writings_count += GeoArticle::where('project_id',$this->param['project_id'])->count(); |
| 127 | - return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count]); | 128 | + return $this->success(['geo_writings_count'=>$geo_writings_count,'geo_pr_count'=>$geo_pr_count,'geo_question_count'=>$geo_question_count,'geo_link_count'=>$geo_link_count]); |
| 128 | } | 129 | } |
| 129 | 130 | ||
| 130 | } | 131 | } |
| @@ -36,6 +36,9 @@ class CountLogic extends BaseLogic | @@ -36,6 +36,9 @@ class CountLogic extends BaseLogic | ||
| 36 | */ | 36 | */ |
| 37 | public function yesterday_count(){ | 37 | public function yesterday_count(){ |
| 38 | $yesterday = Carbon::yesterday()->toDateString(); | 38 | $yesterday = Carbon::yesterday()->toDateString(); |
| 39 | + if($this->user['project_id'] == 5172){ | ||
| 40 | + $this->user['project_id'] = 3298; | ||
| 41 | + } | ||
| 39 | $param = [ | 42 | $param = [ |
| 40 | 'date' => $yesterday, | 43 | 'date' => $yesterday, |
| 41 | 'project_id' => $this->user['project_id'] | 44 | 'project_id' => $this->user['project_id'] |
| @@ -48,6 +51,39 @@ class CountLogic extends BaseLogic | @@ -48,6 +51,39 @@ class CountLogic extends BaseLogic | ||
| 48 | $inquiry_num = Cache::get('inquiry_num_'.$this->user['project_id']); | 51 | $inquiry_num = Cache::get('inquiry_num_'.$this->user['project_id']); |
| 49 | if(empty($inquiry_num)){ | 52 | if(empty($inquiry_num)){ |
| 50 | $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分 | 53 | $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分 |
| 54 | + if($this->user['project_id'] == 5172){ | ||
| 55 | + $domain = 3298; | ||
| 56 | + } | ||
| 57 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']); | ||
| 58 | + if($inquiry_list !== false){ | ||
| 59 | + if(isset($inquiry_list['status']) && $inquiry_list['status'] != 400){ | ||
| 60 | + $info['inquiry_num'] = $inquiry_list['data']['count']; | ||
| 61 | + Cache::add('inquiry_num_'.$this->user['project_id'],$inquiry_list['data']['count'],3600); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + //获取项目的剩余时长 | ||
| 66 | + $projectModel = new Project(); | ||
| 67 | + $projectInfo = $projectModel->read(['id'=>$this->user['project_id']],['remain_day','finish_remain_day']); | ||
| 68 | + $info['service_day'] = $projectInfo['remain_day']; | ||
| 69 | + $info['compliance_day'] = $projectInfo['finish_remain_day']; | ||
| 70 | + return $this->success($info); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public function yesterday_5172_count(){ | ||
| 74 | + $yesterday = Carbon::yesterday()->toDateString(); | ||
| 75 | + $param = [ | ||
| 76 | + 'date' => $yesterday, | ||
| 77 | + 'project_id' => 3298 | ||
| 78 | + ]; | ||
| 79 | + $info = $this->model->read($param,['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']); | ||
| 80 | + if($info === false){ | ||
| 81 | + $info = $this->model->read(['project_id' => $this->user['project_id']], | ||
| 82 | + ['pv_num','ip_num','inquiry_num','date','compliance_day','service_day','country']); | ||
| 83 | + } | ||
| 84 | + $inquiry_num = Cache::get('inquiry_num_'.$this->user['project_id']); | ||
| 85 | + if(empty($inquiry_num)){ | ||
| 86 | + $domain = parse_url($this->user['domain'], PHP_URL_HOST); // 直接取域名部分 | ||
| 51 | $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']); | 87 | $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$this->user['is_upgrade']); |
| 52 | if($inquiry_list !== false){ | 88 | if($inquiry_list !== false){ |
| 53 | if(isset($inquiry_list['status']) && $inquiry_list['status'] != 400){ | 89 | if(isset($inquiry_list['status']) && $inquiry_list['status'] != 400){ |
-
请 注册 或 登录 后发表评论