作者 lyh

GX生成白帽报表脚本

@@ -90,6 +90,7 @@ class GeoQuestionController extends BaseController @@ -90,6 +90,7 @@ class GeoQuestionController extends BaseController
90 * @param : keywords->提交的关键字 90 * @param : keywords->提交的关键字
91 * @param : status->状态(0:可执行 1:禁止执行) 91 * @param : status->状态(0:可执行 1:禁止执行)
92 * @param : project_id->项目id 92 * @param : project_id->项目id
  93 + * @param : type->类型(1:品牌 2:营销)
93 */ 94 */
94 public function saveGeoQuestion(){ 95 public function saveGeoQuestion(){
95 $this->request->validate([ 96 $this->request->validate([
@@ -98,12 +99,14 @@ class GeoQuestionController extends BaseController @@ -98,12 +99,14 @@ class GeoQuestionController extends BaseController
98 'keywords'=>'required', 99 'keywords'=>'required',
99 'url'=>'required', 100 'url'=>'required',
100 'status'=>'required', 101 'status'=>'required',
  102 + 'type'=>'required',
101 ],[ 103 ],[
102 'project_id.required' => '项目ID不能为空', 104 'project_id.required' => '项目ID不能为空',
103 'question.required' => '项目ID不能为空', 105 'question.required' => '项目ID不能为空',
104 'keywords.required' => '项目ID不能为空', 106 'keywords.required' => '项目ID不能为空',
105 'url.required' => '项目ID不能为空', 107 'url.required' => '项目ID不能为空',
106 'status.required' => '项目ID不能为空', 108 'status.required' => '项目ID不能为空',
  109 + 'type.required' => '类型不能为空',
107 ]); 110 ]);
108 $data = $this->logic->saveGeoQuestion(); 111 $data = $this->logic->saveGeoQuestion();
109 $this->response('success',Code::SUCCESS,$data); 112 $this->response('success',Code::SUCCESS,$data);
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Logic\Aside\Geo; 10 namespace App\Http\Logic\Aside\Geo;
11 11
12 use App\Http\Logic\Aside\BaseLogic; 12 use App\Http\Logic\Aside\BaseLogic;
  13 +use App\Models\Geo\GeoPlatform;
13 use App\Models\Geo\GeoQuestion; 14 use App\Models\Geo\GeoQuestion;
14 use App\Models\Project\Project; 15 use App\Models\Project\Project;
15 16
@@ -43,7 +44,10 @@ class GeoLogic extends BaseLogic @@ -43,7 +44,10 @@ class GeoLogic extends BaseLogic
43 * @time :2025/7/3 10:47 44 * @time :2025/7/3 10:47
44 */ 45 */
45 public function getType(){ 46 public function getType(){
46 - return $this->model->brandType(); 47 + $data = $this->model->brandType();
  48 + $geoPlatformModel = new GeoPlatform();
  49 + $data['platform'] = $geoPlatformModel->getList();
  50 + return $this->success($data);
47 } 51 }
48 52
49 /** 53 /**
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :GeoPlatform.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/7/3 11:16
  8 + */
  9 +
  10 +namespace App\Models\Geo;
  11 +
  12 +use App\Models\Base;
  13 +use Illuminate\Support\Facades\Cache;
  14 +
  15 +/**
  16 + * @remark :geo设置平台类型
  17 + * @name :GeoPlatform
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/7/3 11:16
  21 + */
  22 +class GeoPlatform extends Base
  23 +{
  24 + protected $table = 'gl_geo_platform';
  25 +
  26 + const STATUS_ON = 1;
  27 +
  28 + /**
  29 + * @remark :获取平台列表
  30 + * @name :getList
  31 + * @author :lyh
  32 + * @method :post
  33 + * @time :2025/7/3 11:18
  34 + */
  35 + public function getList(){
  36 + $data = Cache::get('geo_platform');
  37 + if(empty($data)){
  38 + $data = $this->list(['status'=>$this::STATUS_ON],'id',['name','icon','sort'],'desc');
  39 + Cache::put('geo_platform',$data,'12 * 3600');
  40 + }
  41 + return $data;
  42 + }
  43 +}