...
|
...
|
@@ -255,21 +255,21 @@ class Goods extends Frontend |
|
|
// }
|
|
|
}
|
|
|
$where['g.id'] = ['in',$ids];
|
|
|
}
|
|
|
$data = $goodsModel
|
|
|
->alias('g')
|
|
|
->field([
|
|
|
'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',
|
|
|
"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",
|
|
|
])
|
|
|
->join('sto_goodstype t','t.id = g.goodstype_id')
|
|
|
->join('sto_store s','s.id = g.store_id')
|
|
|
->where($where)
|
|
|
->order($order);
|
|
|
if(!empty($param['paginate'])){
|
|
|
$data = $data->paginate($param['pageNum'],'',['page'=>$param['page']]);
|
|
|
}else{
|
|
|
$data = $data->select();
|
|
|
$data = $goodsModel
|
|
|
->alias('g')
|
|
|
->field([
|
|
|
'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',
|
|
|
])
|
|
|
->join('sto_goodstype t','t.id = g.goodstype_id')
|
|
|
->join('sto_store s','s.id = g.store_id')
|
|
|
->where($where)
|
|
|
->order($order);
|
|
|
if(!empty($param['paginate'])){
|
|
|
$data = $data->paginate($param['pageNum'],'',['page'=>$param['page']]);
|
|
|
}else{
|
|
|
$data = $data->select();
|
|
|
}
|
|
|
}
|
|
|
$user_id = $this->auth->id;
|
|
|
$userModel = new \app\index\model\User();
|
...
|
...
|
|