123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace refill\fetch_lingzh;
- require_once(BASE_HELPER_RAPI_PATH . '/fetch_lingzh/config.php');
- use refill;
- class RefillOil extends refill\IRefillOil
- {
- public function __construct($cfgs)
- {
- parent::__construct($cfgs);
- }
- public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
- {
- $mod_fetch = Model('fetch_order');
- $count = $mod_fetch->store_order_count($this->store_id());
- return [config::PROCESS_ABILITY >= $count, '',false];
- }
- public function query($refill_info)
- {
- $order_sn = $refill_info['order_sn'];
- $store_id = $this->store_id();
- $mod_fetch = Model('fetch_order');
- $order = $mod_fetch->order_info(['order_sn' => $order_sn,'store_id' => $store_id],'*',true);
- if(empty($order)) {
- return [true, ORDER_STATE_NOEXIST];
- }
- $fetch_status = intval($order['fetch_status']);
- $fetch_result = $order['fetch_result'];
- $official_sn = $order['official_sn'];
- if ($fetch_status == 0) {
- $order_state = ORDER_STATE_CANCEL;
- } elseif ($fetch_status == 1 || $fetch_status == 2) {
- $order_state = ORDER_STATE_SEND;
- } elseif ($fetch_result == "SUCCESS") {
- $order_state = ORDER_STATE_SUCCESS;
- Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn]);
- } else {
- $order_state = ORDER_STATE_CANCEL;
- }
- return [true, $order_state];
- }
- }
|