xiaoyu 3 роки тому
батько
коміт
b40d2fdc70

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

@@ -1211,6 +1211,19 @@ $yunlingds_phone = ['name' => 'yunlingds', 'store_id' => 73, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$lingzhman_phone = ['name' => 'lingzhman', 'store_id' => 74, 'qualitys' => '5',
+    'amount' => [
+        10 => [['goods_id' => 6716, 'price' => 9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6717, 'price' => 18, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6718, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6719, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6720, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6721, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6722, 'price' => 270, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6723, 'price' => 450, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1259,7 +1272,8 @@ $phone_providers = [
     ['name' => 'xingzy', 'cfg' => $xingzy_phone],
     ['name' => 'yuanmai', 'cfg' => $yuanmai_phone],
     ['name' => 'langke', 'cfg' => $langke_phone],
-    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone]
+    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone],
+    ['name' => 'lingzhman', 'cfg' => $lingzhman_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -1211,6 +1211,19 @@ $yunlingds_phone = ['name' => 'yunlingds', 'store_id' => 73, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$lingzhman_phone = ['name' => 'lingzhman', 'store_id' => 74, 'qualitys' => '5',
+    'amount' => [
+        10 => [['goods_id' => 6716, 'price' => 9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6717, 'price' => 18, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6718, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6719, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6720, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6721, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6722, 'price' => 270, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6723, 'price' => 450, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1259,7 +1272,8 @@ $phone_providers = [
     ['name' => 'xingzy', 'cfg' => $xingzy_phone],
     ['name' => 'yuanmai', 'cfg' => $yuanmai_phone],
     ['name' => 'langke', 'cfg' => $langke_phone],
-    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone]
+    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone],
+    ['name' => 'lingzhman', 'cfg' => $lingzhman_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -1211,6 +1211,19 @@ $yunlingds_phone = ['name' => 'yunlingds', 'store_id' => 73, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$lingzhman_phone = ['name' => 'lingzhman', 'store_id' => 74, 'qualitys' => '5',
+    'amount' => [
+        10 => [['goods_id' => 6716, 'price' => 9, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6717, 'price' => 18, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6718, 'price' => 27, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6719, 'price' => 45, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6720, 'price' => 90, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6721, 'price' => 180, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6722, 'price' => 270, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6723, 'price' => 450, 'quality' => 5, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -1259,7 +1272,8 @@ $phone_providers = [
     ['name' => 'xingzy', 'cfg' => $xingzy_phone],
     ['name' => 'yuanmai', 'cfg' => $yuanmai_phone],
     ['name' => 'langke', 'cfg' => $langke_phone],
-    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone]
+    ['name' => 'yunlingds', 'cfg' => $yunlingds_phone],
+    ['name' => 'lingzhman', 'cfg' => $lingzhman_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace refill\lingzhman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/lingzhman/config.php');
+
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+       return true;
+    }
+
+    public function notify($params)
+    {
+        $status = $params['status'];
+        $order_sn = $params['consumerNo'];
+
+        $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 === '001') {
+            $data['official_sn'] = strtolower($params['voucherNo']) == 'null' ? '' : $params['voucherNo'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif (in_array($status,config::NotifyErrCodes)) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 106 - 0
helper/refill/api/xyz/lingzhman/RefillPhone.php

@@ -0,0 +1,106 @@
+<?php
+
+namespace refill\lingzhman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/lingzhman/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, string $order_sn)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $order_sn;
+        $params['mobile'] = $phone;
+        $params['timestamp'] = date("YmdHis");
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $params = $this->req_params($card_no, $params['order_sn']);
+        $params['flowCode'] = config::ProductIDS[$card_type][$amount];
+        if (empty($params['flowCode'])) {
+            return [false, '产品编号错误', false];
+        }
+
+        $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);
+
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['status'] === '001') {
+                return [true, $resp['orderNo'], false];
+            } else {
+                return [false, $resp['status'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['consumerNo'] = $refill_info['order_sn'];
+        $params['timestamp'] = date("YmdHis");
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+
+            $status = $resp['status'];
+            if ($status === '001') {
+                $order_state = ORDER_STATE_SUCCESS;
+                $save['official_sn'] = strtolower($resp['voucherNo']) == 'null' ? '' : $resp['voucherNo'];
+                Model('refill_order')->edit($refill_info['order_id'], $save);
+            } elseif (in_array($status,config::QueryErrCodes)) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($status === '002') {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                return [false, $status];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $data['account'] = $params['account'];
+        $data['timestamp'] = $params['timestamp'];
+        $data['secret'] = config::KEY;
+        asort($data);
+        $content = '';
+        foreach ($data as $val){
+            $content .= $val;
+        }
+        return sha1($content);
+    }
+}

+ 35 - 0
helper/refill/api/xyz/lingzhman/config.php

@@ -0,0 +1,35 @@
+<?php
+
+
+namespace refill\lingzhman;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://47.99.65.204/flow-receiver/fee/recharge';
+    const QUERY_URL = 'http://47.99.65.204/flow-receiver/fee/query/single';
+//    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_lingzhman.php';
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const ACCOUNT = 'yzmc';
+    const KEY = 'b225132ca8fc47d98c245fc231623dbb';
+
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard  => [
+            50 => 'CMCCALLn50r', 100 => 'CMCCALLn100r', 200 => 'CMCCALLn200r'
+        ],
+        mtopcard\ChinaUnicomCard  => [
+            50 => 'CUCCALLn50r', 100 => 'CUCCALLn100r', 200 => 'CUCCALLn200r'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            50 => 'CTCCALLn50r', 100 => 'CTCCALLn100r', 200 => 'CTCCALLn200r'
+        ]
+    ];
+
+    const NotifyErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','025','027','028','098','099'
+    ];
+
+    const QueryErrCodes = [
+        '003','004','005','006','007','008','015','016','017','018','019','020','021','022','023','024','025','026','027','028','098','099'
+    ];
+}

+ 34 - 0
helper/refill/api/xyz/lingzhman/椰子慢充.txt

@@ -0,0 +1,34 @@
+http://47.99.65.204/flow-consumer/login.html
+梖瘍	yzmc
+躇鎢	123456
+躇埥	b225132ca8fc47d98c245fc231623dbb
+
+
+
+
+狟等華硊
+http://47.99.65.204/flow-receiver/fee/recharge
+蠶講脤戙華硊
+http://47.99.65.204/flow-receiver/fee/query
+等跺脤戙華硊
+http://47.99.65.204/flow-receiver/fee/query/single
+豻塗脤戙華硊
+http://47.99.65.204/flow-receiver/fee/balance/query
+
+
+痄雄鞣喃莉ⅲ晤鎢		醱硉
+CMCCALLn50r				50	
+CMCCALLn100r			100	
+CMCCALLn200r			200
+
+
+薊籵鞣喃莉ⅲ晤鎢		醱硉
+CUCCALLn50r				50	
+CUCCALLn100r			100
+CUCCALLn200r			200
+
+
+萇陓鞣喃莉ⅲ晤鎢		醱硉
+CTCCALLn50r				50
+CTCCALLn100r			100
+CTCCALLn200r			200

Різницю між файлами не показано, бо вона завелика
+ 3 - 0
helper/refill/api/xyz/lingzhman/话费充值接口协议.doc


+ 1 - 1
helper/refill/api/xyz/tongy/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'];
         

+ 10 - 0
mobile/callback/refill_lingzhman.php

@@ -0,0 +1,10 @@
+<?php
+
+$content = $_SERVER['post_content'];
+
+$inputs = json_decode($content,true);
+foreach ($inputs as $input) {
+    refill\util::push_notify('lingzhman',$input);
+}
+
+echo ('SUCCESS');

+ 17 - 7
test/TestRefill.php

@@ -299,16 +299,16 @@ class TestRefill extends TestCase
 //        $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '690653407667699667', 'order_id' => 248, 'buyer_id' => 52667]);
         $params['UserId'] = '100857';
         $params['ShopId'] = '300000';
-        $params['SysOrderId'] = '21070121300710085700006';
-        $params['OrderId'] = '0677060678490206991511';
+        $params['SysOrderId'] = '21070215141210085700010';
+        $params['OrderId'] = '9241650678554051429291';
         $params['State'] = '5';
-        $params['Timestamp'] = '1625146271363';
-        $params['sign'] = '3C78D29D8EDF5760BD67E4443F3F2DDE';
-        $params['ParValue'] = 50.0000;
+        $params['Timestamp'] = '1625210740472';
+        $params['sign'] = 'C5C4E888A3B678470071CDA6DC31719D';
+        $params['ParValue'] = '100.0000';
         $params['VoucherType'] = '';
         $params['VoucherContent'] = '';
-        $params['CreateTime'] = '2021-07-01 21:30:07';
-        $params['CompleteTime'] = '2021-07-01 21:31:11';
+        $params['CreateTime'] = '2021-07-02 15:14:12';
+        $params['CompleteTime'] = '2021-07-02 15:25:40';
         refill\RefillFactory::instance()->notify('tongy',$params);
     }
 
@@ -452,6 +452,16 @@ class TestRefill extends TestCase
         refill\RefillFactory::instance()->notify('yunlingds',$params);
     }
 
+    public function testLingzhmanPhone()
+    {
+        $providers = new refill\lingzhman\RefillPhone([]);
+//        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '60191625211393862930']);
+        $data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
+        $params = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('lingzhman',$params);
+    }
+
     public function testTongluPhone()
     {
         $providers = new refill\tonglu\RefillPhone([]);