stanley-king 1 year ago
parent
commit
1679c3fc52
1 changed files with 13 additions and 13 deletions
  1. 13 13
      helper/refill/api/xyz/yezifensheng/RefillPhone.php

+ 13 - 13
helper/refill/api/xyz/yezifensheng/RefillPhone.php

@@ -18,13 +18,14 @@ class RefillPhone extends refill\IRefillPhone
     {
         [$goods_id, $price] = parent::goods($quality, $amount, $card_type, $regin_no, $other);
         if($goods_id <= 0) return [0,0];
-        $key = "{$card_type}-{$amount}-{$regin_no}";
-        $price = config::Price[$key];
-        if (empty($price)) {
-            Log::record("channel cannot find price where name={$this->mName}, goods_id = {$goods_id} card_type={$card_type} amount={$amount} regin_no={$regin_no}", Log::ERR);
-            return [0, 0];
-        } else {
+
+        $key = "$card_type-$amount-$regin_no";
+        if (array_key_exists($key, config::Price)) {
+            $price = config::Price[$key];
             return [$goods_id, ncPriceFormat($price)];
+        } else {
+            Log::record("channel cannot find price where name=$this->mName, goods_id = $goods_id card_type=$card_type amount=$amount regin_no=$regin_no", Log::DEBUG);
+            return [0, 0];
         }
     }
 
@@ -143,8 +144,6 @@ class RefillPhone extends refill\IRefillPhone
     {
         if (!isset($value))
             return true;
-        if ($value === null)
-            return true;
         if (trim($value) === "")
             return true;
 
@@ -157,17 +156,18 @@ class RefillPhone extends refill\IRefillPhone
 
         $body = "";
         $i = 0;
-        foreach ($params as $k => $v) {
-            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+        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=".config::KEY;
 
         return md5($body);