RefillCallBack.php 960 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace refill\lx;
  3. use refill;
  4. class RefillCallBack implements refill\IRefillCallBack
  5. {
  6. public function verify($params): bool
  7. {
  8. return true;
  9. }
  10. public function notify($params)
  11. {
  12. $state = $params['state_type'];
  13. $order_id = $params['order_id'];
  14. $order_info = Model('vr_order')->getOrderInfoForNotify(['order_id' => $order_id]);
  15. if (empty($order_info)) {
  16. return [false, false, false,false];
  17. }
  18. if(!empty($params['official_sn']) && $state == 'order_success'){
  19. $data['official_sn'] = $params['official_sn'];
  20. Model('refill_order')->edit($order_id, $data);
  21. }
  22. if ($state == 'order_success') {
  23. return [$order_id, true, false, true];
  24. } elseif ($state == 'order_cancel') {
  25. return [$order_id, false, false, true];
  26. } else {
  27. return [$order_id, false, false, false];
  28. }
  29. }
  30. }