xiaoyu 3 tahun lalu
induk
melakukan
1ac3791318

+ 47 - 1
data/config/win/refill.ini.php

@@ -1626,6 +1626,51 @@ $cangbukami_phone = ['name' => 'cangbukami', 'store_id' => 83, 'qualitys' => '3'
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$sialan_phone = ['name' => 'sialan', 'store_id' => 94, 'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6851, 'price' => 10.02, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6851, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6851, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6852, 'price' => 20.04, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6852, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6852, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6853, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6854, 'price' => 50, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6855, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6855, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6855, 'price' => 100, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6856, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6856, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6856, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6857, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6857, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6857, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6858, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6858, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6858, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1691,7 +1736,8 @@ $phone_providers = [
     ['name' => 'hongxudagy996', 'cfg' => $hongxudagy996_phone],
     ['name' => 'bingdht', 'cfg' => $bingdht_phone],
     ['name' => 'yuecheng', 'cfg' => $yuecheng_phone],
-    ['name' => 'cangbukami', 'cfg' => $cangbukami_phone]
+    ['name' => 'cangbukami', 'cfg' => $cangbukami_phone],
+    ['name' => 'sialan', 'cfg' => $sialan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 60 - 1
data/config/xyz/refill.ini.php

@@ -1614,6 +1614,63 @@ $yuecheng_phone = ['name' => 'yuecheng', 'store_id' => 93, 'qualitys' => '2',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$cangbukami_phone = ['name' => 'cangbukami', 'store_id' => 83, 'qualitys' => '3',
+    'amount' => [
+        20 => [['goods_id' => 6770, 'price' => 19.08, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        30 => [['goods_id' => 6771, 'price' => 28.62, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 6772, 'price' => 47.7, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 6773, 'price' => 95.4, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 6774, 'price' => 190.8, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 6775, 'price' => 286.2, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 6776, 'price' => 477, 'quality' => 3, 'card_type' => 'chinaunicom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$sialan_phone = ['name' => 'sialan', 'store_id' => 94, 'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6851, 'price' => 10.02, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6851, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6851, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6852, 'price' => 20.04, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6852, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6852, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6853, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6854, 'price' => 50, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6855, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6855, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6855, 'price' => 100, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6856, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6856, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6856, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6857, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6857, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6857, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6858, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6858, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6858, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1678,7 +1735,9 @@ $phone_providers = [
     ['name' => 'hongxudayz996', 'cfg' => $hongxudayz996_phone],
     ['name' => 'hongxudagy996', 'cfg' => $hongxudagy996_phone],
     ['name' => 'bingdht', 'cfg' => $bingdht_phone],
-    ['name' => 'yuecheng', 'cfg' => $yuecheng_phone]
+    ['name' => 'yuecheng', 'cfg' => $yuecheng_phone],
+    ['name' => 'cangbukami', 'cfg' => $cangbukami_phone],
+    ['name' => 'sialan', 'cfg' => $sialan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 60 - 1
data/config/xyzadm/refill.ini.php

@@ -1614,6 +1614,63 @@ $yuecheng_phone = ['name' => 'yuecheng', 'store_id' => 93, 'qualitys' => '2',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$cangbukami_phone = ['name' => 'cangbukami', 'store_id' => 83, 'qualitys' => '3',
+    'amount' => [
+        20 => [['goods_id' => 6770, 'price' => 19.08, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        30 => [['goods_id' => 6771, 'price' => 28.62, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        50 => [['goods_id' => 6772, 'price' => 47.7, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 6773, 'price' => 95.4, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        200 => [['goods_id' => 6774, 'price' => 190.8, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        300 => [['goods_id' => 6775, 'price' => 286.2, 'quality' => 3, 'card_type' => 'chinaunicom']],
+        500 => [['goods_id' => 6776, 'price' => 477, 'quality' => 3, 'card_type' => 'chinaunicom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$sialan_phone = ['name' => 'sialan', 'store_id' => 94, 'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6851, 'price' => 10.02, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6851, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6851, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6852, 'price' => 20.04, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 6852, 'price' => 9.93, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6852, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6853, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6853, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6854, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6854, 'price' => 50, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6855, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6855, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6855, 'price' => 100, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6856, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6856, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6856, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6857, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6857, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6857, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6858, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6858, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6858, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1678,7 +1735,9 @@ $phone_providers = [
     ['name' => 'hongxudayz996', 'cfg' => $hongxudayz996_phone],
     ['name' => 'hongxudagy996', 'cfg' => $hongxudagy996_phone],
     ['name' => 'bingdht', 'cfg' => $bingdht_phone],
-    ['name' => 'yuecheng', 'cfg' => $yuecheng_phone]
+    ['name' => 'yuecheng', 'cfg' => $yuecheng_phone],
+    ['name' => 'cangbukami', 'cfg' => $cangbukami_phone],
+    ['name' => 'sialan', 'cfg' => $sialan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 55 - 0
helper/refill/api/xyz/sialan/RefillCallBack.php

@@ -0,0 +1,55 @@
+<?php
+namespace refill\sialan;
+
+require_once(BASE_HELPER_RAPI_PATH . '/sialan/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)
+    {
+        ksort($params);
+        $body = "";
+        foreach ($params as $k => $v) {
+            $body .= "{$k}{$v}";
+        }
+        $body .= config::CPKEY;
+        return md5($body);
+    }
+
+    public function notify($params)
+    {
+        $status = $params['status'];
+        $order_sn = $params['ret_para'];
+        $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 == 'success') {
+            $data['official_sn'] = strtolower($params['sz_order_no']) == 'null' ? '' : $params['sz_order_no'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status == 'failed') {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 127 - 0
helper/refill/api/xyz/sialan/RefillPhone.php

@@ -0,0 +1,127 @@
+<?php
+
+namespace refill\sialan;
+
+require_once(BASE_HELPER_RAPI_PATH . '/sialan/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['cpid'] = config::CPID;
+        $params['create_time'] = date("YmdHis");
+        $params['mobile'] = $phone;
+        $params['type'] = 1;
+        $params['product_id'] = config::product_id[$card_type][$amount];
+        $params['amount'] = $amount;
+        $params['op'] = config::operator[$card_type];
+        $params['ret_para'] = $order_sn;
+
+        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, 'GET', false, [], $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            $status = $resp['status'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($status == 0) {
+                return [true, $resp['order_no'], false];
+            } elseif (in_array($status, config::ERR_NO)) {
+                return [false, $resp['msg'], false];
+            } elseif (in_array($status, [-10010, -10000, -999])) {
+                $net_errno = "HTTP-{$status}";
+                return [false, $resp['msg'], false];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['cpid'] = config::CPID;
+        $params['order_no'] = $refill_info['order_sn'];
+        $params['mobile'] = $refill_info['card_no'];
+        $params['create_time'] = date("YmdHis");
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params, 'GET', false, []);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp))
+            {
+                return [false, '网络错误'];
+            }
+            else
+            {
+                $status = $resp['status'];
+                if ($status == 0)
+                {
+                    $order_status = $resp['data'];
+                    if ($order_status == 'success') {
+                        $updata['official_sn'] = $resp['operator_serial_number'];
+                        Model('refill_order')->edit($refill_info['order_id'], $updata);
+                        $order_state = ORDER_STATE_SUCCESS;
+                    } elseif ($order_status == 'failed') {
+                        $order_state = ORDER_STATE_CANCEL;
+                    } elseif ($order_status == 'untreated') {
+                        $order_state = ORDER_STATE_SEND;
+                    } else {
+                        return [false, $resp['msg']];
+                    }
+
+                    return [true, $order_state];
+                }
+                elseif ($status == -10013) {
+                    return [true, ORDER_STATE_NOEXIST];
+                }
+                else {
+                    return [false, $resp['msg']];
+                }
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+        $body = "";
+        foreach ($params as $k => $v) {
+            $body .= "{$k}{$v}";
+        }
+        $body .= config::CPKEY;
+        return md5($body);
+    }
+}

+ 11 - 0
helper/refill/api/xyz/sialan/account.txt

@@ -0,0 +1,11 @@
+下单接口:http://39.98.234.165/api/do
+查单接口:http://39.98.234.165/api/queryorder
+余额接口:http://39.98.234.165/api/querybalance
+
+登录地址:http://39.98.234.165
+帐号:GYYZ
+密码:123456
+CPID:39780
+CPKEY:966cbd556c90ae75d  
+
+https://docs.qq.com/doc/DQmdubmxCdXp6bkxu 对接文档

+ 56 - 0
helper/refill/api/xyz/sialan/config.php

@@ -0,0 +1,56 @@
+<?php
+
+
+namespace refill\sialan;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://39.98.234.165/api/do';
+    const QUERY_URL = 'http://39.98.234.165/api/queryorder';
+
+    const CPID = '39780';
+    const CPKEY = '966cbd556c90ae75d';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_sialan.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const product_id = [
+        mtopcard\ChinaMobileCard  => [
+            10  => 20001,
+            20  => 20002,
+            30  => 20003,
+            50  => 20004,
+            100  => 20005,
+            200  => 20006,
+            300  => 20007,
+            500  => 20008,
+        ],
+        mtopcard\ChinaUnicomCard  => [
+            10  => 20009,
+            20  => 20010,
+            30  => 20011,
+            50  => 20012,
+            100  => 20013,
+            200  => 20014,
+            300  => 20015,
+            500  => 20016,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            10  => 20017,
+            20  => 20018,
+            30  => 20019,
+            50  => 20020,
+            100  => 20021,
+            200  => 20022,
+            300  => 20023,
+            500  => 20024,
+        ]
+    ];
+
+    const ERR_NO = [
+        -10001,-10002,-10003,-10004,-10013,-10005,-10006,-10007,-10008,-10009,-10011,-10012,-10015,-10016
+    ];
+}

+ 6 - 0
mobile/callback/refill_sialan.php

@@ -0,0 +1,6 @@
+<?php
+refill\util::push_notify('sialan',$_POST);
+
+$reponse = ["status" => "success"];
+$body = json_encode($reponse);
+echo($body);

+ 10 - 0
test/TestRefill.php

@@ -523,6 +523,16 @@ class TestRefill extends TestCase
 //        refill\RefillFactory::instance()->notify('tonglu',$params);
     }
 
+    public function testSialan()
+    {
+        $providers = new refill\sialan\RefillPhone([]);
+//        $resp = $providers->add(13699279618, 4, 10, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '79651627436983840352', 'card_no' => 13699279618]);
+        $body = '{"cpid":"39780","order_no":"21072809494539780728903528","mobile":"13699279618","amount":"10","status":"success","sz_order_no":"2021072822001158391454773955","ret_para":"79651627436983840352","sign":"aa7e8a2e589660e98319c5546cb432fa"}';
+        $params = json_decode($body, true);
+        refill\RefillFactory::instance()->notify('sialan', $params);
+    }
+
     public function testAmingjd()
     {
 //        $providers = new refill\amingjd\RefillPhone([]);