作者 zhl

修改排序和显示结果

@@ -44,12 +44,13 @@ class GeoQuestionResLogic extends BaseLogic @@ -44,12 +44,13 @@ class GeoQuestionResLogic extends BaseLogic
44 public function getResultList($map = [],$page = 1,$row = 20,$order = 'id'){ 44 public function getResultList($map = [],$page = 1,$row = 20,$order = 'id'){
45 $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at']; 45 $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at'];
46 $result = GeoQuestionResult::select($filed) 46 $result = GeoQuestionResult::select($filed)
  47 + ->where(['project_id' => $map['project_id']])
47 ->where(function($query) { 48 ->where(function($query) {
48 $query->where('keywords', '!=', '[]') 49 $query->where('keywords', '!=', '[]')
49 ->orWhere('url', '!=', '[]'); 50 ->orWhere('url', '!=', '[]');
50 }) 51 })
51 ->orderByRaw('LENGTH(question) ASC') 52 ->orderByRaw('LENGTH(question) ASC')
52 - ->get(); 53 + ->paginate($row, $filed, 'page', $page);
53 $data = empty($result) ? [] : $result->toArray(); 54 $data = empty($result) ? [] : $result->toArray();
54 55
55 // $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at']; 56 // $filed = ['id','project_id','question_id','platform','question','keywords','url','created_at','updated_at'];