|
@@ -15,7 +15,6 @@ require_once(BASE_HELPER_PATH . '/refill/util.php');
|
|
|
require_once(BASE_HELPER_PATH . '/refill/errcode.php');
|
|
|
|
|
|
use Log;
|
|
|
-use refill\afd\config;
|
|
|
use scope_trace;
|
|
|
use mtopcard;
|
|
|
use QueueClient;
|
|
@@ -81,6 +80,44 @@ class RefillBase
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private function risksn_check($refill_info)
|
|
|
+ {
|
|
|
+ $card_type = intval($refill_info['card_type']);
|
|
|
+ $chk_types = [mtopcard\ChinaMobileCard , mtopcard\ChinaUnicomCard , mtopcard\ChinaTelecomCard];
|
|
|
+
|
|
|
+ if(!in_array($card_type,$chk_types)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $quality = intval($refill_info['quality']);
|
|
|
+ $official_sn = $refill_info['official_sn'];
|
|
|
+
|
|
|
+ if($quality === Quality::Normal && empty($official_sn)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ $start_with = function ($haystack, $needle) {
|
|
|
+ $length = strlen($needle);
|
|
|
+ return (substr($haystack, 0, $length) === $needle);
|
|
|
+ };
|
|
|
+
|
|
|
+ $headers = ['0095','SP','J98','WX'];
|
|
|
+ $spcheker = function () use ($start_with, $headers, $official_sn)
|
|
|
+ {
|
|
|
+ $official_sn = strtoupper($official_sn);
|
|
|
+ foreach ($headers as $header)
|
|
|
+ {
|
|
|
+ if ($start_with($official_sn, $header)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
+ return $spcheker();
|
|
|
+ }
|
|
|
+
|
|
|
private function proc_notify($order_id, $success, $can_try, $chname, $input = [])
|
|
|
{
|
|
|
$mod_order = Model('vr_order');
|
|
@@ -127,6 +164,13 @@ class RefillBase
|
|
|
$mchid = intval($refill_info['mchid']);
|
|
|
$mch_order = $refill_info['mch_order'];
|
|
|
|
|
|
+ if($success && $this->risksn_check($refill_info)) {
|
|
|
+ $tran->commit();
|
|
|
+ $params = ['store_id' => $order_info['store_id'], 'channel_name' => $refill_info['channel_name'], 'order_sn' => $refill_info['order_sn'], 'order_id' => $refill_info['order_id']];
|
|
|
+ QueueClient::async_push("OnRiskSN", $params, 1);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
$period = time() - intval($refill_info['commit_time']);
|
|
|
util::monitor_notify($chname,$spec,$card_type,$refill_info['channel_amount'],$period,$success);
|
|
|
|
|
@@ -588,42 +632,6 @@ class RefillBase
|
|
|
return ($api_pay_amount == ncPriceFormat(0.0000));
|
|
|
}
|
|
|
|
|
|
- private function risksn_check($refill_info,$order_info)
|
|
|
- {
|
|
|
- $start_with = function ($haystack, $needle) {
|
|
|
- $length = strlen($needle);
|
|
|
- return (substr($haystack, 0, $length) === $needle);
|
|
|
- };
|
|
|
-
|
|
|
- $spcheker = function ($refill_info) use($start_with)
|
|
|
- {
|
|
|
- $official_sn = $refill_info['official_sn'];
|
|
|
- $card_type = intval($refill_info['card_type']);
|
|
|
-
|
|
|
- if(empty($official_sn)) return false;
|
|
|
-
|
|
|
- $official_sn = strtoupper($official_sn);
|
|
|
- if($start_with($official_sn,'0095')) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- elseif($start_with($official_sn,'SP')) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- elseif($start_with($official_sn,'J98')) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- elseif($start_with($official_sn,'WX')) {
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- };
|
|
|
-
|
|
|
- if($spcheker($refill_info)) {
|
|
|
- QueueClient::async_push("OnRiskSN", ['store_id' => $order_info['store_id'],'channel_name' => $refill_info['channel_name']], 1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public function notify_merchant($order_id,$manual)
|
|
|
{
|
|
|
if ($order_id <= 0) {
|