getTable() . " order by distance asc ) as a where a.distance<=" . ($config['technicaldistance'] * 1000) . " and status=1 "; } else { $sql = "select * from " . (new Tuanzhang)->getTable() . " where status=1 "; } $sql .= " and `weid` = " . weid(); if (trim($keyword)) { $sql .= " and `title` LIKE '%" . $keyword . "%'"; } $data = Db::query($sql); foreach ($data as &$vo) { $vo['touxiang'] = toimg($vo['touxiang']); $vo['distance'] = round(($vo['distance']) / 1000, 1); } $res['data'] = $data; return $this->json(['data' => $res]); } public function detail($id) { $data = Tuanzhang::find($id); if (!empty($data)) { $data = $data->toArray(); } $data['create_time'] = time_ymd($data['create_time']); $data['address'] = $data['region_name'] . $data['house_number']; return $this->json(['data' => $data]); } }