Notify.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace addons\DepositPresale\common\logic\notify;
  3. use addons\DepositPresale\common\models\DepositPresaleOrder;
  4. use common\models\order\Order;
  5. use common\traits\ErrorTrait;
  6. use Exception;
  7. /**
  8. * Class Notify
  9. * @Author: hua
  10. * @DateTime: 2021/10/18 9:39
  11. * @Copyright: copyright (c) 2021 广东七件事集团
  12. * @package common\logic\notify
  13. */
  14. class Notify
  15. {
  16. use ErrorTrait;
  17. /**
  18. * @Author: hua
  19. * @DateTime: 2021/10/18 9:57
  20. * @Copyright: copyright (c) 2021 广东七件事集团
  21. * @param $order_info
  22. * @return bool
  23. */
  24. public function notify($order_info)
  25. {
  26. try {
  27. $order = DepositPresaleOrder::findOne(['order_no' => $order_info['order_no']]);
  28. $res = DepositPresaleOrder::pay($order,$order_info['pay_type']);
  29. if($res === false) throw new Exception(DepositPresaleOrder::getStaticError());
  30. return true;
  31. } catch (Exception $e) {
  32. echo $e->getMessage();
  33. $this->setStaticError($e->getMessage());
  34. return false;
  35. }
  36. }
  37. }