作者 李宇航

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

geo设置



查看合并请求 !2322
@@ -72,7 +72,7 @@ class GeoQuestionResController extends BaseController @@ -72,7 +72,7 @@ class GeoQuestionResController extends BaseController
72 'project_id.required' => 'project_id不能为空', 72 'project_id.required' => 'project_id不能为空',
73 'type.required' => '品牌类型不能为空' 73 'type.required' => '品牌类型不能为空'
74 ]); 74 ]);
75 - $data = $this->logic->getResultList($this->map,$this->page,$this->row,$this->order); 75 + $data = $this->logic->getResultList($this->map,$this->page,$this->row);
76 $this->response('success',Code::SUCCESS,$data); 76 $this->response('success',Code::SUCCESS,$data);
77 } 77 }
78 78
@@ -29,9 +29,10 @@ class GeoQuestionResLogic extends BaseLogic @@ -29,9 +29,10 @@ class GeoQuestionResLogic extends BaseLogic
29 * @time :2025/7/8 17:16 29 * @time :2025/7/8 17:16
30 */ 30 */
31 public function getCount(){ 31 public function getCount(){
  32 + $total = $this->model->counts(['project_id'=>$this->user['project_id']]);
32 $type_1 = $this->model->counts(['type'=>1,'project_id'=>$this->user['project_id']]); 33 $type_1 = $this->model->counts(['type'=>1,'project_id'=>$this->user['project_id']]);
33 $type_2 = $this->model->counts(['type'=>2,'project_id'=>$this->user['project_id']]); 34 $type_2 = $this->model->counts(['type'=>2,'project_id'=>$this->user['project_id']]);
34 - return $this->success(['type_1'=>$type_1,'type_2'=>$type_2]); 35 + return $this->success(['total'=>$total,'type_1'=>$type_1,'type_2'=>$type_2]);
35 } 36 }
36 37
37 /** 38 /**
@@ -41,20 +42,11 @@ class GeoQuestionResLogic extends BaseLogic @@ -41,20 +42,11 @@ class GeoQuestionResLogic extends BaseLogic
41 * @method :post 42 * @method :post
42 * @time :2025/7/4 9:48 43 * @time :2025/7/4 9:48
43 */ 44 */
44 - public function getResultList($map = [],$page = 1,$row = 20,$order = 'id'){ 45 + public function getResultList($map = [],$page = 1,$row = 20){
45 $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at']; 46 $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at'];
46 - $result = GeoQuestionResult::select($filed)  
47 - ->where($map)  
48 - ->where(function($query) {  
49 - $query->where('keywords', '!=', '[]')  
50 - ->orWhere('url', '!=', '[]');  
51 - })  
52 - ->orderByRaw('LENGTH(question) ASC')  
53 - ->paginate($row, $filed, 'page', $page);  
54 - $data = empty($result) ? [] : $result->toArray();  
55 -  
56 -// $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at'];  
57 -// $data = $this->model->lists($map,$page,$row,$order,$filed); 47 + $map['keywords'] = ['!=','[]'];
  48 + $map['url'] = ['!=','[]'];
  49 + $data = $this->model->formatQuery($map)->orderByRaw('CHAR_LENGTH(question) asc')->paginate($row, $filed, 'page', $page);
58 return $this->success($data); 50 return $this->success($data);
59 } 51 }
60 52