From 461be6d91548ab11b3c626885c5317558a52e27f Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 13:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E6=88=B7=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/system/merchant/MerchantDao.php | 3 +-- app/controller/api/Common.php | 14 +++++++++----- .../api/store/order/StoreMicropayOrder.php | 10 +++------- app/controller/api/store/product/StoreSpu.php | 17 +++++++---------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/app/common/dao/system/merchant/MerchantDao.php b/app/common/dao/system/merchant/MerchantDao.php index ae6db49c..bb364a5e 100644 --- a/app/common/dao/system/merchant/MerchantDao.php +++ b/app/common/dao/system/merchant/MerchantDao.php @@ -53,8 +53,7 @@ class MerchantDao extends BaseDao $query->where('is_trader', $where['is_trader']); }) ->when(isset($where['street_id']) && $where['street_id'] !== '', function ($query) use ($where) { - $mer_id = Db::name('merchant_address')->where('street_id', $where['street_id'])->column('mer_id'); - $query->whereIn('mer_id',$mer_id ?: '' ); + $query->where('street_id', $where['street_id']); }) ->when(isset($where['is_best']) && $where['is_best'] !== '', function ($query) use ($where) { $query->where('is_best', $where['is_best']); diff --git a/app/controller/api/Common.php b/app/controller/api/Common.php index f5c88325..ed1c0635 100644 --- a/app/controller/api/Common.php +++ b/app/controller/api/Common.php @@ -493,11 +493,15 @@ class Common extends BaseController } //获取云店铺 - public function get_cloud_shop($street_code){ - $find=DB::name('merchant')->alias('m')->where('m.type_id',11)->where('m.is_del',0)->where('m.status',1) - ->join('merchant_address a','a.mer_id=m.mer_id and a.street_id='.$street_code) - ->join('merchant_category c','m.category_id=c.merchant_category_id') - ->field('m.mer_id,category_id,category_name,c.background,c.description')->select(); + public function get_cloud_shop(int $street_code){ + $find=DB::name('merchant') + ->alias('m') + ->where('m.type_id',11) + ->where('m.is_del',0) + ->where('m.status',1) + ->where('m.street_id',$street_code) + ->join('merchant_category c','m.category_id=c.merchant_category_id') + ->field('m.mer_id,category_id,category_name,c.background,c.description')->select(); return app('json')->success($find??[]); } } diff --git a/app/controller/api/store/order/StoreMicropayOrder.php b/app/controller/api/store/order/StoreMicropayOrder.php index 5521995f..b12d65fc 100644 --- a/app/controller/api/store/order/StoreMicropayOrder.php +++ b/app/controller/api/store/order/StoreMicropayOrder.php @@ -113,15 +113,11 @@ class StoreMicropayOrder extends BaseController $addressId=Db::name('user_address')->where('uid',$uid)->find(); $merchant=Db::name('merchant')->where('mer_id',$mer_id)->find(); if (!$addressId){ - $merchant_address=Db::name('merchant_address')->where('mer_id',$mer_id)->find(); - if (!$merchant_address){ - return app('json')->fail('商户地址不存在'); - } - if ($merchant_address['area_id']==0||$merchant_address['street_id']==0||$merchant_address['village_id']==0){ + if ($merchant['area_id']==0||$merchant['street_id']==0||$merchant['village_id']==0){ return app('json')->fail('商户地址不完整'); } - $area_name=Db::name('geo_area')->where('area_code',$merchant_address['area_id'])->value('area_name'); - $street_name=Db::name('geo_street')->where('street_code',$merchant_address['street_id'])->value('street_name'); + $area_name=Db::name('geo_area')->where('area_code',$merchant['area_id'])->value('area_name'); + $street_name=Db::name('geo_street')->where('street_code',$merchant['street_id'])->value('street_name'); $district_id=Db::name('city_area')->where('name',$area_name)->value('id'); $street_id=Db::name('city_area')->where('name',$street_name)->value('id'); $data=[ diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index e0a382e9..e404246f 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -102,18 +102,15 @@ class StoreSpu extends BaseController 'keyword', 'cate_id', 'order', 'price_on', 'price_off', 'brand_id', 'pid', 'mer_cate_id', ['product_type', 0], 'action', 'common' ]); if ($where['action']) unset($where['product_type']); - $category_id=Db::name('merchant')->where('mer_id',$id)->value('category_id'); - $streetId = Db::name('merchant_address')->where('mer_id', $id)->value('street_id'); - $mer_id=Db::name('merchant') - ->alias('m') - ->leftJoin('merchant_address ma', 'm.mer_id=ma.mer_id') - ->where('street_id',$streetId) + $currentMerchant = Db::name('merchant')->where('mer_id',$id)->field('category_id,street_id')->find(); + $mer_id = Db::name('merchant') + ->where('street_id',$currentMerchant['street_id']) ->where('mer_state',1) - ->where('m.status',1) - ->where('category_id',$category_id) + ->where('status',1) + ->where('category_id',$currentMerchant['category_id']) ->where('type_id',Merchant::TypeCloudWarehouse) - ->value('m.mer_id'); - if (!$mer_id){ + ->value('mer_id'); + if (!$mer_id) { return app('json')->success(['count'=>0,'list'=>[]]); } $where['mer_id'] = $mer_id;