stanley-king 4 年 前
コミット
005fc5629c

+ 3 - 5
admin/control/merchant.php

@@ -337,17 +337,15 @@ class merchantControl extends SystemControl
                 }
             }
 
-            if(empty($inserts)) {
-                showMessage('操作成功', 'index.php?act=merchant&op=merchant');
-            }
-
             try {
                 $model_merchant = Model('merchant');
                 $trans = new trans_wapper($model_merchant, __METHOD__);
                 //删除旧费率
                 $model_merchant->delPrices($mchid,$quality);
                 //更新新费率
-                $model_merchant->insertPrices($inserts);
+                if(!empty($inserts)) {
+                    $model_merchant->insertPrices($inserts);
+                }
                 $trans->commit();
                 showMessage('操作成功', 'index.php?act=merchant&op=merchant');
             } catch (Exception $e) {

+ 2 - 2
admin/templates/default/refill.order.index.php

@@ -222,8 +222,8 @@
             <th class="align-center">商家单号</th>
             <th class="align-center">渠道单号</th>
             <th class="align-center">渠道名称</th>
-            <th class="align-center">queue</th>
-            <th class="align-center">org_que</th>
+            <th class="align-center">质量</th>
+            <th class="align-center">初始质量</th>
             <th class="align-center">扣款金额</th>
             <th class="align-center"><?php echo $lang['nc_handle']; ?></th>
         </tr>

+ 1 - 1
data/config/win/base.ini.php

@@ -12,7 +12,7 @@ define('SERVER_TYPE','panda');
 define('CROSS_DOAMIN',true);
 define('COOKIE_DOMAIN','192.168.1.195');
 define('COMPANY_NAME', 'LZKJ_COMPANY');
-define('NET_IP','222.130.242.243');
+define('NET_IP','125.33.203.108');
 
 $SRV_HOST = 'http://192.168.1.195';
 $REMOTE_IMG_HOST = $SRV_HOST;

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

@@ -343,6 +343,56 @@ $xc_phone = ['name' => 'xc', 'store_id' => 34, 'qualitys' => '4',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$xunyin_phone = ['name' => 'xunyin', 'store_id' => 35,'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6438, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6438, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6439, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6439, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6440, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6440, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6441, 'price' => 50, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6441, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6442, 'price' => 100, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6442, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6443, 'price' => 200, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6443, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6444, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6444, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6445, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6445, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
+    'amount' => [
+        10 => [['goods_id' => 6446, 'price' => 9.35, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6447, 'price' => 18.7, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6448, 'price' => 28.05, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6449, 'price' => 46.75, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6450, 'price' => 93.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6451, 'price' => 187, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6452, 'price' => 280.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6453, 'price' => 467.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -359,6 +409,8 @@ $phone_providers = [
     ['name' => 'tongy', 'cfg' => $tongy_phone],
     ['name' => 'weiyi', 'cfg' => $weiyi_phone],
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
-    ['name' => 'xc', 'cfg' => $xc_phone]
+    ['name' => 'xc', 'cfg' => $xc_phone],
+    ['name' => 'xunyin', 'cfg' => $xunyin_phone],
+    ['name' => 'wantong', 'cfg' => $wantong_phone]
 ];
 $config['phone_providers'] = $phone_providers;

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

@@ -351,6 +351,56 @@ $xc_phone = ['name' => 'xc', 'store_id' => 34, 'qualitys' => '4',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$xunyin_phone = ['name' => 'xunyin', 'store_id' => 35,'qualitys' => '2',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6438, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6438, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6439, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6439, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6440, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6440, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6441, 'price' => 50, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6441, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6442, 'price' => 100, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6442, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6443, 'price' => 200, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6443, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6444, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6444, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6445, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6445, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
+    'amount' => [
+        10 => [['goods_id' => 6446, 'price' => 9.35, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6447, 'price' => 18.7, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6448, 'price' => 28.05, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6449, 'price' => 46.75, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6450, 'price' => 93.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6451, 'price' => 187, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6452, 'price' => 280.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6453, 'price' => 467.5, 'quality' => 4, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -367,6 +417,8 @@ $phone_providers = [
     ['name' => 'tongy', 'cfg' => $tongy_phone],
     ['name' => 'weiyi', 'cfg' => $weiyi_phone],
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
-    ['name' => 'xc', 'cfg' => $xc_phone]
+    ['name' => 'xc', 'cfg' => $xc_phone],
+    ['name' => 'xunyin', 'cfg' => $xunyin_phone],
+//    ['name' => 'wantong', 'cfg' => $wantong_phone]
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
helper/fcgisrv/MobileServer.php

@@ -56,7 +56,7 @@ class MobileServer extends BaseServer
             'refill_zzx.php','refill_inner.php','refill_jiec.php','refill_yifa.php',
             'bridge_shr.php','refill_weit.php','refill_afand.php','refill_afandeng.php',
             'refill_afandnew.php','refill_lingzh.php','refill_lingzhdl.php','refill_tongy.php',
-            'refill_weiyi.php','refill_tonglu.php','refill_xc.php'
+            'refill_weiyi.php','refill_tonglu.php','refill_xc.php','refill_xunyin.php'
         ];
 
         $this->setExFiles($exfiles);

+ 1 - 1
helper/refill/api/xyz/afandnew/config.php

@@ -4,7 +4,7 @@
 namespace refill\afandnew;
 use mtopcard;
 
-
+use mtopcard;
 class config
 {
     const ORDER_URL = 'http://ddd.nvtu.ren/gateway/recharge';

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

@@ -0,0 +1,52 @@
+<?php
+
+
+namespace refill\xunyin;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xunyin/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)
+    {
+        $content = "id={$params['id']}&userid={$params['userid']}&status={$params['status']}&code={$params['code']}";
+        $content .= config::KEY;
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['code']);
+        $order_sn = $params['id'];
+        $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'];
+        $data['official_sn'] = strtolower($params['operatorid']) == 'null' ? '' : $params['operatorid'];
+
+        if ($status === 8888) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 8030) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 102 - 0
helper/refill/api/xyz/xunyin/RefillPhone.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace refill\xunyin;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xunyin/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['cpid'] = config::CP_ID;
+        $params['gamegoodid'] = 'qg';
+        $params['createtime'] = date("YmdHis");
+        $params['account'] = $phone;
+        $params['orderid'] = $order_sn;
+        $params['buynum'] = 1;
+        $params['buyerIp'] = config::API_IP;
+        $params['returnurl'] = config::NOTIFY_URL;
+        $params['buyvalue'] = $amount;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $order_sn);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+        $resp = http_request(config::PAY_PHONE_URL, $params);
+        if ($resp === false) {
+            return [false, '网络错误', true];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if ($resp['Code'] == 0000) {
+                return [true, $resp['order_no'], false];
+            } else {
+                return [false, $resp['msg'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['OrderID'] = $refill_info['order_sn'];
+        $params['cpid'] = config::CP_ID;
+        $content = $params['cpid'] . $params['OrderID'] . config::KEY;
+        $params['sign'] = md5($content);
+        $resp = http_request(config::QUERY_URL, $params);
+        if ($resp === false) {
+            return [false, '网络错误'];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+
+            if ($resp['state'] == 8888) {
+                $order_state = ORDER_STATE_SUCCESS;
+                $updata['official_sn'] = $resp['operatorid'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+            } elseif ($resp['state'] == 8030) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($resp['state'] == 0000) {
+                $order_state = ORDER_STATE_SEND;
+            } else {
+                $order_state = -1;
+            }
+            if ($order_state == -1) {
+                return [false, $resp['msg']];
+            }
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $cpid = config::CP_ID;
+        $content = "cpid={$cpid}&gamegoodid={$params['gamegoodid']}&createtime={$params['createtime']}&account={$params['account']}&orderid={$params['orderid']}&buynum={$params['buynum']}";
+        $content .= config::KEY;
+        return md5($content);
+    }
+
+    private function xmlToArray($xml)
+    {
+        //禁止引用外部xml实体
+        libxml_disable_entity_loader(true);
+
+        $xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
+
+        $val = json_decode(json_encode($xmlstring), true);
+
+        return $val;
+
+    }
+}

+ 15 - 0
helper/refill/api/xyz/xunyin/config.php

@@ -0,0 +1,15 @@
+<?php
+
+
+namespace refill\xunyin;
+
+
+class config
+{
+    const PAY_PHONE_URL = 'https://openapi.xunyin.com/openapi/submit';
+    const QUERY_URL= 'https://openapi.xunyin.com/openapi/query';
+    const CP_ID= '8417';
+    const KEY = 'd4317a37ad90bc38cd346c6ad3056a7f';
+    const API_IP = NET_IP;
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_xunyin.php";
+}

BIN
helper/refill/api/xyz/xunyin/迅银开放平台采购接口-采购商.docx


+ 4 - 0
mobile/refill_xunyin.php

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

+ 26 - 3
test/TestRefill.php

@@ -278,8 +278,8 @@ class TestRefill extends TestCase
         $providers = new refill\feiniao\RefillPhone([]);
 //        $order_sn = $this->make_sn();
 //        Log::record($order_sn, Log::DEBUG);
-//        $resp = $providers->add('18500608333', 5, 100, ['order_sn' => $order_sn]);
-        $resp = $providers->query(['order_sn' => '15441617095424773754']);
+//        $resp = $providers->add('13699279618', 4, 50, ['order_sn' => $order_sn]);
+        $resp = $providers->query(['order_sn' => '28641617178590981824']);
         $params['result'] = 'fail';
         $params['msg'] = '0';
         $params['order'] = 'null';
@@ -332,7 +332,7 @@ class TestRefill extends TestCase
     public function testPrice()
     {
         $amounts = [10, 20, 30, 50, 100, 200, 300, 500];
-        $rate = 0.97;
+        $rate = 0.935;
         foreach ($amounts as $amount) {
             $price[] = $amount * $rate;
         }
@@ -383,6 +383,29 @@ class TestRefill extends TestCase
 //        refill\RefillFactory::instance()->notify('afandeng',$params);
     }
 
+    public function testWantongPhone()
+    {
+        $providers = new refill\wantong\RefillPhone([]);
+        $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '50261617199864602428']);
+    }
+
+    public function testXunyinPhone()
+    {
+        $providers = new refill\xunyin\RefillPhone([]);
+//        $resp = $providers->add(17703711950, 6, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '76831617176125893158']);
+        $params['ext'] = '';
+        $params['code'] = '8888';
+        $params['sign'] = '428ac223cf3a1f6f3d382aac754e8e17';
+        $params['statemes'] = '成功';
+        $params['id'] = '76831617176125893158';
+        $params['userid'] = '8417';
+        $params['operatorid'] = '1000000083421033115583773201';
+        $params['status'] = 'SUCCESS';
+        refill\RefillFactory::instance()->notify('xunyin',$params);
+    }
+
 
     public function testLingzhPhone()
     {