RefillCallBack.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace refill\shantong;
  3. require_once(BASE_HELPER_RAPI_PATH . '/shantong/config.php');
  4. use refill;
  5. class RefillCallBack implements refill\IRefillCallBack
  6. {
  7. public function verify($params): bool
  8. {
  9. $input = $params;
  10. unset($input['sign']);
  11. $sign = config::sign($input);
  12. if ($params['sign'] == $sign) {
  13. return true;
  14. } else {
  15. return false;
  16. }
  17. }
  18. public function notify($params)
  19. {
  20. $order_sn = $params['orderId'];
  21. $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
  22. if (empty($order_info)) {
  23. return [false, false, false,false];
  24. }
  25. $order_id = $order_info['order_id'];
  26. $status = intval($params['orderStatus']);
  27. if ($status === 3) {
  28. Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['ispVoucherId']]);
  29. return [$order_id, true, false, true];
  30. } elseif ($status === 99) {
  31. return [$order_id, false, true, true];
  32. } else {
  33. return [$order_id, false, false, false];
  34. }
  35. }
  36. }