瀏覽代碼

cangbu_high

xiaoyu 3 年之前
父節點
當前提交
169931eda8

+ 70 - 8
data/config/win/refill.ini.php

@@ -3548,14 +3548,75 @@ $baixuan_normal_phone = ['name' => 'baixuan_normal', 'store_id' => 165,'qualitys
 
 $cangbuyd_phone = ['name' => 'cangbuyd', 'store_id' => 166, 'qualitys' => '1',
     'amount' => [
-//        10 => [['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        20 => [['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        500 => [['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile']]
+//        10 => [
+//            ['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7406, 'price' => 9.62, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7407, 'price' => 19.24, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7408, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7409, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7410, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7411, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7412, 'price' => 288.6, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7413, 'price' => 481, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$cangbu_high_phone = ['name' => 'cangbu_high', 'store_id' => 168, 'qualitys' => '3',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7422, 'price' => 9.7, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7422, 'price' => 9.62, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7423, 'price' => 19.4, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7423, 'price' => 19.24, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7424, 'price' => 29.1, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7424, 'price' => 28.86, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7425, 'price' => 48.5, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7425, 'price' => 48.1, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7426, 'price' => 97, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7426, 'price' => 96.2, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7427, 'price' => 194, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7427, 'price' => 192.4, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7427, 'price' => 291, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7427, 'price' => 288.6, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7428, 'price' => 485, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7428, 'price' => 481, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -3689,6 +3750,7 @@ $phone_providers = [
     ['name' => 'baixuan', 'cfg' => $baixuan_phone],
     ['name' => 'baixuan_normal', 'cfg' => $baixuan_normal_phone],
     ['name' => 'cangbuyd', 'cfg' => $cangbuyd_phone],
+    ['name' => 'cangbu_high', 'cfg' => $cangbu_high_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 70 - 8
data/config/xyz/refill.ini.php

@@ -3548,14 +3548,75 @@ $baixuan_normal_phone = ['name' => 'baixuan_normal', 'store_id' => 165,'qualitys
 
 $cangbuyd_phone = ['name' => 'cangbuyd', 'store_id' => 166, 'qualitys' => '1',
     'amount' => [
-//        10 => [['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        20 => [['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        500 => [['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile']]
+//        10 => [
+//            ['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7406, 'price' => 9.62, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7407, 'price' => 19.24, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7408, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7409, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7410, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7411, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7412, 'price' => 288.6, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7413, 'price' => 481, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$cangbu_high_phone = ['name' => 'cangbu_high', 'store_id' => 168, 'qualitys' => '3',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7422, 'price' => 9.7, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7422, 'price' => 9.62, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7423, 'price' => 19.4, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7423, 'price' => 19.24, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7424, 'price' => 29.1, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7424, 'price' => 28.86, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7425, 'price' => 48.5, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7425, 'price' => 48.1, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7426, 'price' => 97, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7426, 'price' => 96.2, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7427, 'price' => 194, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7427, 'price' => 192.4, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7427, 'price' => 291, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7427, 'price' => 288.6, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7428, 'price' => 485, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7428, 'price' => 481, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -3689,6 +3750,7 @@ $phone_providers = [
     ['name' => 'baixuan', 'cfg' => $baixuan_phone],
     ['name' => 'baixuan_normal', 'cfg' => $baixuan_normal_phone],
     ['name' => 'cangbuyd', 'cfg' => $cangbuyd_phone],
+    ['name' => 'cangbu_high', 'cfg' => $cangbu_high_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 70 - 8
data/config/xyzadm/refill.ini.php

@@ -3548,14 +3548,75 @@ $baixuan_normal_phone = ['name' => 'baixuan_normal', 'store_id' => 165,'qualitys
 
 $cangbuyd_phone = ['name' => 'cangbuyd', 'store_id' => 166, 'qualitys' => '1',
     'amount' => [
-//        10 => [['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        20 => [['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile']],
-        30 => [['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile']],
-        50 => [['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile']],
-        100 => [['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile']],
-        200 => [['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile']],
-        300 => [['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile']],
-//        500 => [['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile']]
+//        10 => [
+//            ['goods_id' => 7406, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7406, 'price' => 9.62, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7407, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7407, 'price' => 19.24, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7408, 'price' => 29.1, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7408, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7409, 'price' => 48.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7409, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7410, 'price' => 97, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7410, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7411, 'price' => 194, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7411, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7412, 'price' => 291, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7412, 'price' => 288.6, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7413, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7413, 'price' => 481, 'quality' => 1, 'card_type' => 'chinaunicom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$cangbu_high_phone = ['name' => 'cangbu_high', 'store_id' => 168, 'qualitys' => '3',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7422, 'price' => 9.7, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7422, 'price' => 9.62, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7423, 'price' => 19.4, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7423, 'price' => 19.24, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+        30 => [
+            ['goods_id' => 7424, 'price' => 29.1, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7424, 'price' => 28.86, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        50 => [
+            ['goods_id' => 7425, 'price' => 48.5, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7425, 'price' => 48.1, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        100 => [
+            ['goods_id' => 7426, 'price' => 97, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7426, 'price' => 96.2, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+        200 => [
+            ['goods_id' => 7427, 'price' => 194, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7427, 'price' => 192.4, 'quality' => 3, 'card_type' => 'chinaunicom']
+        ],
+//        300 => [
+//            ['goods_id' => 7427, 'price' => 291, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7427, 'price' => 288.6, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ],
+//        500 => [
+//            ['goods_id' => 7428, 'price' => 485, 'quality' => 3, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7428, 'price' => 481, 'quality' => 3, 'card_type' => 'chinaunicom']
+//        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
@@ -3689,6 +3750,7 @@ $phone_providers = [
     ['name' => 'baixuan', 'cfg' => $baixuan_phone],
     ['name' => 'baixuan_normal', 'cfg' => $baixuan_normal_phone],
     ['name' => 'cangbuyd', 'cfg' => $cangbuyd_phone],
+    ['name' => 'cangbu_high', 'cfg' => $cangbu_high_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

二進制
helper/refill/api/xyz/cangbu_high/APIdoc直充.docx


+ 69 - 0
helper/refill/api/xyz/cangbu_high/RefillCallBack.php

@@ -0,0 +1,69 @@
+<?php
+namespace refill\cangbu_high;
+
+require_once(BASE_HELPER_RAPI_PATH . '/cangbu_high/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            if(false === $this->check_empty($val)) {
+                $content .= "{$key}={$val}&";
+            }
+        }
+        $content .= "key=".config::KEY;
+
+        return md5($content);
+    }
+
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['code']);
+        $order_sn = $params['tmporder'];
+        $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) {
+            $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+            $data['ch_trade_no'] = strtolower($params['orderno']) == 'null' ? '' : $params['orderno'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif ($status === -1) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 144 - 0
helper/refill/api/xyz/cangbu_high/RefillPhone.php

@@ -0,0 +1,144 @@
+<?php
+
+namespace refill\cangbu_high;
+
+require_once(BASE_HELPER_RAPI_PATH . '/cangbu_high/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['customerId'] = config::MCH_ID;
+        $params['timestamp'] = time();
+        $params['orderno'] = $order_sn;
+        $params['itemId'] = config::operator[$card_type];
+        $params['checkItemFacePrice'] = $amount;
+        $params['number'] = $phone;
+        $params['amt'] = 1;
+        $params['notify_url'] = config::NOTIFY_URL;
+        $params['overtime'] = 1;
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($resp['code'] === 1) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['customerId'] = config::MCH_ID;
+        $params['timestamp'] = time();
+        $params['orderno'] = $refill_info['order_sn'];
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+
+            if($resp['code'] === 1)
+            {
+                $status = $resp['data']['status'];
+                if ($status === 2) {
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['data']['officialOrderNo'], 'ch_trade_no' => $resp['data']['agentOrderNo']]);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($status, [0, 1], true)) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $status];
+                }
+                return [true, $order_state];
+            }
+            elseif($resp['code'] === -1 && $resp['msg'] == '没有该订单')
+            {
+                return [true, ORDER_STATE_NOEXIST];
+            }
+            else
+            {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['customerId'] = config::MCH_ID;
+        $params['timestamp'] = time();
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+        if(empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['code'] === 1) {
+                return [true, $resp['data']['balance']];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            if(false === $this->check_empty($val)) {
+                $content .= "{$key}={$val}&";
+            }
+        }
+        $content .= "key=".config::KEY;
+
+        return md5($content);
+    }
+}

+ 3 - 0
helper/refill/api/xyz/cangbu_high/account.txt

@@ -0,0 +1,3 @@
+https://huadan.irecycle.top/
+账户18513846008
+密码123456

+ 22 - 0
helper/refill/api/xyz/cangbu_high/config.php

@@ -0,0 +1,22 @@
+<?php
+
+
+namespace refill\cangbu_high;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'https://api.irecycle.top/queryBuy';
+    const QUERY_URL= 'https://api.irecycle.top/queryBizOrder';
+    const BALANCE_URL= 'https://api.irecycle.top//queryBalance';
+
+    const MCH_ID= '225';
+    const KEY = 'Nh4uHk9DyOtKe2XXECpb4NSDL4pZiG';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_cangbu_high.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'MOBILE',
+        mtopcard\ChinaUnicomCard  => 'UNICOM',
+        mtopcard\ChinaTelecomCard => 'TELECOM'
+    ];
+    const ExtHeaders = ['Content-Type: application/x-www-form-urlencoded' , 'Accept: application/json;charset=UTF-8'];
+}

+ 4 - 0
mobile/callback/refill_cangbu_high.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('cangbu_high',$_POST);
+echo ('SUCCESS');