Commit a60c7250 authored by clone's avatar clone

判空处理

parent 4280e440
...@@ -110,9 +110,13 @@ class AttentionModel extends Model ...@@ -110,9 +110,13 @@ class AttentionModel extends Model
*/ */
public function getAttentionByUserIdAndHouseId($params) public function getAttentionByUserIdAndHouseId($params)
{ {
return $this->field("id") $result = $this->field("id")
->where($params) ->where($params)
->limit(1) ->limit(1)
->select()[0]; ->select();
if (count($result) > 0) {
return $result[0];
}
return null;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment