调整店铺列表字段

This commit is contained in:
luofei 2023-06-09 15:51:28 +08:00
parent 479c7fc6a3
commit 51b2a34a5c

View File

@ -23,6 +23,7 @@ use app\common\model\system\merchant\Merchant;
use app\common\repositories\BaseRepository;
use app\common\repositories\store\coupon\StoreCouponRepository;
use app\common\repositories\store\coupon\StoreCouponUserRepository;
use app\common\repositories\store\MerchantTakeRepository;
use app\common\repositories\store\order\StoreOrderRepository;
use app\common\repositories\store\product\ProductCopyRepository;
use app\common\repositories\store\product\ProductRepository;
@ -288,7 +289,7 @@ class MerchantRepository extends BaseRepository
*/
public function getList($where, $page, $limit, $userInfo)
{
$field = 'care_count,is_trader,type_id,mer_id,mer_banner,mini_banner,mer_name, mark,mer_avatar,product_score,service_score,postage_score,sales,status,is_best,create_time,long,lat,is_margin';
$field = 'care_count,is_trader,type_id,mer_id,mer_banner,mini_banner,mer_name, mark,mer_avatar,product_score,service_score,postage_score,sales,status,is_best,create_time,long,lat,is_margin,service_phone,mer_address,mer_info';
$where['status'] = 1;
$where['mer_state'] = 1;
$where['is_del'] = 0;
@ -310,8 +311,10 @@ class MerchantRepository extends BaseRepository
$query = $this->dao->search($where)->with(['type_name']);
$count = $query->count();
$status = systemConfig('mer_location');
/** @var MerchantTakeRepository $repository */
$repository = app()->make(MerchantTakeRepository::class);
$list = $query->page($page, $limit)->setOption('field', [])->field($field)->select()
->each(function ($item) use ($status, $where) {
->each(function ($item) use ($status, $where, $repository) {
if ($status && $item['lat'] && $item['long'] && isset($where['location']['lat'], $where['location']['long'])) {
$distance = getDistance($where['location']['lat'], $where['location']['long'], $item['lat'], $item['long']);
if ($distance < 0.9) {
@ -324,6 +327,12 @@ class MerchantRepository extends BaseRepository
}
$item['distance'] = $distance;
}
$delivery = $repository->get($item['mer_id']) + systemConfig(['tx_map_key']);
$item['mer_certificate'] = merchantConfig($item['mer_id'], 'mer_certificate');
if (empty($item['mer_certificate'][0])) {
$item['mer_certificate'] = [];
}
$item['mer_take_time'] = $delivery['mer_take_time'];
// if(isset($where['type_id'])&& $where['type_id']==12){
// $item['recommend'] = $item['AllRecommendType'];
// }else{