GeoQuestionResLogic.php
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* @remark :
* @name :GeoQuestionResLogic.php
* @author :lyh
* @method :post
* @time :2025/7/4 9:47
*/
namespace App\Http\Logic\Bside\Geo;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Geo\GeoQuestionResult;
class GeoQuestionResLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new GeoQuestionResult();
$this->param = $this->requestAll;
}
/**
* @remark :获取类型统计数据
* @name :getCount
* @author :lyh
* @method :post
* @time :2025/7/8 17:16
*/
public function getCount(){
$total = $this->model->counts(['project_id'=>$this->user['project_id']]);
$type_1 = $this->model->counts(['type'=>$this->model::BRAND_TYPE,'project_id'=>$this->user['project_id']]);
$type_2 = $this->model->counts(['type'=>$this->model::MARKETING_TYPE,'project_id'=>$this->user['project_id']]);
return $this->success(['total'=>$total,'type_1'=>$type_1,'type_2'=>$type_2]);
}
/**
* @remark :获取列表页数据
* @name :getResultList
* @author :lyh
* @method :post
* @time :2025/7/4 9:48
*/
public function getResultList($map = [],$page = 1,$row = 20){
$filed = ['id','project_id','question_id','platform','question','en_question','keywords','url','created_at','updated_at'];
$query = $this->model->formatQuery($map);
$query = $query->where(function ($q) {
$q->whereRaw('JSON_LENGTH(keywords) > 0')
->orWhereRaw('JSON_LENGTH(url) > 0');
});
$data = $query->orderByRaw('CHAR_LENGTH(question) ASC')->paginate($row, $filed, 'page', $page);;
return $this->success($data);
}
/**
* @remark :获取数据详情
* @name :getResultInfo
* @author :lyh
* @method :post
* @time :2025/7/4 10:19
*/
public function getResultInfo(){
$data = $this->model->read($this->param);
return $this->success($data);
}
}