songxingwei %!s(int64=2) %!d(string=hai) anos
pai
achega
a9049d4013

+ 3 - 1
application/api/controller/Index.php

@@ -236,7 +236,9 @@ class Index extends Api
         $list = SiteModel::alias('a')
             ->leftJoin('system_towns b','a.towns_id=b.id')
             ->field('a.id,a.code,a.name,b.name as towns_name')
-            ->with('kd')
+            ->with(['kd'=>function($query) use ($date){
+                $query->group('name')->field('id,site_id,name,value,date');
+            }])
             ->order('a.id asc')
             ->page($Nowpage,$limits)
             ->select();

+ 1 - 1
application/common/model/SiteModel.php

@@ -16,6 +16,6 @@ class SiteModel extends Model{
     }
 
     public function kd(){
-        return $this->hasMany(ValuesModel::class,'site_id')->group('name')->field('id,site_id,name,value,date');
+        return $this->hasMany(ValuesModel::class,'site_id');
     }
 }