增加作废

This commit is contained in:
2020-09-03 11:58:32 +08:00
parent 7dee5a99d5
commit 744e53a407
2 changed files with 7 additions and 2 deletions

View File

@@ -20,20 +20,22 @@ class ConponCallbackListener implements ShouldQueue
public function handle(ConponCallback $event) public function handle(ConponCallback $event)
{ {
$acticity_coupon = $event->acticity_coupon; $acticity_coupon = $event->acticity_coupon;
$user = $acticity_coupon->outlet->parent;
$user = $acticity_coupon->outlet->parent;
if ($user->callback) { if ($user->callback) {
$client = new Client(); $client = new Client();
$response = $client->request('post', $user->callback, [ $response = $client->request('post', $user->callback, [
'timeout' => 30, 'timeout' => 30,
'query' => [ 'query' => [
'code' => $acticity_coupon->code, 'code' => $acticity_coupon->code,
'status' => $acticity_coupon->status,
], ],
]); ]);
$data = [ $data = [
'code' => $acticity_coupon->code, 'code' => $acticity_coupon->code,
'type' => $acticity_coupon->status == 2 ? 'Verification' : 'Destroy',
'url' => $user->callback, 'url' => $user->callback,
]; ];

View File

@@ -2,6 +2,7 @@
namespace XuanChen\Coupon\Action\ysd; namespace XuanChen\Coupon\Action\ysd;
use App\Events\ConponCallback;
use App\Models\ActivityCoupon; use App\Models\ActivityCoupon;
use App\Models\User; use App\Models\User;
use XuanChen\Coupon\Action\Init; use XuanChen\Coupon\Action\Init;
@@ -45,6 +46,8 @@ class YsdDestroy extends Init
$info->status = ActivityCoupon::STATUS_CLOSE; $info->status = ActivityCoupon::STATUS_CLOSE;
$info->save(); $info->save();
event(new ConponCallback($info));
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
return $e->getMessage(); return $e->getMessage();