소스 검색

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

stanley-king 1 년 전
부모
커밋
3fdaef35f5

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

@@ -10785,6 +10785,51 @@ $yeyepcthree_phone = ['name' => 'yeyepcthree', 'store_id' => 401, 'qualitys' =>
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yeye666cd_phone = ['name' => 'yeye666cd', 'store_id' => 402, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 9180, 'price' => 10, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9180, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9180, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 9181, 'price' => 20, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9181, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9181, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 9182, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9182, 'price' => 30, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9182, 'price' => 30, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 9183, 'price' => 50, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9183, 'price' => 50, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9183, 'price' => 50, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 9184, 'price' => 100, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9184, 'price' => 100, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9184, 'price' => 100, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 9185, 'price' => 200, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9185, 'price' => 200, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9185, 'price' => 200, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 9186, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9186, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9186, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 9187, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9187, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9187, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_p hone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -11106,6 +11151,7 @@ $phone_providers = [
     ['name' => 'taoxun', 'cfg' => $taoxun_phone],
     ['name' => 'youshilian_sec', 'cfg' => $youshilian_sec_phone],
     ['name' => 'yeyepcthree', 'cfg' => $yeyepcthree_phone],
+    ['name' => 'yeye666cd', 'cfg' => $yeye666cd_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

BIN
helper/refill/api/xyz/guochuang/20240313_yd_liaoning.png


BIN
helper/refill/api/xyz/guochuang/20240314_dx_shanxi.png


BIN
helper/refill/api/xyz/guochuang/20240314_yd_liaoning.jpg


+ 2 - 2
helper/refill/api/xyz/guochuang/config.php

@@ -64,7 +64,7 @@ class config
     const Price = [
         //移动
         "4-10-2" => 10.28, "4-20-2" => 20.56, "4-30-2" => 30.84, "4-50-2" => 50.3, "4-100-2" => 100.3, "4-200-2" => 200.6, "4-300-2" => 300.9, "4-500-2" => 501.5,//天津 2
-        "4-10-6" => 9.66, "4-20-6" => 19.32, "4-30-6" => 28.98, "4-50-6" => 48.3, "4-100-6" => 96.6, "4-200-6" => 193.2, "4-300-6" => 289.8, "4-500-6" => 483,//辽宁 6
+        "4-10-6" => 9.645, "4-20-6" => 19.29, "4-30-6" => 28.935, "4-50-6" => 48.225, "4-100-6" => 96.45, "4-200-6" => 192.9, "4-300-6" => 289.35, "4-500-6" => 482.25,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 9.98, "4-20-8" => 19.96, "4-30-8" => 29.94, "4-50-8" => 49.9, "4-100-8" => 99.8, "4-200-8" => 199.6, "4-300-8" => 299.4, "4-500-8" => 499,//黑龙江 8
         "4-10-29" => 9.89, "4-20-29" => 19.78, "4-30-29" => 29.67, "4-50-29" => 49.45, "4-100-29" => 98.9, "4-200-29" => 197.8, "4-300-29" => 296.7, "4-500-29" => 494.5,//青海 29
@@ -98,7 +98,7 @@ class config
         "5-20-23" => 20.08, "5-30-23" => 30.12, "5-50-23" => 50.2, "5-100-23" => 100.4, "5-200-23" => 200.8, "5-300-23" => 301.2, "5-500-23" => 502,//四川 23
         "5-10-31" => 10.22, "5-20-31" => 20.22, "5-30-31" => 30.24, "5-50-31" => 50.25, "5-100-31" => 100.3, "5-200-31" => 200.4, "5-300-31" => 300.6, "5-500-31" => 501,//新疆 31
         //电信
-        "6-10-27" => 10.01, "6-20-27" => 20.02, "6-30-27" => 30.03, "6-50-27" => 50.05, "6-100-27" => 100.1, "6-200-27" => 200.2, "6-300-27" => 300.3, "6-500-27" => 501.5,//陕西 27
+        "6-10-27" => 10.15, "6-20-27" => 20.18, "6-30-27" => 30.21, "6-50-27" => 50.25, "6-100-27" => 100.45, "6-200-27" => 200.6, "6-300-27" => 300.9, "6-500-27" => 501.5,//陕西 27
         "6-10-4" => 9.935, "6-20-4" => 19.87, "6-30-4" => 29.805, "6-50-4" => 49.675, "6-100-4" => 99.35, "6-200-4" => 198.7, "6-300-4" => 298.05, "6-500-4" => 496.75,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.22, "6-20-15" => 20.24, "6-30-15" => 30.27, "6-50-15" => 50.3, "6-100-15" => 100.4, "6-200-15" => 200.4, "6-300-15" => 300.6, "6-500-15" => 501,//山东 15

+ 13 - 0
helper/refill/api/xyz/yeye666cd/API.MD

@@ -0,0 +1,13 @@
+## YY椰椰-普充11号
+
+### 机构账号
+- 账号:yeye666cd
+- 密码:1ic_iice
+- https://ylweb.xyzshops.cn/merchant/#/login
+
+### 店铺账号
+- yeye666cd
+- yeye666cd67890
+
+### 密钥
+> 0eaa1afcd8aaf1b3bd3c146e530a9bd9

+ 76 - 0
helper/refill/api/xyz/yeye666cd/RefillCallBack.php

@@ -0,0 +1,76 @@
+<?php
+namespace refill\yeye666cd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yeye666cd/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;
+        }
+    }
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+
+        $body = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+                if ($i == 0) {
+                    $body .= "{$k}" . "=" . urlencode($v);
+                } else {
+                    $body .= "&" . "{$k}" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        $body .= "&key=".config::KEY;
+        return md5($body);
+    }
+
+    public function notify($params)
+    {
+        $status = $params['state'];
+        $order_sn = $params['order_sn'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+        if ($status === 'SUCCESS') {
+            $data['ch_trade_no'] = $params['trade_no'];
+            $data['official_sn'] = strtolower($params['official_sn']) == 'null' ? '' : $params['official_sn'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 'CANCEL') {
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['trade_no']]);
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 161 - 0
helper/refill/api/xyz/yeye666cd/RefillPhone.php

@@ -0,0 +1,161 @@
+<?php
+
+namespace refill\yeye666cd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yeye666cd/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['act'] = 'refill';
+        $params['op'] = 'add';
+        $params['mchid'] = config::MCH_ID;
+        $params['cardno'] = $phone;
+        $params['amount'] = $amount;
+        $params['order_sn'] = $order_sn;
+        $params['notifyurl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $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 , [] , $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'] === 200) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['message'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['act'] = 'refill';
+        $params['op'] = 'query';
+        $params['mchid'] = config::MCH_ID;
+        $params['order_sn'] = $refill_info['order_sn'];
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST');
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] === 200)
+            {
+                $data = $resp['datas'];
+                if ($data['order_state'] == '40') {
+                    $save['ch_trade_no'] = $data['trade_no'];
+                    $save['official_sn'] = strtolower($resp['official_sn']) == 'null' ? '' : $resp['official_sn'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($data['order_state'] === '0') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $data['trade_no']]);
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($data['order_state'], ['10', '20', '30', '50'], true)) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['message']];
+                }
+                return [true, $order_state];
+            }
+            elseif ($resp['code'] === 202 && (time() - $refill_info['commit_time'] >= 600))
+            {
+                return [true, ORDER_STATE_NOEXIST];
+            }
+            else
+            {
+                return [false, $resp['message']];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['act'] = 'refill';
+        $params['op'] = 'balance';
+        $params['mchid'] = config::MCH_ID;
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST');
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['code'] === 200) {
+                return [true, $resp['datas']['balance']];
+            } else {
+                return [false, $resp['message']];
+            }
+        }
+    }
+
+    protected function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+
+        $body = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+                if ($i == 0) {
+                    $body .= "{$k}" . "=" . urlencode($v);
+                } else {
+                    $body .= "&" . "{$k}" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        $body .= "&key=".config::KEY;
+
+        return md5($body);
+    }
+}

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

