修改店铺街接口

This commit is contained in:
wangxiaowei 2024-10-21 17:16:44 +08:00
parent 8b4dacbc08
commit d54c412c35
2 changed files with 6 additions and 9 deletions

@ -228,9 +228,12 @@ class LocalStoreLogic extends Logic
// 这里的Join只是为了配合with获取指定的字段
$lists = LocalStore::alias('ls')
->with(['street_goods' => function ($query) use ($keyword) {
$query->where('title', 'like', "%{$keyword}%")
->where(['state' => 1, 'audit_status' => 1, 'delete_time' => 0]);
$query->where(['state' => 1, 'audit_status' => 1, 'delete_time' => 0])
->withLimit(10);
}])
->withAttr('street_goods.url', function($v) {
return UrlServer::getFileUrl($v);
})
->join('local_store_goods lsg', 'lsg.lstore_id = ls.lstore_id')
->where(['ls.is_delete' => 0, 'ls.store_state' => 1])
->whereNotNull('ls.shopLogo')
@ -247,11 +250,6 @@ class LocalStoreLogic extends Logic
$lists[$key]['price'] = round($value['price'] * LocalStoreGoodsLogic::$sale, 2);
}
// 获取商品下的商品图片
foreach ($value['street_goods'] as &$v) {
$v['url'] = UrlServer::getFileUrl($v['url']);
}
if ($value['distance'] <= 0) {
$lists[$key]['distance'] = '<500m';
} else {

@ -22,7 +22,6 @@ class LocalStore extends Model
->alias('lsg')
->join('local_store_goods_pic p', 'lsg.id = p.lsg_id')
->field('lsg.id, lsg.lstore_id, lsg.title, lsg.price, p.url')
->order('lsg.id desc')
->limit(10);
->order('lsg.id desc');
}
}