| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?php
- /**
- * Created by PhpStorm.
- * Name: 芸众商城系统
- * Author: 广州市芸众信息科技有限公司
- * Profile: 广州市芸众信息科技有限公司位于国际商贸中心的广州,专注于移动电子商务生态系统打造,拥有芸众社交电商系统、区块链数字资产管理系统、供应链管理系统、电子合同等产品/服务。官网 :www.yunzmall.com www.yunzshop.com
- * Date: 2021/6/17
- * Time: 10:21
- */
- namespace Yunshop\RunningDelivery;
- use Config;
- use YunShop;
- use app\common\services\Hook;
- class PluginApplication extends \app\common\services\PluginApplication
- {
- protected function setConfig() //操作config文件里的配置
- {
- \app\common\modules\shop\ShopConfig::current()->push('shop-foundation.status', ['key' => 'running_delivery', 'class' => \Yunshop\RunningDelivery\models\process\RunningStatus::class]);
- }
- public function boot() //注册监听事件
- {
- $events = app('events');
- //判断当前门店配送是否走跑腿配送第三方运费
- \app\common\modules\shop\ShopConfig::current()->set('extra_store_delivery_is_allow.running_delivery',
- [
- 'class' => '\Yunshop\RunningDelivery\services\DeliveryService',
- 'function' => 'runningDeliveryAllow'
- ]
- );
- //获取当前跑腿配送第三方运费
- \app\common\modules\shop\ShopConfig::current()->set('extra_store_delivery_get_fee.running_delivery',
- [
- 'class' => '\Yunshop\RunningDelivery\services\DeliveryService',
- 'function' => 'getDeliveryFee'
- ]
- );
- //门店订单详情隐藏操作按钮
- \app\common\modules\shop\ShopConfig::current()->set('change_order_for_store_order_detail.running_delivery',
- [
- 'class' => '\Yunshop\RunningDelivery\services\StoreService',
- 'function' => 'getRunningDeliveryOrder'
- ]
- );
- //判断门店下单页地址是否需要设置经纬度
- \app\common\modules\shop\ShopConfig::current()->set('create_store_order_need_set_lat.running_delivery',
- [
- 'class' => '\Yunshop\RunningDelivery\services\DeliveryService',
- 'function' => 'checkStoreOpen'
- ]
- );
- $events->subscribe(\Yunshop\RunningDelivery\listener\OrderCreatedListener::class);
- $events->subscribe(\Yunshop\RunningDelivery\listener\OrderPaidListener::class);
- $events->subscribe(\Yunshop\RunningDelivery\listener\AfterOrderCanceledListener::class);
- $events->subscribe(\Yunshop\RunningDelivery\listener\BeforeOrderCanceledListener::class);
- \Event::listen('cron.collectJobs', function () { //token刷新定时任务
- \Cron::add('RunningDeliveryRefreshToken', '*/10 * * * *', function () {
- (new \Yunshop\RunningDelivery\services\TimeRefreshTokenService())->handle();
- return;
- });
- });
- \Event::listen('cron.collectJobs', function () { //token刷新定时任务
- \Cron::add('RunningDeliveryRefreshOrder', '*/3 * * * *', function () {
- (new \Yunshop\RunningDelivery\services\TimeRefreshOrderService())->handle();
- return;
- });
- });
- }
- protected function setMenuConfig()
- {
- \app\backend\modules\menu\Menu::current()->setPluginMenu('running_delivery', [
- 'name' => '跑腿配送',
- 'type' => 'store',
- 'url' => 'plugin.running-delivery.admin.setting.index',
- 'url_params' => '',
- 'permit' => 1,
- 'menu' => 1,
- 'top_show' => 0,
- 'left_first_show' => 0,
- 'left_second_show' => 1,
- 'icon' => 'fa-picture-o',
- 'list_icon' => 'running_delivery',
- 'parents' => [],
- 'child' => [
- 'running_delivery_setting' => [
- 'name' => '基础设置',
- 'permit' => 1,
- 'menu' => 1,
- 'icon' => 'fa-gear',
- 'url' => 'plugin.running-delivery.admin.setting.index',
- 'url_params' => '',
- 'parents' => ['running_delivery'],
- 'child' => [
- 'running_delivery_setting_edit' => [
- 'name' => '编辑设置',
- 'permit' => 1,
- 'menu' => 0,
- 'icon' => 'fa-th-list',
- 'url' => 'plugin.running-delivery.admin.setting.edit',
- 'url_params' => '',
- 'parents' => ['running_delivery', 'running_delivery_setting'],
- 'child' => []
- ],
- ],
- ],
- 'running_delivery_store' => [
- 'name' => '门店管理',
- 'permit' => 1,
- 'menu' => 1,
- 'icon' => 'fa-group',
- 'url' => 'plugin.running-delivery.admin.store.index',
- 'url_params' => '',
- 'parents' => ['running_delivery'],
- 'child' => [
- 'running_delivery_store_bind_many' => [
- 'name' => '批量绑定商户',
- 'permit' => 1,
- 'menu' => 0,
- 'icon' => 'fa-th-list',
- 'url' => 'plugin.running-delivery.admin.store.bindManyStore',
- 'url_params' => '',
- 'parents' => ['running_delivery', 'running_delivery_store'],
- 'child' => []
- ],
- 'running_delivery_store_bind_one' => [
- 'name' => '绑定单个商户',
- 'permit' => 1,
- 'menu' => 0,
- 'icon' => 'fa-th-list',
- 'url' => 'plugin.running-delivery.admin.store.bindOneStore',
- 'url_params' => '',
- 'parents' => ['running_delivery', 'running_delivery_store'],
- 'child' => []
- ],
- ]
- ],
- 'running_delivery_order' => [
- 'name' => '跑腿订单同步',
- 'permit' => 1,
- 'menu' => 0,
- 'icon' => 'fa-group',
- 'url' => 'plugin.running-delivery.admin.order.changeProcess',
- 'url_params' => '',
- 'parents' => ['running_delivery'],
- 'child' => [
- 'running_delivery_order_cancel' => [
- 'name' => '跑腿订单取消',
- 'permit' => 1,
- 'menu' => 0,
- 'icon' => 'fa-th-list',
- 'url' => 'plugin.running-delivery.admin.order.cancelOrder',
- 'url_params' => '',
- 'parents' => ['running_delivery', 'running_delivery_store'],
- 'child' => []
- ],
- ]
- ],
- ]
- ]);
- }
- }
|