RefillCallBack.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace refill\bailian;
  3. require_once(BASE_HELPER_RAPI_PATH . '/bailian/config.php');
  4. use Log;
  5. use refill;
  6. class RefillCallBack implements refill\IRefillCallBack
  7. {
  8. public function verify($params): bool
  9. {
  10. $input = $params;
  11. unset($input['sign']);
  12. $sign = config::sign($input);
  13. if ($params['sign'] == $sign) {
  14. return true;
  15. } else {
  16. return false;
  17. }
  18. }
  19. public function notify($params)
  20. {
  21. $status = intval($params['orderStatus']);
  22. $order_sn = $params['outOrderId'];
  23. $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
  24. if (empty($order_info)) {
  25. return [false, false, false,false];
  26. }
  27. $order_id = $order_info['order_id'];
  28. if ($status === 2) {
  29. Log::record("mengu sms:{$params['ext1']}",Log::DEBUG);
  30. Model('')->table('refill_ext')->insert(['order_id' => $order_id, 'sms' => $params['ext1']]);
  31. $official_sn = config::official_sn($params['ext1']);
  32. Model('refill_order')->edit($order_id, ['official_sn' => $official_sn]);
  33. return [$order_id, true, false,true];
  34. }
  35. elseif ($status === 3) {
  36. return [$order_id, false, true,true];
  37. }
  38. else {
  39. return [$order_id, false, false,false];
  40. }
  41. }
  42. }