From e0f68a2d4da4cdb6585bcbbc0e09e2a994dedb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 8 Aug 2022 10:43:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#20220808=20=E6=97=A5=E5=BF=97=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Shop/ShopsController.php | 8 +++-- app/Listeners/BindBusinessGoods.php | 34 +++++++++++++++++++ app/Listeners/SendDatabaseNotification.php | 31 +++++++++++++++++ app/Listeners/UpdateBusinessGoodsStock.php | 34 +++++++++++++++++++ app/Models/Log.php | 8 +++++ app/Providers/EventServiceProvider.php | 6 ++++ .../Business/KuaiTuanTuan/KuaiTuanTuan.php | 1 + 7 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 app/Listeners/BindBusinessGoods.php create mode 100644 app/Listeners/SendDatabaseNotification.php create mode 100644 app/Listeners/UpdateBusinessGoodsStock.php diff --git a/app/Http/Controllers/Shop/ShopsController.php b/app/Http/Controllers/Shop/ShopsController.php index 5ec522d..d32528c 100644 --- a/app/Http/Controllers/Shop/ShopsController.php +++ b/app/Http/Controllers/Shop/ShopsController.php @@ -3,6 +3,8 @@ namespace App\Http\Controllers\Shop; use App\Http\Controllers\Controller; +use App\Listeners\BindBusinessGoods; +use App\Listeners\UpdateBusinessGoodsStock; use App\Models\Shop; use App\Http\Resources\ShopsResource; use Illuminate\Http\Request; @@ -86,10 +88,12 @@ class ShopsController extends Controller $business = BusinessFactory::init()->make($shop->plat_id); $business->setShop($shop); if ('goods' === $request->get('type')) { - $business->downloadGoodsAndBind($request->get('data')); + $business->bindGoods($request->get('data')); + event(new BindBusinessGoods($shop)); } if ('orders' === $request->get('type')) { - $business->downloadOrders(); + $business->saveOrders(); + event(new UpdateBusinessGoodsStock($shop)); } } } diff --git a/app/Listeners/BindBusinessGoods.php b/app/Listeners/BindBusinessGoods.php new file mode 100644 index 0000000..b6c3ed8 --- /dev/null +++ b/app/Listeners/BindBusinessGoods.php @@ -0,0 +1,34 @@ +shop = $shop; + } + + /** + * Handle the event. + * + * @param Registered $event + * @return void + */ + public function handle(Registered $event) + { + // + } +} diff --git a/app/Listeners/SendDatabaseNotification.php b/app/Listeners/SendDatabaseNotification.php new file mode 100644 index 0000000..ce0cbee --- /dev/null +++ b/app/Listeners/SendDatabaseNotification.php @@ -0,0 +1,31 @@ +shop = $shop; + } + + /** + * Handle the event. + * + * @param Registered $event + * @return void + */ + public function handle(Registered $event) + { + // + } +} diff --git a/app/Models/Log.php b/app/Models/Log.php index 75c1cd7..06bc265 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -38,6 +38,8 @@ class Log extends Model 'permission' => '权限', 'role' => '角色', 'user' => '用户', + 'plat' => '平台', + 'file' => '文件', ]; return $map[$value]; @@ -65,6 +67,9 @@ class Log extends Model 'role' => '角色', 'menu' => '菜单', 'user' => '用户', + 'upload' => '上传', + 'kuaituantuan' => '快团团', + 'miaoxuan' => '妙选', ]; return $map[$value]; @@ -80,6 +85,9 @@ class Log extends Model 'import' => '导入', 'export' => '导出', 'set' => '设置', + 'cost' => '成本', + 'stock' => '库存', + 'inventory' => '库存盘点', ]; return $map[$value]; diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 723a290..b975ef6 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -6,6 +6,9 @@ use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Event; +use App\Listeners\SendDatabaseNotification; +use App\Listeners\BindBusinessGoods; +use App\Listeners\UpdateBusinessGoodsStock; class EventServiceProvider extends ServiceProvider { @@ -17,6 +20,9 @@ class EventServiceProvider extends ServiceProvider protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, + SendDatabaseNotification::class, + BindBusinessGoods::class, + UpdateBusinessGoodsStock::class, ], ]; diff --git a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php index 9b588be..d75d708 100644 --- a/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php +++ b/app/Services/Business/KuaiTuanTuan/KuaiTuanTuan.php @@ -2,6 +2,7 @@ namespace App\Services\Business\KuaiTuanTuan; +use App\Listeners\BindBusinessGoods; use App\Models\BusinessGoodsSku; use App\Models\GoodsSku; use App\Services\Business\BusinessClient;