|
@@ -520,12 +520,15 @@ class policy extends ProviderManager implements IPolicy
|
|
|
$err_msg = 'fail';
|
|
|
}
|
|
|
|
|
|
- $ctls = ['official_sn' => true,
|
|
|
- 'sms' => false
|
|
|
- ];
|
|
|
-
|
|
|
+ $ctls = ['osn' => true, 'sms' => false];
|
|
|
util::onEventCallback($refill_info, $mch_info, $ctls);
|
|
|
|
|
|
+ if($ctls['osn']) {
|
|
|
+ $osn = $refill_info['official_sn'] ?? "";
|
|
|
+ } else {
|
|
|
+ $osn = "";
|
|
|
+ }
|
|
|
+
|
|
|
$params = [
|
|
|
"mchid" => $refill_info['mchid'],
|
|
|
"order_sn" => $refill_info['mch_order'],
|
|
@@ -535,13 +538,16 @@ class policy extends ProviderManager implements IPolicy
|
|
|
"trade_no" => $refill_info['order_sn'],
|
|
|
"idcard" => $refill_info['idcard'] ?? "",
|
|
|
"card_name" => $refill_info['card_name'] ?? "",
|
|
|
- 'official_sn' => $refill_info['official_sn'] ?? "",
|
|
|
+ 'official_sn' => $osn,
|
|
|
'message' => $err_msg,
|
|
|
"state" => $state];
|
|
|
|
|
|
- [$has_sms,$sms] = $this->sms($refill_info);
|
|
|
- if($has_sms) {
|
|
|
- $params['sms'] = $sms;
|
|
|
+ if($ctls['sms'])
|
|
|
+ {
|
|
|
+ [$has_sms,$sms] = $this->sms($refill_info);
|
|
|
+ if($has_sms) {
|
|
|
+ $params['sms'] = $sms;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$secure_key = $mch_info['secure_key'];
|
|
@@ -552,16 +558,11 @@ class policy extends ProviderManager implements IPolicy
|
|
|
|
|
|
private function sms($refill_info)
|
|
|
{
|
|
|
- global $config;
|
|
|
-
|
|
|
- $mchids = $config['sms_mchids'];
|
|
|
- $mchid = $refill_info['mchid'];
|
|
|
$official_sn = $refill_info['official_sn'] ?? "";
|
|
|
$card_type = $refill_info['card_type'];
|
|
|
$card_no = $refill_info['card_no'];
|
|
|
$amount = intval($refill_info['refill_amount']);
|
|
|
-
|
|
|
- if(in_array($mchid,$mchids) && !empty($official_sn) && $card_type == mtopcard\SinopecCard && !empty($card_no))
|
|
|
+ if(!empty($official_sn) && $card_type == mtopcard\SinopecCard && !empty($card_no))
|
|
|
{
|
|
|
$short_no = substr($card_no,-6);
|
|
|
$ret = preg_match('/\d{4}(?P<month>\d{2})(?P<day>\d{2})(?P<hour>\d{2})(?P<min>\d{2})\d{4}/u', $official_sn, $matches);
|
|
@@ -583,15 +584,15 @@ class policy extends ProviderManager implements IPolicy
|
|
|
foreach ($params as $k => $v) {
|
|
|
if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
|
|
|
if ($i == 0) {
|
|
|
- $body .= "{$k}" . "=" . urlencode($v);
|
|
|
+ $body .= "$k" . "=" . urlencode($v);
|
|
|
} else {
|
|
|
- $body .= "&" . "{$k}" . "=" . urlencode($v);
|
|
|
+ $body .= "&" . "$k" . "=" . urlencode($v);
|
|
|
}
|
|
|
$i++;
|
|
|
}
|
|
|
}
|
|
|
- $body .= "&key={$key}";
|
|
|
- Log::record("notify body={$body}",Log::DEBUG);
|
|
|
+ $body .= "&key=$key";
|
|
|
+ Log::record("notify body=$body", Log::DEBUG);
|
|
|
|
|
|
return md5($body);
|
|
|
}
|