浏览代码

feihan_fetch

xiaoyu 1 年之前
父节点
当前提交
eb9a7739cf

+ 7 - 0
data/config/xyz/refill.ini.php

@@ -9550,6 +9550,12 @@ $tongka_fetch = ['name' => 'tongka_fetch', 'store_id' => 343, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$feihan_fetch = ['name' => 'feihan_fetch', 'store_id' => 344, 'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 8751, 'price' => 99, 'quality' => 1, 'card_type' => 'third']],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $third_providers = [
     ['name' => 'lingzhthird', 'cfg' => $lingzhthird],
     ['name' => 'jumithird', 'cfg' => $jumithird],
@@ -9575,6 +9581,7 @@ $third_providers = [
     ['name' => 'shuzishijie', 'cfg' => $shuzishijie],
     ['name' => 'piaoyi_oil', 'cfg' => $piaoyi_oil],
     ['name' => 'tongka_fetch', 'cfg' => $tongka_fetch],
+    ['name' => 'feihan_fetch', 'cfg' => $feihan_fetch],
 ];
 $config['third_providers'] = $third_providers;
 

+ 39 - 0
helper/refill/api/xyz/feihan_fetch/RefillCallBack.php

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace refill\feihan_fetch;
+
+require_once(BASE_HELPER_RAPI_PATH . '/feihan_fetch/config.php');
+
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        return true;
+    }
+
+    public function notify($params)
+    {
+        $order_sn = $params['order_sn'];
+        $status = intval($params['status']);
+
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 1) {
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 0) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 61 - 0
helper/refill/api/xyz/feihan_fetch/RefillPhone.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace refill\feihan_fetch;
+
+require_once(BASE_HELPER_RAPI_PATH . '/feihan_fetch/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillThird
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['tel'] = $phone;
+        $params['mch_order_id'] = $order_sn;
+        $params['mchid'] = config::MCHID;
+        $params['price'] = $amount;
+        $params['notify'] = config::NOTIFY_URL;
+        $params['teltype'] = config::operator[$card_type];
+        $params['timeout'] = 50;
+        $params['time'] = time();
+        $params['rand'] = rand(100000,999999);
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        //大面值 直接返回成功
+//        refill\util::send_normal($params['order_sn']);
+        return [true , '',false];
+    }
+
+    public function query($refill_info)
+    {
+        $params['mch_order_id'] = $refill_info['order_sn'];
+        $params['mchid'] = config::MCHID;
+        $content = $params['mchid'] . $params['mch_order_id'] . config::KEY;
+        $params['sign'] = md5($content);
+        $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
+        if ($resp === false) {
+            return [false, '系统错误'];
+        } else {
+            $rand = mt_rand(0,1);
+            return [$rand , ''];
+        }
+    }
+
+    private function sign($params)
+    {
+        $key = config::KEY;
+        $content  = $params['mchid'] . $params['tel'] . $params['mch_order_id'] . $params['price'] . $params['teltype'] . $params['timeout'] . $params['notify'];
+        $content .= $params['time'] . $params['rand'] . $key;
+        return md5($content);
+    }
+}

+ 20 - 0
helper/refill/api/xyz/feihan_fetch/config.php

@@ -0,0 +1,20 @@
+<?php
+
+
+namespace refill\feihan_fetch;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'https://www.baidu.com/';
+    const QUERY_URL = 'https://www.baidu.com/';
+
+    const MCHID = 10019;
+    const KEY = '953b8e10a70ef4e85b77f09448c0e316';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_baidu.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 2,
+        mtopcard\ChinaUnicomCard  => 1,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+}