From c4e1ee67d392b8520388411552a4e9b2f802c4ac Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 09:49:39 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=95=86=E6=88=B7=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/merchant/MerchantCategoryRepository.php | 4 +++- app/controller/admin/system/merchant/MerchantCategory.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantCategoryRepository.php b/app/common/repositories/system/merchant/MerchantCategoryRepository.php index 02998579..eb47a4d4 100644 --- a/app/common/repositories/system/merchant/MerchantCategoryRepository.php +++ b/app/common/repositories/system/merchant/MerchantCategoryRepository.php @@ -83,7 +83,9 @@ class MerchantCategoryRepository extends BaseRepository $form = Elm::createForm($action, [ Elm::input('category_name', '分类名称')->required(), - Elm::number('commission_rate', '手续费(%)', 0)->required()->max(100)->precision(2) + Elm::number('commission_rate', '手续费(%)', 0)->required()->max(100)->precision(2), + Elm::uploadImage('background', '背景图', 'test')->required(), + Elm::textarea('description', '简介')->required(), ]); return $form->formData($formData)->setTitle(is_null($id) ? '添加商户分类' : '编辑商户分类'); diff --git a/app/controller/admin/system/merchant/MerchantCategory.php b/app/controller/admin/system/merchant/MerchantCategory.php index a66c7e84..43e974e2 100644 --- a/app/controller/admin/system/merchant/MerchantCategory.php +++ b/app/controller/admin/system/merchant/MerchantCategory.php @@ -154,7 +154,7 @@ class MerchantCategory extends BaseController */ public function checkParams(MerchantCategoryValidate $validate) { - $data = $this->request->params(['category_name', ['commission_rate', 0]]); + $data = $this->request->params(['category_name', ['commission_rate', 0], 'background', 'description']); $validate->check($data); return $data; } From dbf8ab42f5bc1752a13ff675eff2b99f248226f7 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 10:38:03 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/merchant/MerchantCategoryRepository.php | 2 +- app/controller/api/Common.php | 2 +- app/controller/api/store/order/StoreCart.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantCategoryRepository.php b/app/common/repositories/system/merchant/MerchantCategoryRepository.php index eb47a4d4..34d596b5 100644 --- a/app/common/repositories/system/merchant/MerchantCategoryRepository.php +++ b/app/common/repositories/system/merchant/MerchantCategoryRepository.php @@ -84,7 +84,7 @@ class MerchantCategoryRepository extends BaseRepository $form = Elm::createForm($action, [ Elm::input('category_name', '分类名称')->required(), Elm::number('commission_rate', '手续费(%)', 0)->required()->max(100)->precision(2), - Elm::uploadImage('background', '背景图', 'test')->required(), + Elm::frameImage('background', '背景图', '/' . config('admin.admin_prefix') . '/setting/uploadPicture?field=background&type=1')->width('896px')->height('480px')->props(['footer' => false])->modal(['modal' => false, 'custom-class' => 'suibian-modal']), Elm::textarea('description', '简介')->required(), ]); diff --git a/app/controller/api/Common.php b/app/controller/api/Common.php index c404164f..f5c88325 100644 --- a/app/controller/api/Common.php +++ b/app/controller/api/Common.php @@ -497,7 +497,7 @@ class Common extends BaseController $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')->select(); + ->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/StoreCart.php b/app/controller/api/store/order/StoreCart.php index 43e6124b..f02441a8 100644 --- a/app/controller/api/store/order/StoreCart.php +++ b/app/controller/api/store/order/StoreCart.php @@ -116,7 +116,7 @@ class StoreCart extends BaseController //更新购物车 $cart_id = $cart['cart_id']; $cart_num = ['cart_num' => ($cart['cart_num'] + $data['cart_num'])]; - if ($entryMerId) { + if ($entryMerId && $entryMerId != $result['product']['mer_id']) { $cart_num['source_id'] = $entryMerId; $cart_num['source'] = StoreCartDao::SOURCE_CLOUD; } @@ -125,7 +125,7 @@ class StoreCart extends BaseController //添加购物车 $data['uid'] = $this->request->uid(); $data['mer_id'] = $result['product']['mer_id']; - if ($entryMerId) { + if ($entryMerId && $entryMerId != $result['product']['mer_id']) { $data['source_id'] = $entryMerId; $data['source'] = StoreCartDao::SOURCE_CLOUD; } From 5be47b6a30ce912d3b4b12043a3c1aac9e31305e Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 11:04:01 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=86=85=E4=BA=91=E5=95=86=E5=93=81=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderCreateRepository.php | 1 + app/controller/api/store/product/StoreSpu.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 278f7847..c55e2fcf 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -1325,6 +1325,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'integral' => $cart['integral'] ? bcdiv($cart['integral']['use'], $cart['cart_num'], 0) : 0, 'integral_total' => $cart['integral'] ? $cart['integral']['use'] : 0, 'product_type' => $cart['product_type'], + 'source_mer_id' => $cart['source'] == StoreCartDao::SOURCE_CLOUD ? $cart['source_id'] : 0, 'cart_info' => json_encode($order_cart) ]; } diff --git a/app/controller/api/store/product/StoreSpu.php b/app/controller/api/store/product/StoreSpu.php index 31ffe100..e0a382e9 100644 --- a/app/controller/api/store/product/StoreSpu.php +++ b/app/controller/api/store/product/StoreSpu.php @@ -90,12 +90,12 @@ class StoreSpu extends BaseController /** * TODO 镇云仓库商户的商品搜索列表 - * @param $id + * @param int $id * @return mixed * @author Qinii * @day 12/24/20 */ - public function cloudMerProductLst($id) + public function cloudMerProductLst(int $id) { [$page, $limit] = $this->getPage(); $where = $this->request->params([ @@ -103,10 +103,18 @@ class StoreSpu extends BaseController ]); if ($where['action']) unset($where['product_type']); $category_id=Db::name('merchant')->where('mer_id',$id)->value('category_id'); - $mer_id=Db::name('merchant')->where('mer_state',1)->where('status',1)->where('category_id',$category_id)->where('type_id',Merchant::TypeCloudWarehouse)->value('mer_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) + ->where('mer_state',1) + ->where('m.status',1) + ->where('category_id',$category_id) + ->where('type_id',Merchant::TypeCloudWarehouse) + ->value('m.mer_id'); if (!$mer_id){ return app('json')->success(['count'=>0,'list'=>[]]); - } $where['mer_id'] = $mer_id; $where['entry_mer_id'] = $id; From cae80dfa690d2d390745cc4c07d5d60232177f8f Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 11:07:24 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=91=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=B8=8B=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/order/StoreOrderCreateRepository.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index c55e2fcf..a943f81d 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -1325,7 +1325,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'integral' => $cart['integral'] ? bcdiv($cart['integral']['use'], $cart['cart_num'], 0) : 0, 'integral_total' => $cart['integral'] ? $cart['integral']['use'] : 0, 'product_type' => $cart['product_type'], - 'source_mer_id' => $cart['source'] == StoreCartDao::SOURCE_CLOUD ? $cart['source_id'] : 0, + 'source' => $cart['source'], + 'source_id' => $cart['source_id'], 'cart_info' => json_encode($order_cart) ]; } 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 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E6=88=B7?= =?UTF-8?q?=E5=9C=B0=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; From 3d0804037b4107d9b6e5d8c948c9d78b1b97b305 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 13:56:18 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/merchant/MerchantRepository.php | 11 +++++------ app/controller/admin/system/merchant/Merchant.php | 9 --------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index eb531ce3..8ff28c91 100644 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -221,8 +221,11 @@ class MerchantRepository extends BaseRepository if($data['type_id'] == 0){ $data['type_id'] = ''; } - $find=Db::name('merchant_address')->where('mer_id',$id)->find(); - $data['geo_address']=$find; + $data['geo_address'] = [ + 'area_id' => $data['area_id'], + 'street_id' => $data['street_id'], + 'village_id' => $data['village_id'], + ]; return $data; // return $this->form($id, $data); } @@ -260,10 +263,6 @@ class MerchantRepository extends BaseRepository $merchant = $this->dao->create($data); $merchant['merchant_admin']=$make->createMerchantAccount($merchant, $account, $password); - $address_id = Db::name('merchant_address')->insertGetId(['mer_id'=>$merchant->mer_id,'street_id'=>$data['street_id'],'area_id'=>$data['area_id'],'village_id'=>$data['village_id']]); - if($data['area_id'] && $data['village_id']){ - Db::name('merchant_address')->where('id',$address_id)->update(['area_id'=>$data['area_id'],'village_id'=>$data['village_id']]); - } app()->make(ShippingTemplateRepository::class)->createDefault($merchant->mer_id); app()->make(ProductCopyRepository::class)->defaulCopyNum($merchant->mer_id); return $merchant; diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index 7945288a..f3107058 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -148,16 +148,7 @@ class Merchant extends BaseController $data['margin'] = $margin['margin']; $data['is_margin'] = $margin['is_margin']; $datas=$data; - unset($datas['area_id'],$datas['street_id'],$datas['village_id']); $this->repository->update($id, $datas); - $adds=Db::name('merchant_address')->where('mer_id',$id)->find(); - if($adds){ - $adds1=['area_id'=>$data['area_id'],'street_id'=>$data['street_id'],'village_id'=>$data['village_id']]; - Db::name('merchant_address')->where('mer_id',$id)->update($adds1); - }else{ - $adds1=['mer_id'=>$id,'area_id'=>$data['area_id'],'street_id'=>$data['street_id'],'village_id'=>$data['village_id']]; - Db::name('merchant_address')->insert($adds1); - } return app('json')->success('编辑成功'); } From eb20646f5da32276c8775b0977cef50f6acfe7a5 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 25 May 2023 14:26:13 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E5=AF=BC=E5=85=A5=E9=95=87=E8=A1=97=E4=BA=91?= =?UTF-8?q?=E4=BB=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/store/product/ProductRepository.php | 4 ++-- app/listener/ProductCreate.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index f8f28b8c..3db07cb4 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -241,8 +241,8 @@ class ProductRepository extends BaseRepository $product['mer_labels'] = $data['mer_labels']; app()->make(SpuRepository::class)->create($product, $result->product_id, $activity_id, $productType); } -// $product = $result; -// event('product.create',compact('product')); + $product = $result; + event('product.create',compact('product')); return $result->product_id; }); } diff --git a/app/listener/ProductCreate.php b/app/listener/ProductCreate.php index e9229199..b6be7f27 100644 --- a/app/listener/ProductCreate.php +++ b/app/listener/ProductCreate.php @@ -40,7 +40,8 @@ class ProductCreate } } //镇街云仓 - $is_product=0; + //不再导入镇街云仓 + /*$is_product=0; if ($merchant['type_id']==10){ $townMerchantId = Db::name('merchant')->where('status',1)->where('mer_state',1)->where('category_id',$merchant['category_id'])->where('type_id',11)->value('mer_id'); if ($townMerchantId){ @@ -60,7 +61,7 @@ class ProductCreate } } - } + }*/ } public function CloudMerchanSpu($data,$event){