req_params($card_no,$amount,$order_sn); $params['sign'] = $this->sign($params); $resp = http_request(config::ORDER_URL,$params,'POST'); if($resp === false) { return [false,'系统错误']; } else { Log::record($resp,Log::DEBUG); $resp = json_decode($resp,true); if($resp['code'] == 200 && $resp['result'] == 'SUCCESS') { return [true,$resp['result']]; } else { return [false,$resp['result']]; } } } public function query($refill_info){ $params['pay_orderid'] = $refill_info['order_sn']; $params['pay_memberid'] = config::NUMBER_ID; $sign = $this->sign($params,true); $params['sign'] = $sign; $resp = http_request(config::QUERY_ORDER_URL,$params,'POST'); if($resp === false) { return [false,'系统错误']; } else { Log::record($resp,Log::DEBUG); $resp = json_decode($resp,true); $order_state = -1; if ($resp['status'] == 1) { $order_state = ORDER_STATE_SUCCESS; } elseif ($resp['status'] == 2) { $order_state = ORDER_STATE_CANCEL; } elseif ($resp['status'] == 6){ $order_state = ORDER_STATE_SEND; } if ($order_state == -1) { return [false, $resp['data']]; } return [true, $order_state]; } } private function sign($params , $encrypt = false) { ksort($params); $content = ''; foreach ($params as $key => $val){ $content .= "{$key}={$val}&"; } if($encrypt){ $content = md5($content); } $str = $content . config::KEY; return md5($str); } }