|
@@ -14,7 +14,6 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
parent::__construct($cfgs);
|
|
|
}
|
|
|
|
|
|
- //统一请求
|
|
|
private function url_request($params, $action)
|
|
|
{
|
|
|
$params['action'] = $action;
|
|
@@ -25,38 +24,33 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$req['busiBody'] = $params;
|
|
|
$req = json_encode($req);
|
|
|
|
|
|
- return $req;
|
|
|
-
|
|
|
-// $url = config::API_URL;
|
|
|
-// $resp = http_post_data($url, $req, config::ExtHeaders, $net_errno);
|
|
|
-// return iconv('GB2312', 'UTF-8', $resp);
|
|
|
+ $url = config::API_URL;
|
|
|
+ $resp = http_post_data($url, $req, config::ExtHeaders, $net_errno);
|
|
|
+ return iconv('GB2312', 'UTF-8', $resp);
|
|
|
}
|
|
|
|
|
|
- private function req_params(int $phone,int $amount, string $order_sn,$action)
|
|
|
+ private function req_params(int $phone,int $amount, string $order_sn)
|
|
|
{
|
|
|
$params['orderId'] = $order_sn;
|
|
|
$params['chargeAcct'] = $phone;
|
|
|
$params['chargeCash'] = $amount;
|
|
|
$params['chargeType'] = 0;
|
|
|
$params['retUrl'] = urlencode(config::NOTIFY_URL);
|
|
|
- $params['action'] = $action;
|
|
|
- $sign = $this->sign($params);
|
|
|
+ $params['action'] = 'CZ';
|
|
|
|
|
|
+ $sign = $this->sign($params);
|
|
|
$req['sign'] = $sign;
|
|
|
$req['agentAccount'] = config::ACCOUNT;
|
|
|
$req['busiBody'] = $params;
|
|
|
-
|
|
|
- $req = json_encode($req);
|
|
|
- return $req;
|
|
|
+ return json_encode($req);
|
|
|
}
|
|
|
|
|
|
public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
|
|
|
{
|
|
|
- $params = $this->req_params($card_no, $amount, $params['order_sn'],'CZ');
|
|
|
-
|
|
|
-
|
|
|
- $resp = $this->url_request($params,'');
|
|
|
+ $req = $this->req_params($card_no, $amount, $params['order_sn']);
|
|
|
|
|
|
+ $resp = http_post_data(config::API_URL, $req, config::ExtHeaders, $net_errno);
|
|
|
+ $resp = iconv('GB2312', 'UTF-8', $resp);
|
|
|
if (empty($resp)) {
|
|
|
return [false, '系统错误', true];
|
|
|
}
|