作者 王晓刚
1 个管道 的构建 通过 耗费 40 秒

商品搜索

@@ -255,21 +255,21 @@ class Goods extends Frontend @@ -255,21 +255,21 @@ class Goods extends Frontend
255 // } 255 // }
256 } 256 }
257 $where['g.id'] = ['in',$ids]; 257 $where['g.id'] = ['in',$ids];
258 - }  
259 - $data = $goodsModel  
260 - ->alias('g')  
261 - ->field([  
262 - 'g.*,t.name as goodstype_name,s.lng,s.lat,s.name as store_name,s.phone as store_phone,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money',  
263 - "round((6378.138 * 2 * asin(sqrt(pow(sin((s.lat * pi() / 180 - ".$param['lat']." * pi() / 180) / 2),2) + cos(s.lat * pi() / 180) * cos(".$param['lat']." * pi() / 180) * pow(sin((s.lng * pi() / 180 - ".$param['lng']." * pi() / 180) / 2),2)))),2) as distance",  
264 - ])  
265 - ->join('sto_goodstype t','t.id = g.goodstype_id')  
266 - ->join('sto_store s','s.id = g.store_id')  
267 - ->where($where)  
268 - ->order($order);  
269 - if(!empty($param['paginate'])){  
270 - $data = $data->paginate($param['pageNum'],'',['page'=>$param['page']]);  
271 }else{ 258 }else{
272 - $data = $data->select(); 259 + $data = $goodsModel
  260 + ->alias('g')
  261 + ->field([
  262 + 'g.*,t.name as goodstype_name,s.lng,s.lat,s.name as store_name,s.phone as store_phone,s.address as store_address,s.property,s.type,s.content as store_content,s.thumbnail as store_thumbnail,s.money as store_money',
  263 + ])
  264 + ->join('sto_goodstype t','t.id = g.goodstype_id')
  265 + ->join('sto_store s','s.id = g.store_id')
  266 + ->where($where)
  267 + ->order($order);
  268 + if(!empty($param['paginate'])){
  269 + $data = $data->paginate($param['pageNum'],'',['page'=>$param['page']]);
  270 + }else{
  271 + $data = $data->select();
  272 + }
273 } 273 }
274 $user_id = $this->auth->id; 274 $user_id = $this->auth->id;
275 $userModel = new \app\index\model\User(); 275 $userModel = new \app\index\model\User();