afa 6 сар өмнө
parent
commit
b696f30da7

+ 2 - 1
application/api/controller/Teac.php

@@ -28,7 +28,8 @@ class Teac extends Api
         $type_id = $this->request->post('type_id/d', 0);
         if(!in_array($type_id, [ProductTeac::Buying, ProductTeac::Sell])) $this->error('类型错误');
            
-        $list = $productTeac->where('status', ProductTeac::Normal)->where('type_id', $type_id)
+        $list = $productTeac->with('users')
+             ->where('status', ProductTeac::Normal)->where('type_id', $type_id)
              ->order('create_time desc')
              ->paginate($this->pageSize);
         

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

@@ -66,7 +66,7 @@ class ProductTeac extends Model
     //用户 user_id
     public function users()
     {
-        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+        return $this->hasOne('UserModel', 'id', 'user_id', [], 'LEFT')->field('id,address,nickname,avatar')->setEagerlyType(0);
     }