VideoOrderNotify.php 758 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace addons\Store\common\logic\notify;
  3. use addons\Store\common\models\StoreOrder;
  4. use addons\Store\common\models\StoreVideoOrder;
  5. use common\models\order\Order;
  6. use common\traits\ErrorTrait;
  7. use Exception;
  8. class VideoOrderNotify
  9. {
  10. use ErrorTrait;
  11. public function notify($order_info)
  12. {
  13. try {
  14. $order = StoreVideoOrder::findOne(['order_no' => $order_info['order_no']]);
  15. $res = StoreVideoOrder::pay($order,$order_info['pay_type']);
  16. if($res === false) throw new Exception(Order::getStaticError());
  17. return true;
  18. } catch (Exception $e) {
  19. echo $e->getMessage();
  20. $this->setStaticError($e->getMessage());
  21. return false;
  22. }
  23. }
  24. }