|
@@ -13,44 +13,33 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
public function verify($params): bool
|
|
public function verify($params): bool
|
|
{
|
|
{
|
|
$sign = $this->sign($params);
|
|
$sign = $this->sign($params);
|
|
- if ($params['sgn'] == $sign) {
|
|
|
|
|
|
+ if ($params['sign'] == $sign) {
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private function check_empty($value)
|
|
|
|
- {
|
|
|
|
- if (!isset($value))
|
|
|
|
- return true;
|
|
|
|
- if ($value === null)
|
|
|
|
- return true;
|
|
|
|
- if (trim($value) === "")
|
|
|
|
- return true;
|
|
|
|
-
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private function sign($params)
|
|
private function sign($params)
|
|
{
|
|
{
|
|
ksort($params);
|
|
ksort($params);
|
|
|
|
|
|
$app_secret = config::APP_SECRET;
|
|
$app_secret = config::APP_SECRET;
|
|
- $body = $app_secret;
|
|
|
|
- foreach ($params as $k => $v) {
|
|
|
|
- if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
|
|
|
|
- $body .= "{$k}{$v}";
|
|
|
|
|
|
+ $content = $app_secret;
|
|
|
|
+ foreach ($params as $key => $val)
|
|
|
|
+ {
|
|
|
|
+ if(empty($val)){
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+ $content .= "{$key}{$val}";
|
|
}
|
|
}
|
|
-
|
|
|
|
- $body .= "&key=" . $app_secret;
|
|
|
|
- return strtoupper(md5($body));
|
|
|
|
|
|
+ $content .= $app_secret;
|
|
|
|
+ return strtoupper(md5($content));
|
|
}
|
|
}
|
|
|
|
|
|
public function notify($params)
|
|
public function notify($params)
|
|
{
|
|
{
|
|
- $status = intval($params['status']);
|
|
|
|
|
|
+ $status = $params['status'];
|
|
$order_sn = $params['coder_order_sn'];
|
|
$order_sn = $params['coder_order_sn'];
|
|
$order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
|
|
$order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
|
|
if (empty($order_info)) {
|
|
if (empty($order_info)) {
|
|
@@ -63,8 +52,12 @@ class RefillCallBack implements refill\IRefillCallBack
|
|
|
|
|
|
if ($status === 'success') {
|
|
if ($status === 'success') {
|
|
return [$order_id, true, false,true,true];
|
|
return [$order_id, true, false,true,true];
|
|
- } elseif ($status === 2) {
|
|
|
|
|
|
+ }
|
|
|
|
+ elseif ($status === 'fail') {
|
|
return [$order_id, false, true,true,true];
|
|
return [$order_id, false, true,true,true];
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ return [$order_id, false, false,false];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|