|
@@ -16,7 +16,7 @@ class RefillOil extends refill\IRefillOil
|
|
|
parent::__construct($cfgs);
|
|
|
}
|
|
|
|
|
|
- private function req_params(string $card_no,int $amount,array $other)
|
|
|
+ private function req_params(string $card_no, int $amount, array $other)
|
|
|
{
|
|
|
$params['app_id'] = config::APP_ID;
|
|
|
$params['gas_userid'] = $card_no;
|
|
@@ -31,29 +31,26 @@ class RefillOil extends refill\IRefillOil
|
|
|
$key = config::APP_KEY;
|
|
|
$content = $params['app_id'] . $key . $params['gas_userid'] . $params['ordersn'] . $params['cardnum'];
|
|
|
|
|
|
- Log::record("body={$content}",Log::DEBUG);
|
|
|
+ Log::record("body={$content}", Log::DEBUG);
|
|
|
return md5($content);
|
|
|
}
|
|
|
|
|
|
- public function add($card_no,$card_type,$amount,$input)
|
|
|
+ public function add($card_no, $card_type, $amount, $input)
|
|
|
{
|
|
|
- $params = $this->req_params($card_no,$amount,$input);
|
|
|
+ $params = $this->req_params($card_no, $amount, $input);
|
|
|
$sign = $this->sign($params);
|
|
|
$params['sign'] = $sign;
|
|
|
|
|
|
- $resp = http_request(config::ORDER_URL,$params);
|
|
|
- if($resp === false) {
|
|
|
- return [false,'系统错误'];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Log::record($resp,Log::DEBUG);
|
|
|
- $resp = json_decode($resp,true);
|
|
|
- if($resp['code'] == 0) {
|
|
|
- return [true,$resp['result']];
|
|
|
- }
|
|
|
- else {
|
|
|
- return [false,$resp['msg']];
|
|
|
+ $resp = http_request(config::ORDER_URL, $params);
|
|
|
+ if ($resp === false) {
|
|
|
+ return [false, '系统错误'];
|
|
|
+ } else {
|
|
|
+ Log::record($resp, Log::DEBUG);
|
|
|
+ $resp = json_decode($resp, true);
|
|
|
+ if ($resp['code'] == 0) {
|
|
|
+ return [true, $resp['result']];
|
|
|
+ } else {
|
|
|
+ return [false, $resp['msg']];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -64,33 +61,33 @@ class RefillOil extends refill\IRefillOil
|
|
|
$params['app_id'] = config::APP_ID;
|
|
|
$params['sign'] = md5(config::APP_ID . config::APP_KEY . $refill_info['order_sn']);
|
|
|
|
|
|
- $resp = http_request(config::QUERY_URL,$params);
|
|
|
- if($resp === false) {
|
|
|
- return [false,'系统错误'];
|
|
|
- }
|
|
|
- else {
|
|
|
- Log::record($resp,Log::DEBUG);
|
|
|
- $resp = json_decode($resp,true);
|
|
|
- if($resp['code'] == 0) {
|
|
|
+ $resp = http_request(config::QUERY_URL, $params);
|
|
|
+ if ($resp === false) {
|
|
|
+ return [false, '系统错误'];
|
|
|
+ } else {
|
|
|
+ Log::record($resp, Log::DEBUG);
|
|
|
+ $resp = json_decode($resp, true);
|
|
|
+ if ($resp['code'] == 0) {
|
|
|
$order_state = '';
|
|
|
- if($resp['result']['order_state'] == 1){
|
|
|
+ if ($resp['result']['order_state'] == 1) {
|
|
|
$order_state = ORDER_STATE_SUCCESS;
|
|
|
- }
|
|
|
- if($resp['result']['order_state'] == 9){
|
|
|
+ } elseif ($resp['result']['order_state'] == 9) {
|
|
|
$order_state = ORDER_STATE_CANCEL;
|
|
|
+ } elseif ($resp['result']['order_state'] == 0){
|
|
|
+ $order_state = ORDER_STATE_SEND;
|
|
|
}
|
|
|
- if(empty($order_state)){
|
|
|
- return [false,$resp['result']];
|
|
|
+ if (empty($order_state)) {
|
|
|
+ return [false, $resp['result']];
|
|
|
}
|
|
|
- return [true,$order_state];
|
|
|
- }
|
|
|
- else {
|
|
|
- return [false,$resp['msg']];
|
|
|
+ return [true, $order_state];
|
|
|
+ } else {
|
|
|
+ return [false, $resp['msg']];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function callback() {
|
|
|
+ public function callback()
|
|
|
+ {
|
|
|
return false;
|
|
|
}
|
|
|
}
|