Browse Source

providers afd qianqianman lingzh haohao card

ayHaru 3 năm trước cách đây
mục cha
commit
10584a3b66

+ 12 - 1
data/config/lingzh/refill.ini.php

@@ -13,9 +13,20 @@ $config['refill_specs'] = [
     'chinatelecom' => $config['refill_phone_specs']
 ];
 
+$haohao_oil = ['name' => 'haohao', 'store_id' => 58,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 140, 'price' => 96.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        200 => [['goods_id' => 141, 'price' => 193.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        300 => [['goods_id' => 142, 'price' => 290.4, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        500 => [['goods_id' => 143, 'price' => 484, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        1000 => [['goods_id' => 144, 'price' => 968, 'quality' => 1, 'card_type' => 'petrochina,sinopec']]
+    ],
+    'period' => [], 'refill_type' => 'api'];
 
 //充值渠道配置表
-$oil_providers = [];
+$oil_providers = [
+    ['name' => 'haohao', 'cfg' => $haohao_oil],
+];
 $config['oil_providers'] = $oil_providers;
 
 

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

@@ -13,9 +13,20 @@ $config['refill_specs'] = [
     'chinatelecom' => $config['refill_phone_specs']
 ];
 
+$haohao_oil = ['name' => 'haohao', 'store_id' => 58,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 140, 'price' => 96.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        200 => [['goods_id' => 141, 'price' => 193.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        300 => [['goods_id' => 142, 'price' => 290.4, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        500 => [['goods_id' => 143, 'price' => 484, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        1000 => [['goods_id' => 144, 'price' => 968, 'quality' => 1, 'card_type' => 'petrochina,sinopec']]
+    ],
+    'period' => [], 'refill_type' => 'api'];
 
 //充值渠道配置表
-$oil_providers = [];
+$oil_providers = [
+    ['name' => 'haohao', 'cfg' => $haohao_oil],
+];
 $config['oil_providers'] = $oil_providers;
 
 
@@ -495,6 +506,36 @@ $weishengyjd_phone = ['name' => 'weishengyjd', 'store_id' => 56, 'qualitys' => '
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+
+$yezi_phone = ['name' => 'yezi', 'store_id' => 57, 'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 132, 'price' => 9.8, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        20 => [
+            ['goods_id' => 133, 'price' => 19.6, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        30 => [
+            ['goods_id' => 134, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        50 => [
+            ['goods_id' => 135, 'price' => 49, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 136, 'price' => 98, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 137, 'price' => 196, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        300 => [
+            ['goods_id' => 138, 'price' => 294, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ],
+        500 => [
+            ['goods_id' => 139, 'price' => 490, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom'],
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
     ['name' => 'baizeyd', 'cfg' => $baizeyd],
     ['name' => 'aming', 'cfg' => $aming_phone],
@@ -514,6 +555,8 @@ $phone_providers = [
     ['name' => 'shengying', 'cfg' => $shengying_phone],
     ['name' => 'amingjdman', 'cfg' => $amingjdman_phone],
     ['name' => 'weishengywt', 'cfg' => $weishengywt_phone],
+    ['name' => 'weishengyjd', 'cfg' => $weishengyjd_phone],
+    ['name' => 'yezi', 'cfg' => $yezi_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

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

@@ -702,6 +702,70 @@ $fengye_phone = ['name' => 'fengye', 'store_id' => 49, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yunsuoyao_phone = ['name' => 'yunsuoyao', 'store_id' => 55, 'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6571, 'price' => 9.58, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6572, 'price' => 19.16, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6573, 'price' => 28.74, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6574, 'price' => 47.9, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6575, 'price' => 95.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6576, 'price' => 191.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6577, 'price' => 287.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6578, 'price' => 479, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$afd_phone = ['name' => 'afd', 'store_id' => 54,'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6563, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6563, 'price' => 9.43, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6564, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6564, 'price' => 18.86, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6565, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6565, 'price' => 28.29, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6566, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6566, 'price' => 47.15, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6567, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6567, 'price' => 94.3, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6568, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6568, 'price' => 188.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6569, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6569, 'price' => 282.9, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6570, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom'],
+            ['goods_id' => 6570, 'price' => 471.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'refill_type' => 'api'];
+
+$qianqianman_phone = ['name' => 'qianqianman', 'store_id' => 53, 'qualitys' => '7',
+    'amount' => [
+        50 => [
+            ['goods_id' => 6560, 'price' => 45.5, 'quality' => 7, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6561, 'price' => 91, 'quality' => 7, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6562, 'price' => 182, 'quality' => 7, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -733,6 +797,9 @@ $phone_providers = [
     ['name' => 'jumikc', 'cfg' => $jumi_phone],
     ['name' => 'qianqian', 'cfg' => $qianqian_phone],
     ['name' => 'fengye', 'cfg' => $fengye_phone],
+//    ['name' => 'yunsuoyao', 'cfg' => $yunsuoyao_phone],
+    ['name' => 'afd', 'cfg' => $afd_phone],
+    ['name' => 'qianqianman', 'cfg' => $qianqianman_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 72 - 0
helper/refill/api/lingzh/haohao/RefillCallBack.php

@@ -0,0 +1,72 @@
+<?php
+namespace refill\haohao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/haohao/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);
+
+        $signature_string = '';
+        foreach ($params as $k => $v) {
+            if (false === $this->check_empty($v)) {
+                $signature_string .= $k . '=' . $v . '&';
+            }
+        }
+        $signature_string .= "key=" . config::KEY;
+
+        return strtoupper(md5($signature_string));
+    }
+
+    private 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['directStatus']);
+        $order_sn = $params['mchOrderNo'];
+        $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 === 5) {
+            $data['ch_trade_no'] = strtolower($params['thirdOrderNo']) == 'null' ? '' : $params['thirdOrderNo'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif (in_array($status, [2,3])) {
+            return [$order_id, false, false,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 74 - 0
helper/refill/api/lingzh/haohao/RefillOil.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace refill\haohao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/haohao/config.php');
+
+use refill;
+use Log;
+class RefillOil extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $card_no, int $card_type, string $order_sn, int $amount)
+    {
+        $params['mchId'] = config::MCH_ID;
+        $params['number'] = $card_no;
+        $params['amount'] = $amount * 100;
+        $params['operator'] = config::operator[$card_type];
+        $params['mchOrderNo'] = $order_sn;
+        $params['notifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $card_type, $params['order_sn'], $amount);
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
+        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'] == 0) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        return [true,''];
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+
+        $signature_string = '';
+        foreach ($params as $k => $v) {
+            if (strlen($v)) {
+                $signature_string .= $k . '=' . $v . '&';
+            }
+        }
+        $signature_string .= "key=" . config::KEY;
+
+        return strtoupper(md5($signature_string));
+    }
+}

+ 18 - 0
helper/refill/api/lingzh/haohao/config.php

@@ -0,0 +1,18 @@
+<?php
+namespace refill\haohao;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://39.109.123.176:9980/api/open/addSupplyNumber';
+
+    const MCH_ID = '467253';
+    const KEY = 'XRKE0WHBSGPTZQDVOUEGTQ0IWYTVYXZG9XS3PW19OGC4YLG7DYUDOHDTGV3K4EOBQDUXR8XSNCIJK0TRMZ1O1STX2VUTMIQDF2LXVQUVRWA5WW68YVYQSEAQSBAER2QD';
+//    const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/lingzh/haohao.php";
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const operator = [
+        mtopcard\PetroChinaCard  => 5,
+        mtopcard\SinopecCard  => 4
+    ];
+    const ExtHeaders = ['Content-Type:application/json; charset=UTF-8'];
+}

BIN
helper/refill/api/lingzh/haohao/对接文档.doc


+ 3 - 0
helper/refill/api/lingzh/haohao/账号.txt

@@ -0,0 +1,3 @@
+订单商后台:http://39.109.123.176:9980
+登录ID:467253
+登录密码:qwe123456

+ 52 - 0
helper/refill/api/xyz/afd/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+namespace refill\afd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/afd/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        //有中文需要转码
+        if(preg_match('/[^\x00-\x80]/',$params['orderid'])){
+            $params['orderid'] =iconv("UTF-8","gb2312",$params['orderid']);
+        }
+        $content  = $params['merchantorderId'] . $params['platformorderid'] . $params['orderid'] . $params['rechargeno'] . $params['amount'];
+        $content .= $params['rechargestate'] . config::MER_ID;
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['rechargestate']);
+        $order_sn = $params['merchantorderId'];
+        $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 === 99) {
+            $data['official_sn'] = strtolower($params['orderid']) == 'null' ? '' : $params['orderid'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 105 - 0
helper/refill/api/xyz/afd/RefillPhone.php

@@ -0,0 +1,105 @@
+<?php
+namespace refill\afd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/afd/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, string $order_sn)
+    {
+        $params['merid'] = config::MER_ID;
+        $params['type'] = 'phone';
+        $params['rechargeno'] = $phone;
+        $params['amount'] = $amount;
+        $params['ts'] = $this->getMillisecond();
+        $params['callbackurl'] = config::NOTIFY_URL;
+        $params['orderid'] = $order_sn;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+        $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
+        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'] === '000') {
+                return [true, $resp['orderno'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['merid'] = config::MER_ID;
+        $params['merchantorderId'] = $refill_info['order_sn'];
+        $params['ts'] = $this->getMillisecond();
+        $content = $params['merid'] . $params['merchantorderId'] . $params['ts'] . config::KEY;
+        $params['sign'] = md5($content);
+        $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif($resp['code'] === '000')
+            {
+                if ($resp['rechargestate'] == 99) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = $resp['orderid'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($resp['rechargestate'] == 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($resp['rechargestate'] , [98,2])) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['rechargestate']];
+                }
+                return [true, $order_state];
+            }
+            else {
+                return [false, $resp['code']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['amount'] . $params['callbackurl'] . $params['merid'] . $params['orderid'] . $params['rechargeno'] . $params['ts'] . $params['type'];
+        $content .= config::KEY;
+        return md5($content);
+    }
+
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function getMillisecond()
+    {
+        $cur = microtime (true);
+        $cur = intval($cur * 1000);
+        return $cur;
+    }
+}

+ 12 - 0
helper/refill/api/xyz/afd/config.php

@@ -0,0 +1,12 @@
+<?php
+namespace refill\afd;
+
+class config
+{
+    const ORDER_URL = 'http://117.24.13.19:7100/home/recharge';
+    const QUERY_URL = 'http://117.24.13.19:7100/home/query';
+
+    const MER_ID = '7012';
+    const KEY = 'bfbe95e2030191aa3ac89a5ae3848241';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_afd.php";
+}

+ 13 - 0
helper/refill/api/xyz/afd/账号信息.txt

@@ -0,0 +1,13 @@
+
+登录地址:http://117.24.13.19:7999/
+登录账户:yezi001
+登录密码:yezi001
+用户编号7012
+
+接口地址:
+下单   http://117.24.13.19:7100/home/recharge
+查单   http://117.24.13.19:7100/home/query
+余额   http://117.24.13.19:7100/home/getbalance
+
+
+秘钥bfbe95e2030191aa3ac89a5ae3848241

BIN
helper/refill/api/xyz/afd/阿凡灯系统接口文档.docx


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

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace refill\qianqianman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/qianqianman/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, false, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

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

@@ -0,0 +1,106 @@
+<?php
+
+namespace refill\qianqianman;
+
+require_once(BASE_HELPER_RAPI_PATH . '/qianqianman/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)
+    {
+        $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);
+
+        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['consumerNo'] = $refill_info['order_sn'];
+        $params['account'] = config::ACCOUNT;
+        $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 $key => $val){
+            $content .= $val;
+        }
+        return sha1($content);
+    }
+}

+ 39 - 0
helper/refill/api/xyz/qianqianman/config.php

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace refill\qianqianman;
+use mtopcard;
+
+class config
+{
+    const ORDER_URL = 'http://112.124.55.235/flow-receiver/fee/recharge';
+    const QUERY_URL = 'http://112.124.55.235/flow-receiver/fee/query/single';
+    const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/qianqianman.php';
+
+    const ACCOUNT = 'yz1788';
+    const KEY = '5ceeda76bdd046179386a7339887a0d2';
+
+    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 AddErrCodes = [
+        '003','004','005','006','007','008','009','010','011','012','013','014','015','016','017','018','019','020','021','022','023','024','025','027','028','098','099'
+    ];
+
+    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'
+    ];
+}

BIN
helper/refill/api/xyz/qianqianman/~$网络科技话费接口充值协议.doc


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 0
helper/refill/api/xyz/qianqianman/琳珠网络科技话费接口充值协议.doc


BIN
helper/refill/api/xyz/qianqianman/琳珠网络科技话费接口状态码详解.docx


+ 3 - 3
helper/statistics/stat_refill.php

@@ -82,7 +82,7 @@ class stat_refill
     {
         $cond = [
             'refill_order.inner_status' => 0,
-            'refill_order.order_time&refill_order.order_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]]
+            'refill_order.notify_time&refill_order.notify_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]]
         ];
 
         $items = Model('')->table('refill_order,vr_order')
@@ -150,7 +150,7 @@ class stat_refill
         $cond = [
             'refill_order.inner_status' => 0,
             'vr_order.order_state' => ORDER_STATE_SUCCESS,
-            'refill_order.order_time&refill_order.order_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
+            'refill_order.notify_time&refill_order.notify_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
         ];
 
         $items = Model('')->table('refill_order,vr_order')
@@ -190,7 +190,7 @@ class stat_refill
         $cond = [
             'refill_order.inner_status' => 0,
             'vr_order.order_state' => ORDER_STATE_SUCCESS,
-            'vr_order.add_time&vr_order.add_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
+            'refill_order.notify_time&refill_order.notify_time' => ['_multi' => true, ['egt', $day_time], ['lt', $day_time + stat_refill::DaySecs]],
         ];
 
         $items = Model('')->table('refill_order,vr_order')

+ 10 - 0
mobile/callback/qianqianman.php

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

+ 4 - 0
mobile/callback/refill_afd.php

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

+ 4 - 0
mobile/callback/refill_yunsuoyao.php

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

+ 4 - 0
racc/callback/lingzh/haohao.php

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

+ 39 - 0
test/TestRefill.php

@@ -379,6 +379,15 @@ class TestRefill extends TestCase
         refill\RefillFactory::instance()->notify('yezi', $params);
     }
 
+    public function testHaohaoOil()
+    {
+        $providers = new refill\haohao\RefillOil([]);
+//        $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
+        $data = '{"amount":"10000","mchId":"467253","mchOrderNo":"11951621246293101589","mobile":"","sign":"8EE6121AA7D640BC58C4C1131E79B3ED","operator":"4","number":"1000111100021211884","thirdOrderNo":"2316032626758635520","directStatus":"5"}';
+        $input = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('haohao',$input);
+    }
+
     public function testZeheng()
     {
         $providers = new refill\zeheng\RefillOil([]);
@@ -519,6 +528,16 @@ class TestRefill extends TestCase
 //        }
     }
 
+    public function testQianqianmanPhone()
+    {
+        $providers = new refill\qianqianman\RefillPhone([]);
+//        $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '72011621236975003462']);
+        $data = '{"orderNo":"F2105171538062539442","status":"019","consumerNo":"72011621236975003462","voucherNo":null,"mobile":"13699279618"}';
+        $input = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('qianqianman',$input);
+    }
+
     public function testRiyingPhone()
     {
         $providers = new refill\riying\RefillPhone([]);
@@ -629,6 +648,26 @@ class TestRefill extends TestCase
         refill\RefillFactory::instance()->notify('fengye',$input);
     }
 
+    public function testYunsuoyaoPhone()
+    {
+        $providers = new refill\yunsuoyao\RefillPhone([]);
+//        $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '58441621240148031464']);
+        $data = '{"orderid":"PAB21051716291937160","sporderid":"58441621240148031464","userid":"10002501","merchantsubmittime":"20210517163911","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.74","sign":"69202C564A6AC83819C1B14F2F5ABDF3"}';
+        $input = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('yunsuoyao',$input);
+    }
+
+    public function testAfdPhone()
+    {
+        $providers = new refill\afd\RefillPhone([]);
+//        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '71001621233525947994']);
+        $data = '{"code":"000","merchantorderId":"71001621233525947994","platformorderid":"aab01693204b95c4df1268313","orderid":"经度110103308082105171438580570638","rechargeno":"18500608333","amount":"50.00","payamount":"47.40000","rechargestate":"99","createtime":"2021-05-17 14:38:29","sign":"62d9af5833e1bf489998a0425107573f"}';
+        $input = json_decode($data, true);
+        refill\RefillFactory::instance()->notify('afd',$input);
+    }
+
     public function testLuqianPhone()
     {
         $providers = new refill\luqian\RefillPhone([]);