From 88e574961835b68cb8a394e2b86e3e51cb2885f5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 20 Feb 2024 18:11:01 +0800 Subject: [PATCH] =?UTF-8?q?supply=20=E5=95=86=E6=88=B7=E7=AB=AFapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../middleware/AllowOriginMiddleware.php | 7 ++- .../store/SupplyTakeRepository.php | 38 ++++++++++++++++ app/controller/admin/system/auth/Menu.php | 24 ++++++++++ app/controller/supply/Common.php | 4 +- app/controller/supply/store/Excel.php | 2 +- .../supply/store/StoreAttrTemplate.php | 2 +- app/controller/supply/store/StoreImport.php | 2 +- app/controller/supply/store/StorePrinter.php | 2 +- .../supply/store/StoreProductReply.php | 2 +- .../store/broadcast/BroadcastAssistant.php | 2 +- .../supply/store/broadcast/BroadcastGoods.php | 2 +- .../supply/store/broadcast/BroadcastRoom.php | 2 +- app/controller/supply/store/coupon/Coupon.php | 2 +- .../supply/store/coupon/CouponSend.php | 2 +- .../supply/store/delivery/DeliveryOrder.php | 2 +- .../supply/store/delivery/DeliveryStation.php | 2 +- .../store/guarantee/GuaranteeTemplate.php | 2 +- app/controller/supply/store/order/Order.php | 2 +- .../supply/store/order/OrderReceipt.php | 2 +- .../supply/store/order/Reconciliation.php | 2 +- .../supply/store/order/RefundOrder.php | 2 +- .../supply/store/product/Discounts.php | 2 +- .../supply/store/product/Product.php | 2 +- .../supply/store/product/ProductAssist.php | 2 +- .../supply/store/product/ProductAssistSet.php | 2 +- .../supply/store/product/ProductCopy.php | 2 +- .../supply/store/product/ProductGroup.php | 2 +- .../store/product/ProductGroupBuying.php | 2 +- .../supply/store/product/ProductLabel.php | 2 +- .../supply/store/product/ProductPresell.php | 2 +- .../supply/store/product/ProductSeckill.php | 2 +- .../supply/store/product/ProductUnit.php | 2 +- .../supply/store/service/StoreService.php | 2 +- .../store/service/StoreServiceReply.php | 2 +- app/controller/supply/store/shipping/City.php | 2 +- .../store/shipping/ShippingTemplate.php | 2 +- .../store/shipping/ShippingTemplateFree.php | 2 +- .../store/shipping/ShippingTemplateRegion.php | 2 +- .../shipping/ShippingTemplateUndelive.php | 2 +- .../system/{Merchant.php => Supply.php} | 38 ++++++++-------- ...antApplyments.php => SupplyApplyments.php} | 14 +++--- app/controller/supply/system/admin/Login.php | 2 +- .../supply/system/admin/SupplyAdmin.php | 2 +- app/controller/supply/system/auth/Role.php | 2 +- app/controller/supply/system/diy/Diy.php | 2 +- .../supply/system/financial/Financial.php | 2 +- .../supply/system/notice/SystemNoticeLog.php | 2 +- .../supply/system/openapi/OpenApi.php | 2 +- app/controller/supply/system/serve/Config.php | 2 +- app/controller/supply/system/serve/Serve.php | 2 +- config/admin.php | 2 + route/supply.php | 44 +++++++++++++++++++ 52 files changed, 185 insertions(+), 74 deletions(-) create mode 100644 app/common/repositories/store/SupplyTakeRepository.php rename app/controller/supply/system/{Merchant.php => Supply.php} (87%) rename app/controller/supply/system/{MerchantApplyments.php => SupplyApplyments.php} (92%) create mode 100644 route/supply.php diff --git a/app/common/middleware/AllowOriginMiddleware.php b/app/common/middleware/AllowOriginMiddleware.php index 3ec6b8e8..3048141b 100644 --- a/app/common/middleware/AllowOriginMiddleware.php +++ b/app/common/middleware/AllowOriginMiddleware.php @@ -34,9 +34,11 @@ class AllowOriginMiddleware extends BaseMiddleware 'Access-Control-Allow-Origin' => '*', 'Access-Control-Allow-Headers' => 'X-Token, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With,Form-type,Referer,Connection,Content-Length,Host,Origin,Authorization,Authori-zation,Accept,Accept-Encoding,uuid', //,Host,Origin,Authorization,Authori-zation,Accept,Accept-Encoding - //'Access-Control-Allow-Headers' => '*', + // 'Access-Control-Allow-Headers' => '*', 'Access-Control-Allow-Methods' => 'GET,POST,PATCH,PUT,DELETE,OPTIONS', - 'Access-Control-Max-Age' => '1728000' + 'Access-Control-Max-Age' => '1728000', + 'Access-Control-Allow-Credentials' => 'true', + ]; public function before(Request $request) @@ -53,6 +55,7 @@ class AllowOriginMiddleware extends BaseMiddleware public function after(Response $response) { + $response->header($this->header); } } diff --git a/app/common/repositories/store/SupplyTakeRepository.php b/app/common/repositories/store/SupplyTakeRepository.php new file mode 100644 index 00000000..719d6424 --- /dev/null +++ b/app/common/repositories/store/SupplyTakeRepository.php @@ -0,0 +1,38 @@ + +// +---------------------------------------------------------------------- + + +namespace app\common\repositories\store; + + +use app\common\repositories\system\config\ConfigValueRepository; + +class SupplyTakeRepository +{ + public function get($merId) + { + return merchantConfig($merId, [ + 'mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time' + ]); + } + + public function set($merId, array $data) + { + $configValueRepository = app()->make(ConfigValueRepository::class); + $configValueRepository->setFormData($data, $merId); + } + + public function has($merId) + { + return merchantConfig($merId, 'mer_take_status') == '1'; + } +} diff --git a/app/controller/admin/system/auth/Menu.php b/app/controller/admin/system/auth/Menu.php index 56526001..4df375fe 100644 --- a/app/controller/admin/system/auth/Menu.php +++ b/app/controller/admin/system/auth/Menu.php @@ -208,4 +208,28 @@ class Menu extends BaseController return 0 == $v['pid']; }))); } + + /**供应 + * @return mixed + * @author xaboy + * @day 2020-04-10 + */ + public function supplyMenus() + { + $pre = '/' . config('admin.merchant_prefix'); + $merchant = $this->request->merchant(); + if ($this->request->adminInfo()->level) { + $menus = $this->repository->ruleByMenuList($this->request->adminRule(), $this->merchant); + } else { + $menus = $merchant->type_id ? $this->repository->typesByValidMenuList($merchant->type_id) : $this->repository->getValidMenuList($this->merchant); + } + foreach ($menus as $k => $menu) { + + $menu['path'] = $pre . $menu['path']; + $menus[$k] = $menu; + } + return app('json')->success(array_values(array_filter(formatCategory($menus, 'id'), function ($v) { + return 0 == $v['pid']; + }))); + } } diff --git a/app/controller/supply/Common.php b/app/controller/supply/Common.php index 2e7c534c..311fc627 100644 --- a/app/controller/supply/Common.php +++ b/app/controller/supply/Common.php @@ -279,12 +279,12 @@ class Common extends BaseController return app('json')->success($data); } - public function getMerchantCount() + public function getSupplyCount() { return app('json')->success(app()->make(CountRepository::class)->getMerchantCount($this->request->merId())); } - public function getMerchantTodo() + public function getSupplyTodo() { return app('json')->success(app()->make(CountRepository::class)->getMerchantTodo($this->request->merId())); } diff --git a/app/controller/supply/store/Excel.php b/app/controller/supply/store/Excel.php index d4c93ca8..9ed9121b 100644 --- a/app/controller/supply/store/Excel.php +++ b/app/controller/supply/store/Excel.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store; +namespace app\controller\supply\store; use app\common\repositories\store\ExcelRepository; use crmeb\exceptions\UploadException; diff --git a/app/controller/supply/store/StoreAttrTemplate.php b/app/controller/supply/store/StoreAttrTemplate.php index 45b7b437..77aadd0c 100644 --- a/app/controller/supply/store/StoreAttrTemplate.php +++ b/app/controller/supply/store/StoreAttrTemplate.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store; +namespace app\controller\supply\store; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/StoreImport.php b/app/controller/supply/store/StoreImport.php index 9b4e3a7e..1242fa55 100644 --- a/app/controller/supply/store/StoreImport.php +++ b/app/controller/supply/store/StoreImport.php @@ -9,7 +9,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store; +namespace app\controller\supply\store; use app\common\repositories\store\order\StoreImportDeliveryRepository; use crmeb\jobs\ImportSpreadsheetExcelJob; diff --git a/app/controller/supply/store/StorePrinter.php b/app/controller/supply/store/StorePrinter.php index aa7757ed..d255664a 100644 --- a/app/controller/supply/store/StorePrinter.php +++ b/app/controller/supply/store/StorePrinter.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store; +namespace app\controller\supply\store; use app\common\repositories\store\StorePrinterRepository; use think\App; diff --git a/app/controller/supply/store/StoreProductReply.php b/app/controller/supply/store/StoreProductReply.php index be1ad64f..7ff389b8 100644 --- a/app/controller/supply/store/StoreProductReply.php +++ b/app/controller/supply/store/StoreProductReply.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store; +namespace app\controller\supply\store; use app\common\repositories\store\product\ProductReplyRepository; diff --git a/app/controller/supply/store/broadcast/BroadcastAssistant.php b/app/controller/supply/store/broadcast/BroadcastAssistant.php index 68cd619a..bbb1686f 100644 --- a/app/controller/supply/store/broadcast/BroadcastAssistant.php +++ b/app/controller/supply/store/broadcast/BroadcastAssistant.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\broadcast; +namespace app\controller\supply\store\broadcast; use app\common\repositories\store\broadcast\BroadcastAssistantRepository; diff --git a/app/controller/supply/store/broadcast/BroadcastGoods.php b/app/controller/supply/store/broadcast/BroadcastGoods.php index 0096d44a..f9fea831 100644 --- a/app/controller/supply/store/broadcast/BroadcastGoods.php +++ b/app/controller/supply/store/broadcast/BroadcastGoods.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\broadcast; +namespace app\controller\supply\store\broadcast; use app\common\repositories\store\broadcast\BroadcastGoodsRepository; diff --git a/app/controller/supply/store/broadcast/BroadcastRoom.php b/app/controller/supply/store/broadcast/BroadcastRoom.php index 634fff2d..5f0509bc 100644 --- a/app/controller/supply/store/broadcast/BroadcastRoom.php +++ b/app/controller/supply/store/broadcast/BroadcastRoom.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\broadcast; +namespace app\controller\supply\store\broadcast; use app\common\repositories\store\broadcast\BroadcastAssistantRepository; diff --git a/app/controller/supply/store/coupon/Coupon.php b/app/controller/supply/store/coupon/Coupon.php index 5d99f60e..c9251a10 100644 --- a/app/controller/supply/store/coupon/Coupon.php +++ b/app/controller/supply/store/coupon/Coupon.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\coupon; +namespace app\controller\supply\store\coupon; use app\common\repositories\store\coupon\StoreCouponSendRepository; diff --git a/app/controller/supply/store/coupon/CouponSend.php b/app/controller/supply/store/coupon/CouponSend.php index 96ad9d7d..f3db20ff 100644 --- a/app/controller/supply/store/coupon/CouponSend.php +++ b/app/controller/supply/store/coupon/CouponSend.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\coupon; +namespace app\controller\supply\store\coupon; use app\common\repositories\store\coupon\StoreCouponSendRepository; diff --git a/app/controller/supply/store/delivery/DeliveryOrder.php b/app/controller/supply/store/delivery/DeliveryOrder.php index a96c80cc..d2a9884f 100644 --- a/app/controller/supply/store/delivery/DeliveryOrder.php +++ b/app/controller/supply/store/delivery/DeliveryOrder.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\delivery; +namespace app\controller\supply\store\delivery; use app\common\repositories\delivery\DeliveryOrderRepository; use think\App; diff --git a/app/controller/supply/store/delivery/DeliveryStation.php b/app/controller/supply/store/delivery/DeliveryStation.php index 1c7f3e64..976a6847 100644 --- a/app/controller/supply/store/delivery/DeliveryStation.php +++ b/app/controller/supply/store/delivery/DeliveryStation.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\delivery; +namespace app\controller\supply\store\delivery; use app\common\repositories\system\serve\ServeOrderRepository; use crmeb\services\DeliverySevices; diff --git a/app/controller/supply/store/guarantee/GuaranteeTemplate.php b/app/controller/supply/store/guarantee/GuaranteeTemplate.php index a58b8163..c33af673 100644 --- a/app/controller/supply/store/guarantee/GuaranteeTemplate.php +++ b/app/controller/supply/store/guarantee/GuaranteeTemplate.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\guarantee; +namespace app\controller\supply\store\guarantee; use app\common\repositories\store\GuaranteeRepository; use app\common\repositories\store\GuaranteeTemplateRepository; diff --git a/app/controller/supply/store/order/Order.php b/app/controller/supply/store/order/Order.php index 2cd0780d..1bda9a30 100644 --- a/app/controller/supply/store/order/Order.php +++ b/app/controller/supply/store/order/Order.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\order; +namespace app\controller\supply\store\order; use app\common\repositories\store\order\SupplyReconciliationRepository; use app\common\repositories\store\order\StoreOrderRepository; diff --git a/app/controller/supply/store/order/OrderReceipt.php b/app/controller/supply/store/order/OrderReceipt.php index 589cfa45..eb13084b 100644 --- a/app/controller/supply/store/order/OrderReceipt.php +++ b/app/controller/supply/store/order/OrderReceipt.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\order; +namespace app\controller\supply\store\order; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/order/Reconciliation.php b/app/controller/supply/store/order/Reconciliation.php index fe735f40..414f2e5b 100644 --- a/app/controller/supply/store/order/Reconciliation.php +++ b/app/controller/supply/store/order/Reconciliation.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\order; +namespace app\controller\supply\store\order; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/order/RefundOrder.php b/app/controller/supply/store/order/RefundOrder.php index f911c631..c04b2974 100644 --- a/app/controller/supply/store/order/RefundOrder.php +++ b/app/controller/supply/store/order/RefundOrder.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\order; +namespace app\controller\supply\store\order; use app\common\repositories\store\order\SupplyReconciliationRepository; use app\common\repositories\store\order\StoreOrderProductRepository; diff --git a/app/controller/supply/store/product/Discounts.php b/app/controller/supply/store/product/Discounts.php index 76f470fa..3ab82d21 100644 --- a/app/controller/supply/store/product/Discounts.php +++ b/app/controller/supply/store/product/Discounts.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\StoreDiscountRepository; use app\validate\supply\StoreDiscountsValidate; diff --git a/app/controller/supply/store/product/Product.php b/app/controller/supply/store/product/Product.php index bae38941..c312fdf8 100644 --- a/app/controller/supply/store/product/Product.php +++ b/app/controller/supply/store/product/Product.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\order\StoreCartRepository; use app\common\repositories\store\product\ProductAttrValueRepository; diff --git a/app/controller/supply/store/product/ProductAssist.php b/app/controller/supply/store/product/ProductAssist.php index 9b4cd0ab..efb46f9f 100644 --- a/app/controller/supply/store/product/ProductAssist.php +++ b/app/controller/supply/store/product/ProductAssist.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductAssistRepository as repository; use app\common\repositories\store\product\ProductRepository; diff --git a/app/controller/supply/store/product/ProductAssistSet.php b/app/controller/supply/store/product/ProductAssistSet.php index 5c472dec..acef51bd 100644 --- a/app/controller/supply/store/product/ProductAssistSet.php +++ b/app/controller/supply/store/product/ProductAssistSet.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductAssistSetRepository as repository; use app\common\repositories\store\product\ProductAssistUserRepository; diff --git a/app/controller/supply/store/product/ProductCopy.php b/app/controller/supply/store/product/ProductCopy.php index 0fb05219..f8f935de 100644 --- a/app/controller/supply/store/product/ProductCopy.php +++ b/app/controller/supply/store/product/ProductCopy.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\system\supply\SupplyRepository; use think\App; diff --git a/app/controller/supply/store/product/ProductGroup.php b/app/controller/supply/store/product/ProductGroup.php index 8fc27652..20142d9d 100644 --- a/app/controller/supply/store/product/ProductGroup.php +++ b/app/controller/supply/store/product/ProductGroup.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\product\SpuRepository; diff --git a/app/controller/supply/store/product/ProductGroupBuying.php b/app/controller/supply/store/product/ProductGroupBuying.php index 22d30602..3a4287dd 100644 --- a/app/controller/supply/store/product/ProductGroupBuying.php +++ b/app/controller/supply/store/product/ProductGroupBuying.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductGroupUserRepository; use think\App; diff --git a/app/controller/supply/store/product/ProductLabel.php b/app/controller/supply/store/product/ProductLabel.php index 4341e6a1..728937d9 100644 --- a/app/controller/supply/store/product/ProductLabel.php +++ b/app/controller/supply/store/product/ProductLabel.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductLabelRepository; use app\validate\admin\ProductLabelValidate; diff --git a/app/controller/supply/store/product/ProductPresell.php b/app/controller/supply/store/product/ProductPresell.php index 6282794a..808b0849 100644 --- a/app/controller/supply/store/product/ProductPresell.php +++ b/app/controller/supply/store/product/ProductPresell.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductPresellRepository as repository; use app\common\repositories\store\product\ProductRepository; diff --git a/app/controller/supply/store/product/ProductSeckill.php b/app/controller/supply/store/product/ProductSeckill.php index 3722642c..ec8191b6 100644 --- a/app/controller/supply/store/product/ProductSeckill.php +++ b/app/controller/supply/store/product/ProductSeckill.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\product; +namespace app\controller\supply\store\product; use app\common\repositories\store\product\ProductLabelRepository; use app\common\repositories\store\product\SpuRepository; diff --git a/app/controller/supply/store/product/ProductUnit.php b/app/controller/supply/store/product/ProductUnit.php index 4b65c17a..286d8e2c 100644 --- a/app/controller/supply/store/product/ProductUnit.php +++ b/app/controller/supply/store/product/ProductUnit.php @@ -1,6 +1,6 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\store\service; +namespace app\controller\supply\store\service; use app\common\repositories\store\service\StoreServiceReplyRepository; use app\validate\supply\ServiceReplyValidate; diff --git a/app/controller/supply/store/shipping/City.php b/app/controller/supply/store/shipping/City.php index 9f8cfbc1..66e22aba 100644 --- a/app/controller/supply/store/shipping/City.php +++ b/app/controller/supply/store/shipping/City.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\shipping; +namespace app\controller\supply\store\shipping; use app\common\repositories\store\CityAreaRepository; use Overtrue\Pinyin\Pinyin; diff --git a/app/controller/supply/store/shipping/ShippingTemplate.php b/app/controller/supply/store/shipping/ShippingTemplate.php index e6a86330..a1685a94 100644 --- a/app/controller/supply/store/shipping/ShippingTemplate.php +++ b/app/controller/supply/store/shipping/ShippingTemplate.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\shipping; +namespace app\controller\supply\store\shipping; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/shipping/ShippingTemplateFree.php b/app/controller/supply/store/shipping/ShippingTemplateFree.php index 66b32515..faadda05 100644 --- a/app/controller/supply/store/shipping/ShippingTemplateFree.php +++ b/app/controller/supply/store/shipping/ShippingTemplateFree.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\shipping; +namespace app\controller\supply\store\shipping; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/shipping/ShippingTemplateRegion.php b/app/controller/supply/store/shipping/ShippingTemplateRegion.php index 7dc1b0fa..360d1988 100644 --- a/app/controller/supply/store/shipping/ShippingTemplateRegion.php +++ b/app/controller/supply/store/shipping/ShippingTemplateRegion.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\shipping; +namespace app\controller\supply\store\shipping; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/store/shipping/ShippingTemplateUndelive.php b/app/controller/supply/store/shipping/ShippingTemplateUndelive.php index 329fbd43..cab07c8f 100644 --- a/app/controller/supply/store/shipping/ShippingTemplateUndelive.php +++ b/app/controller/supply/store/shipping/ShippingTemplateUndelive.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\store\shipping; +namespace app\controller\supply\store\shipping; use think\App; use crmeb\basic\BaseController; diff --git a/app/controller/supply/system/Merchant.php b/app/controller/supply/system/Supply.php similarity index 87% rename from app/controller/supply/system/Merchant.php rename to app/controller/supply/system/Supply.php index 8f173986..2652acf2 100644 --- a/app/controller/supply/system/Merchant.php +++ b/app/controller/supply/system/Supply.php @@ -11,42 +11,42 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system; +namespace app\controller\supply\system; -use app\common\repositories\store\MerchantTakeRepository; +use app\common\repositories\store\SupplyTakeRepository; use app\common\repositories\store\product\ProductRepository; use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\system\operate\OperateLogRepository; use app\common\repositories\system\serve\ServeOrderRepository; use app\common\repositories\user\UserBillRepository; -use app\validate\merchant\MerchantTakeValidate; +use app\validate\supply\MerchantTakeValidate; use crmeb\basic\BaseController; -use app\common\repositories\system\merchant\MerchantRepository; -use app\validate\merchant\MerchantUpdateValidate; -use crmeb\jobs\ChangeMerchantStatusJob; +use app\common\repositories\system\supply\SupplyRepository; +use app\validate\supply\MerchantUpdateValidate; +use crmeb\jobs\ChangeSupplyStatusJob; use think\App; use think\facade\Queue; /** - * Class Merchant - * @package app\controller\merchant\system + * Class Supply + * @package app\controller\Supply\system * @author xaboy * @day 2020/6/25 */ -class Merchant extends BaseController +class Supply extends BaseController { /** - * @var MerchantRepository + * @var SupplyRepository */ protected $repository; /** * Merchant constructor. * @param App $app - * @param MerchantRepository $repository + * @param SupplyRepository $repository */ - public function __construct(App $app, MerchantRepository $repository) + public function __construct(App $app, SupplyRepository $repository) { parent::__construct($app); $this->repository = $repository; @@ -69,7 +69,7 @@ class Merchant extends BaseController * @author xaboy * @day 2020/6/25 */ - public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, MerchantTakeRepository $repository) + public function update(MerchantUpdateValidate $validate, MerchantTakeValidate $takeValidate, SupplyTakeRepository $repository) { $type = $this->request->param('type',1); $merchant = $this->request->merchant(); @@ -138,7 +138,7 @@ class Merchant extends BaseController ], ]); - Queue::push(ChangeMerchantStatusJob::class, $this->request->merId()); + Queue::push(ChangeSupplyStatusJob::class, $this->request->merId()); return app('json')->success('修改成功'); } @@ -148,7 +148,7 @@ class Merchant extends BaseController * @author xaboy * @day 2020/7/21 */ - public function info(MerchantTakeRepository $repository) + public function info(SupplyTakeRepository $repository) { $merchant = $this->request->merchant(); $adminInfo = $this->request->adminInfo(); @@ -168,12 +168,12 @@ class Merchant extends BaseController } /** - * @param MerchantTakeRepository $repository + * @param SupplyTakeRepository $repository * @return mixed * @author xaboy * @day 2020/8/1 */ - public function takeInfo(MerchantTakeRepository $repository) + public function takeInfo(SupplyTakeRepository $repository) { $merId = $this->request->merId(); return app('json')->success($repository->get($merId) + systemConfig(['tx_map_key'])); @@ -181,12 +181,12 @@ class Merchant extends BaseController /** * @param MerchantTakeValidate $validate - * @param MerchantTakeRepository $repository + * @param SupplyTakeRepository $repository * @return mixed * @author xaboy * @day 2020/8/1 */ - public function take(MerchantTakeValidate $validate, MerchantTakeRepository $repository) + public function take(MerchantTakeValidate $validate, SupplyTakeRepository $repository) { $data = $this->request->params(['mer_take_status', 'mer_take_name', 'mer_take_phone', 'mer_take_address', 'mer_take_location', 'mer_take_day', 'mer_take_time']); $validate->check($data); diff --git a/app/controller/supply/system/MerchantApplyments.php b/app/controller/supply/system/SupplyApplyments.php similarity index 92% rename from app/controller/supply/system/MerchantApplyments.php rename to app/controller/supply/system/SupplyApplyments.php index 8aaf76a5..275fcde4 100644 --- a/app/controller/supply/system/MerchantApplyments.php +++ b/app/controller/supply/system/SupplyApplyments.php @@ -11,28 +11,28 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system; +namespace app\controller\supply\system; -use app\validate\merchant\MerchantApplymentsValidate; +use app\validate\supply\MerchantApplymentsValidate; use think\App; use think\facade\Config; use think\facade\Queue; use crmeb\basic\BaseController; -use app\common\repositories\system\merchant\MerchantApplymentsRepository; +use app\common\repositories\system\supply\SupplyApplymentsRepository; -class MerchantApplyments extends BaseController +class SupplyApplyments extends BaseController { /** - * @var MerchantRepository + * @var SupplyRepository */ protected $repository; /** - * Merchant constructor. + * Supply constructor. * @param App $app * @param MerchantRepository $repository */ - public function __construct(App $app, MerchantApplymentsRepository $repository) + public function __construct(App $app, SupplyApplymentsRepository $repository) { parent::__construct($app); $this->repository = $repository; diff --git a/app/controller/supply/system/admin/Login.php b/app/controller/supply/system/admin/Login.php index 78171796..b7aa712c 100644 --- a/app/controller/supply/system/admin/Login.php +++ b/app/controller/supply/system/admin/Login.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\admin; +namespace app\controller\supply\system\admin; use crmeb\basic\BaseController; diff --git a/app/controller/supply/system/admin/SupplyAdmin.php b/app/controller/supply/system/admin/SupplyAdmin.php index 0beb4f21..3bf80bb2 100644 --- a/app/controller/supply/system/admin/SupplyAdmin.php +++ b/app/controller/supply/system/admin/SupplyAdmin.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\admin; +namespace app\controller\supply\system\admin; use app\common\repositories\system\auth\RoleRepository; diff --git a/app/controller/supply/system/auth/Role.php b/app/controller/supply/system/auth/Role.php index b522db17..68d70531 100644 --- a/app/controller/supply/system/auth/Role.php +++ b/app/controller/supply/system/auth/Role.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\auth; +namespace app\controller\supply\system\auth; use crmeb\basic\BaseController; diff --git a/app/controller/supply/system/diy/Diy.php b/app/controller/supply/system/diy/Diy.php index 4ba46355..b5f6ee7e 100644 --- a/app/controller/supply/system/diy/Diy.php +++ b/app/controller/supply/system/diy/Diy.php @@ -9,7 +9,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\system\diy; +namespace app\controller\supply\system\diy; use app\common\repositories\article\ArticleRepository; use app\common\repositories\store\product\ProductRepository; diff --git a/app/controller/supply/system/financial/Financial.php b/app/controller/supply/system/financial/Financial.php index 582cb29a..a78d0c08 100644 --- a/app/controller/supply/system/financial/Financial.php +++ b/app/controller/supply/system/financial/Financial.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\system\financial; +namespace app\controller\supply\system\financial; use app\common\repositories\system\financial\FinancialRepository; use app\validate\supply\MerchantFinancialAccountValidate; diff --git a/app/controller/supply/system/notice/SystemNoticeLog.php b/app/controller/supply/system/notice/SystemNoticeLog.php index f6b12532..56cfe33e 100644 --- a/app/controller/supply/system/notice/SystemNoticeLog.php +++ b/app/controller/supply/system/notice/SystemNoticeLog.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\notice; +namespace app\controller\supply\system\notice; use app\common\repositories\system\notice\SystemNoticeLogRepository; diff --git a/app/controller/supply/system/openapi/OpenApi.php b/app/controller/supply/system/openapi/OpenApi.php index b7084b77..c59fd99f 100644 --- a/app/controller/supply/system/openapi/OpenApi.php +++ b/app/controller/supply/system/openapi/OpenApi.php @@ -10,7 +10,7 @@ // | Author: CRMEB Team // +---------------------------------------------------------------------- -namespace app\validate\supply\system\openapi; +namespace app\controller\supply\system\openapi; use app\common\repositories\openapi\OpenAuthRepository; use app\validate\supply\OpenAuthValidate; diff --git a/app/controller/supply/system/serve/Config.php b/app/controller/supply/system/serve/Config.php index 2972b9b0..daa484c8 100644 --- a/app/controller/supply/system/serve/Config.php +++ b/app/controller/supply/system/serve/Config.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\serve; +namespace app\controller\supply\system\serve; use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\system\serve\ServeOrderRepository; diff --git a/app/controller/supply/system/serve/Serve.php b/app/controller/supply/system/serve/Serve.php index 7cdfc877..457cadb9 100644 --- a/app/controller/supply/system/serve/Serve.php +++ b/app/controller/supply/system/serve/Serve.php @@ -11,7 +11,7 @@ // +---------------------------------------------------------------------- -namespace app\validate\supply\system\serve; +namespace app\controller\supply\system\serve; use app\common\repositories\system\serve\ServeMealRepository; use app\common\repositories\system\serve\ServeOrderRepository; diff --git a/config/admin.php b/config/admin.php index 8268fd71..6479f45d 100644 --- a/config/admin.php +++ b/config/admin.php @@ -23,9 +23,11 @@ return [ 'captcha_exp' => 30, //30分钟 'admin_prefix' => 'admin', 'merchant_prefix' => 'merchant', + 'supply_prefix' => 'supply', 'service_prefix' => 'kefu', 'api_admin_prefix' => 'sys', 'api_merchant_prefix' => 'mer', + 'api_supply_prefix' => 'sply', 'api_service_prefix' => 'ser', 'api_openapi_prefix' => 'openapi', 'vic_word_status' => 0, diff --git a/route/supply.php b/route/supply.php new file mode 100644 index 00000000..4529c9ef --- /dev/null +++ b/route/supply.php @@ -0,0 +1,44 @@ + +// +---------------------------------------------------------------------- + + +use app\common\middleware\AllowOriginMiddleware; +use app\common\middleware\CheckSiteOpenMiddleware; +use app\common\middleware\InstallMiddleware; +use think\facade\Route; +use app\common\middleware\RequestLockMiddleware; + +Route::group(config('admin.supply_prefix'), function () { + Route::miss(function () { + $DB = DIRECTORY_SEPARATOR; + return view(app()->getRootPath() . 'public' . $DB . 'mer.html'); + }); +})->middleware(InstallMiddleware::class) + ->middleware(CheckSiteOpenMiddleware::class); + +Route::group(config('admin.api_supply_prefix') . '/', function () { + $path = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR.'supply'; + $files = scandir($path); + foreach ($files as $file) { + if($file != '.' && $file != '..'){ + include $path . DIRECTORY_SEPARATOR . $file; + } + } + Route::miss(function () { + return app('json')->fail('接口不存在'); + })->middleware(AllowOriginMiddleware::class); +}) + ->option([ + '_lock' => true + ]) + ->middleware(InstallMiddleware::class) + ->middleware(CheckSiteOpenMiddleware::class) + ->middleware(RequestLockMiddleware::class);