@@ -0,0 +1,12 @@
+<?php
+
+namespace refill\yeye666cd;
+
+class config
+{
+    const ORDER_URL = 'https://ylapi.xyzshops.cn/mobile/index.php';
+
+    const MCH_ID = 10388;
+    const KEY = '0eaa1afcd8aaf1b3bd3c146e530a9bd9';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yeye666cd.php";
+}

+ 2 - 2
helper/refill/api/yl/guochuang/config.php

@@ -64,7 +64,7 @@ class config
     const Price = [
         //移动
         "4-10-2" => 10.28, "4-20-2" => 20.56, "4-30-2" => 30.84, "4-50-2" => 50.3, "4-100-2" => 100.3, "4-200-2" => 200.6, "4-300-2" => 300.9, "4-500-2" => 501.5,//天津 2
-        "4-10-6" => 9.66, "4-20-6" => 19.32, "4-30-6" => 28.98, "4-50-6" => 48.3, "4-100-6" => 96.6, "4-200-6" => 193.2, "4-300-6" => 289.8, "4-500-6" => 483,//辽宁 6
+        "4-10-6" => 9.645, "4-20-6" => 19.29, "4-30-6" => 28.935, "4-50-6" => 48.225, "4-100-6" => 96.45, "4-200-6" => 192.9, "4-300-6" => 289.35, "4-500-6" => 482.25,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 9.98, "4-20-8" => 19.96, "4-30-8" => 29.94, "4-50-8" => 49.9, "4-100-8" => 99.8, "4-200-8" => 199.6, "4-300-8" => 299.4, "4-500-8" => 499,//黑龙江 8
         "4-10-29" => 9.89, "4-20-29" => 19.78, "4-30-29" => 29.67, "4-50-29" => 49.45, "4-100-29" => 98.9, "4-200-29" => 197.8, "4-300-29" => 296.7, "4-500-29" => 494.5,//青海 29
@@ -98,7 +98,7 @@ class config
         "5-20-23" => 20.08, "5-30-23" => 30.12, "5-50-23" => 50.2, "5-100-23" => 100.4, "5-200-23" => 200.8, "5-300-23" => 301.2, "5-500-23" => 502,//四川 23
         "5-10-31" => 10.22, "5-20-31" => 20.22, "5-30-31" => 30.24, "5-50-31" => 50.25, "5-100-31" => 100.3, "5-200-31" => 200.4, "5-300-31" => 300.6, "5-500-31" => 501,//新疆 31
         //电信
-        "6-10-27" => 10.01, "6-20-27" => 20.02, "6-30-27" => 30.03, "6-50-27" => 50.05, "6-100-27" => 100.1, "6-200-27" => 200.2, "6-300-27" => 300.3, "6-500-27" => 501.5,//陕西 27
+        "6-10-27" => 10.15, "6-20-27" => 20.18, "6-30-27" => 30.21, "6-50-27" => 50.25, "6-100-27" => 100.45, "6-200-27" => 200.6, "6-300-27" => 300.9, "6-500-27" => 501.5,//陕西 27
         "6-10-4" => 9.935, "6-20-4" => 19.87, "6-30-4" => 29.805, "6-50-4" => 49.675, "6-100-4" => 99.35, "6-200-4" => 198.7, "6-300-4" => 298.05, "6-500-4" => 496.75,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.22, "6-20-15" => 20.24, "6-30-15" => 30.27, "6-50-15" => 50.3, "6-100-15" => 100.4, "6-200-15" => 200.4, "6-300-15" => 300.6, "6-500-15" => 501,//山东 15

+ 4 - 0
mobile/callback/refill_yeye666cd.php

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

+ 6 - 0
test/TestRefill.php

@@ -6016,6 +6016,12 @@ class TestRefill extends TestCase
         $resp = $provider->balance();
     }
 
+    public function testyeye666cd()
+    {
+        $provider = $this->getProvider('yeye666cd');
+        $resp = $provider->balance();
+    }
+
 }