RechargeOrderPaySuccess.php 761 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Modules\Trade\Pay;
  3. use App\Modules\Product\Services\ProductService;
  4. use App\Modules\Subscribe\Models\Order;
  5. use App\Modules\User\Services\UserService;
  6. /**
  7. *
  8. * @property \App\Modules\Product\Models\Product $product
  9. */
  10. class RechargeOrderPaySuccess extends PaySuccessAbstract
  11. {
  12. private $product;
  13. public function __construct(Order $order)
  14. {
  15. parent::__construct($order);
  16. $this->product = ProductService::getProductSingle($order->product_id);
  17. }
  18. protected function handlePayProcess()
  19. {
  20. $total = $this->product->price * 100 + $this->product->given;
  21. $uid = $this->order->uid;
  22. UserService::addBalance($uid, $total, $this->product->price * 100, $this->product->given);
  23. }
  24. }