xiaoyu 3 лет назад
Родитель
Сommit
d14769ee26

+ 1 - 1
helper/refill/api/xyz/yuanmai/RefillCallBack.php

@@ -34,7 +34,7 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['orderid'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+//            return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
 

+ 8 - 1
helper/refill/api/xyz/yuanmai/RefillPhone.php

@@ -107,6 +107,13 @@ class RefillPhone extends refill\IRefillPhone
         $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
         $val = json_decode(json_encode($xmlstring), true);
 
-        return $val;
+        $result = [];
+        $data = $val['items']['item'];
+        foreach ($data as $attr) {
+            $key = $attr['@attributes']['name'];
+            $value = $attr['@attributes']['value'];
+            $result[$key] = $value;
+        }
+        return $result;
     }
 }

+ 5 - 2
test/TestRefill.php

@@ -412,8 +412,11 @@ class TestRefill extends TestCase
     public function testYuanmaiPhone()
     {
         $providers = new refill\yuanmai\RefillPhone([]);
-//        $resp = $providers->add(18500608331, 5, 10, ['order_sn' => $this->make_sn()]);
-        $resp = $providers->query(['order_sn' => '53631624845651227362', 'ch_trade_no' => '210623174333941000']);
+//        $resp = $providers->add(18500608330, 5, 10, ['order_sn' => $this->make_sn()]);
+        $resp = $providers->query(['order_sn' => '38961624852492322076', 'ch_trade_no' => '210623174333941000']);
+        $data = '{"orderid":"38961624852492322076","status":"2","ordermoney":"10","sign":"61223f4f1ddb982c197cac69df35c2b5","spsno":"SP_012106281154508922"}';
+        $params = json_decode($data, true);
+//        refill\RefillFactory::instance()->notify('yuanmai',$params);
     }
 
     public function testTongluPhone()