|
@@ -6,7 +6,6 @@ require_once(BASE_HELPER_RAPI_PATH . '/weisanhuo/config.php');
|
|
|
|
|
|
use refill;
|
|
|
use Log;
|
|
|
-use refill\util;
|
|
|
|
|
|
class RefillPhone extends refill\IRefillPhone
|
|
|
{
|
|
@@ -64,9 +63,17 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
public function query($refill_info): array
|
|
|
{
|
|
|
$params['secretId'] = config::SECRET_ID;
|
|
|
- $params['outTradeNo'] = $refill_info['order_sn'];
|
|
|
|
|
|
- $sign = config::sign($params, ['outTradeNo']);
|
|
|
+ if(!empty($refill_info['ch_trade_no'])) {
|
|
|
+ $params['inTradeNo'] = $refill_info['ch_trade_no'];
|
|
|
+ $sign = config::sign($params, ['inTradeNo']);
|
|
|
+ $commit_check = false;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $params['outTradeNo'] = $refill_info['order_sn'];
|
|
|
+ $sign = config::sign($params, ['outTradeNo']);
|
|
|
+ $commit_check = true;
|
|
|
+ }
|
|
|
$params['sign'] = $sign;
|
|
|
|
|
|
$resp = http_request(config::QUERY_URL, $params, 'GET');
|
|
@@ -91,13 +98,23 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$offical_sn = $resp['data']['inTradeNo'];
|
|
|
Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $offical_sn]);
|
|
|
$order_state = ORDER_STATE_SUCCESS;
|
|
|
- } elseif ($status == 'failed') {
|
|
|
- $order_state = ORDER_STATE_CANCEL;
|
|
|
- } elseif ($status == 'waiting') {
|
|
|
+ }
|
|
|
+ elseif ($status == 'failed')
|
|
|
+ {
|
|
|
+ if(!$commit_check) {
|
|
|
+ $order_state = ORDER_STATE_CANCEL;
|
|
|
+ }
|
|
|
+ elseif((time() - $refill_info['commit_time']) >= 600) {
|
|
|
+ $order_state = ORDER_STATE_NOEXIST;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ elseif ($status == 'waiting') {
|
|
|
$order_state = ORDER_STATE_SEND;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
return [false, $status, $offical_sn];
|
|
|
}
|
|
|
+
|
|
|
return [true, $order_state, $offical_sn];
|
|
|
}
|
|
|
else
|