RefillCallBack.php 1008 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace refill\pengxinda;
  3. require_once(BASE_HELPER_RAPI_PATH . '/pengxinda/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_no'];
  14. $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
  15. if (empty($order_info)) {
  16. return [false, false, false,false];
  17. }
  18. $order_id = $order_info['order_id'];
  19. $status = intval($params['retcode']);
  20. if ($status === 1) {
  21. $data['official_sn'] = strtolower($params['errcode']) == 'null' ? '' : $params['errcode'];
  22. Model('refill_order')->edit($order_id, $data);
  23. return [$order_id, true, false, true];
  24. } elseif ($status === 0) {
  25. return [$order_id, false, true, true];
  26. } else {
  27. return [$order_id, false, false, false];
  28. }
  29. }
  30. }