mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-12-01 06:30:49 +00:00
feat: #20220808 日志详细优化
This commit is contained in:
parent
5b628380ce
commit
e0f68a2d4d
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
app/Listeners/BindBusinessGoods.php
Normal file
34
app/Listeners/BindBusinessGoods.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Models\Shop;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class BindBusinessGoods
|
||||
{
|
||||
protected $shop;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Shop $shop)
|
||||
{
|
||||
$this->shop = $shop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Registered $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Registered $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
31
app/Listeners/SendDatabaseNotification.php
Normal file
31
app/Listeners/SendDatabaseNotification.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class SendDatabaseNotification
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Registered $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Registered $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
34
app/Listeners/UpdateBusinessGoodsStock.php
Normal file
34
app/Listeners/UpdateBusinessGoodsStock.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Models\Shop;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class UpdateBusinessGoodsStock
|
||||
{
|
||||
protected $shop;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Shop $shop)
|
||||
{
|
||||
$this->shop = $shop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param Registered $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Registered $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -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];
|
||||
|
||||
@ -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,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user