RefillCallBack.php 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace refill\fetch_lingzh;
  3. require_once(BASE_HELPER_RAPI_PATH . '/fetch_lingzh/config.php');
  4. use refill;
  5. class RefillCallBack implements refill\IRefillCallBack
  6. {
  7. public function verify($params): bool
  8. {
  9. return true;
  10. }
  11. public function notify($params)
  12. {
  13. $order_sn = $params['order_sn'];
  14. $state = $params['state'];
  15. $official_sn = $params['official_sn'] ?? '';
  16. $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
  17. if (empty($order_info)) {
  18. return [false, false, false,false];
  19. }
  20. $order_id = $order_info['order_id'];
  21. if ($state === 'SUCCESS') {
  22. Model('refill_order')->edit($order_id, ['official_sn' => $official_sn]);
  23. return [$order_id, true, false,true];
  24. }
  25. elseif ($state === 'CANCEL') {
  26. return [$order_id, false, true,true];
  27. }
  28. else {
  29. return [$order_id, false, false,false];
  30. }
  31. }
  32. }