42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Listeners;
|
|
|
|
use App\Jobs\Bonus\BuyIdentityJob;
|
|
use App\Models\Bouns;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Modules\Task\Facades\TaskFacade;
|
|
use Modules\User\Events\UserOrderPaid;
|
|
|
|
class UserOrderPaidListener implements ShouldQueue
|
|
{
|
|
|
|
public function handle(UserOrderPaid $event)
|
|
{
|
|
$order = $event->order;
|
|
$user = $event->order->user;
|
|
$identity = $event->order->identity;
|
|
$source = [
|
|
'identity_id' => $identity->id,
|
|
'order_id' => $event->order->id,
|
|
'type' => $event->order->type,
|
|
];
|
|
|
|
// BuyIdentityJob::dispatch($user, $order, $source);//个人赠送水滴
|
|
// Bouns::addBouns($order, $order->price);
|
|
|
|
#TODO 开通会员赠送水滴
|
|
// TaskFacade::do('open_vip', $user->id, [
|
|
// 'identity_id' => $event->order->identity_id
|
|
// ]);
|
|
|
|
#TODO 邀请一名健康体验馆 赠送水滴
|
|
// if ($user->parent) {
|
|
// TaskFacade::do('recommend_ty', $user->parent->id, [
|
|
// 'user_id' => $user->id
|
|
// ]);
|
|
// }
|
|
}
|
|
|
|
}
|