RefillOil.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace refill\fetch_lingzh;
  3. require_once(BASE_HELPER_RAPI_PATH . '/fetch_lingzh/config.php');
  4. use refill;
  5. class RefillOil extends refill\IRefillOil
  6. {
  7. public function __construct($cfgs)
  8. {
  9. parent::__construct($cfgs);
  10. }
  11. public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
  12. {
  13. sleep(3);
  14. return [true , '',false];
  15. }
  16. public function query($refill_info)
  17. {
  18. $order_sn = $refill_info['order_sn'];
  19. $store_id = $this->store_id();
  20. $mod_fetch = Model('fetch_order');
  21. $order = $mod_fetch->order_info(['order_sn' => $order_sn,'store_id' => $store_id],'*',true);
  22. if(empty($order)) {
  23. return [true, ORDER_STATE_NOEXIST];
  24. }
  25. $fetch_status = intval($order['fetch_status']);
  26. $fetch_result = $order['fetch_result'];
  27. $official_sn = $order['official_sn'];
  28. if ($fetch_status == 0) {
  29. $order_state = ORDER_STATE_CANCEL;
  30. } elseif ($fetch_status == 1 || $fetch_status == 2) {
  31. $order_state = ORDER_STATE_SEND;
  32. } elseif ($fetch_result == "SUCCESS") {
  33. $order_state = ORDER_STATE_SUCCESS;
  34. Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn]);
  35. } else {
  36. $order_state = ORDER_STATE_CANCEL;
  37. }
  38. return [true, $order_state];
  39. }
  40. public function balance()
  41. {
  42. return [false, '暂无余额接口'];
  43. }
  44. }