stanley-king пре 1 година
родитељ
комит
47472ac7a7

+ 2 - 1
core/framework/libraries/cache.php

@@ -18,7 +18,8 @@ class Cache
 	 * @param unknown_type $args
 	 * @return unknown
 	 */
-	public function connect($type,$args = array()){
+	public function connect($type,$args = array())
+    {
 		if (empty($type)) $type = C('cache_open') ? 'redis' : 'file';
 		$type = strtolower($type);
 		$class = ucwords($type);

+ 13 - 1
data/logic/queue.logic.php

@@ -1467,7 +1467,7 @@ class queueLogic
             $mod_refill = Model('refill_order');
             $mod_except = Model('refill_exception');
 
-            $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
+            $order_info  = $mod_order->getOrderInfo(['order_id' => $order_id]);
             $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id]);
 
             $order_sn = $refill_info['order_sn'];
@@ -1587,4 +1587,16 @@ class queueLogic
             return callback(true, "OnRefillSuccess official_sn OK.");
         }
     }
+
+    public function QueryByOnlineRefund($params)
+    {
+        $order_id = intval($params['order_id'] ?? 0);
+        if($order_id <= 0) {
+            return callback(true, "Order id is nothing.");
+        }
+
+    }
+
+
+
 }

+ 3 - 0
helper/refill/api/xyz/by_online/RefillCallBack.php

@@ -4,6 +4,8 @@ namespace refill\by_online;
 require_once(BASE_HELPER_RAPI_PATH . '/by_online/config.php');
 
 use refill;
+use QueueClient;
+
 class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
@@ -31,6 +33,7 @@ class RefillCallBack implements refill\IRefillCallBack
         if ($status === 7) {
             $data['official_sn'] = strtolower($params['charge_id']) == 'null' ? '' : $params['charge_id'];
             Model('refill_order')->edit($order_id, $data);
+            QueueClient::async_push("QueryByOnlineRefund", ['order_id' => $order_id], 3600);
             return [$order_id, true, false, true];
         } elseif (in_array($status, [3, 4, 6], true)) {
             return [$order_id, false, true, true];

+ 22 - 0
helper/refill/api/xyz/by_online/RefillPhone.php

@@ -6,6 +6,7 @@ require_once(BASE_HELPER_RAPI_PATH . '/by_online/config.php');
 
 use refill;
 use Log;
+use Cache;
 
 class RefillPhone extends refill\IRefillPhone
 {
@@ -37,6 +38,10 @@ class RefillPhone extends refill\IRefillPhone
             return [false, '省份获取错误', false];
         }
 
+        if($this->exist($card_no)) {
+            return [false, '今日已经提交过', false];
+        }
+
         $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn'], $regin_no);
         $sign = config::sign($params);
         $params['sign'] = $sign;
@@ -127,4 +132,21 @@ class RefillPhone extends refill\IRefillPhone
             }
         }
     }
+
+    private function exist($card_no)
+    {
+        $ins = Cache::getInstance('cacheredis');
+        $today = strtotime(date('Ymd',time()));
+
+        $name = "unique_tongfu_{$today}";
+        $key = "$card_no";
+
+        $value = $ins->hget($name,'',$key);
+        if($value === false) {
+            $ins->hset($name, '', [$key=> 1]);
+            return false;
+        } else {
+            return true;
+        }
+    }
 }