ソースを参照

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

stanley-king 4 年 前
コミット
f96dc55c86

+ 3 - 1
admin/control/merchant.php

@@ -139,6 +139,8 @@ class merchantControl extends SystemControl
             $update['password'] = md5($update['org_pwd']);
             $update['alarm_amount'] = $_POST['alarm_amount'] ?? 0;
             $update['credit_bonus'] = ncPriceFormat($_POST['credit_bonus']);
+            $update['time_out'] = intval($_POST['time_out'] * 60);
+            $update['quality'] = intval($_POST['quality']);
             $member_id = $merchant['admin_id'];
             try {
                 $model_merchant = Model('merchant');
@@ -1210,13 +1212,13 @@ class merchantControl extends SystemControl
                 return $data;
             };
 
-            $provider_model = Model('refill_provider');
             $providers = Model('')->table('refill_provider,store')
                 ->field('refill_provider.*,store.store_name')
                 ->join('inner')
                 ->on('store.store_id=refill_provider.store_id')
                 ->where(['type' => $type])
                 ->limit(100)
+                ->order('opened asc , provider_id desc')
                 ->select();
             if(empty($providers)) {
                 showMessage('暂无相关通道', 'index.php?act=merchant&op=provider');

+ 24 - 6
admin/templates/default/merchant.edit.php

@@ -6,7 +6,7 @@
             <h3><?php echo $lang['nc_merchant'] ?></h3>
             <ul class="tab-base">
                 <li><a href="index.php?act=merchant&op=merchant"><span><?php echo $lang['nc_manage'] ?></span></a></li>
-                <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_update'] ?></span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>编辑</span></a></li>
                 <li><a href="index.php?act=merchant&op=orderStorge"><span>机构库存锁定</span></a></li>
             </ul>
         </div>
@@ -21,37 +21,55 @@
                 <td colspan="2" class="required"><label class="validation" for="name">机构账号:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><?php echo $output['merchant']['name'];?></td>
+                <td class="vatop"><?php echo $output['merchant']['name'];?></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr class="noborder">
                 <td colspan="2" class="required"><label class="validation" for="name">机构公司名称:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" value="<?php echo $output['merchant']['company_name'];?>" name="company_name" id="company_name" class="txt"></td>
+                <td class="vatop"><input type="text" value="<?php echo $output['merchant']['company_name'];?>" name="company_name" id="company_name" class="txt"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>
                 <td colspan="2" class="required"><label class="validation" for="password">登录密码:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" id="password" name="password" class="txt" value="<?php echo $output['merchant']['org_pwd'];?>"></td>
+                <td class="vatop"><input type="text" id="password" name="password" class="txt" value="<?php echo $output['merchant']['org_pwd'];?>"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>
                 <td colspan="2" class="required"><label class="validation" for="alarm_amount">余额预警:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" id="alarm_amount" name="alarm_amount" class="txt" value="<?php echo $output['merchant']['alarm_amount'];?>"></td>
+                <td class="vatop"><input type="text" id="alarm_amount" name="alarm_amount" class="txt" value="<?php echo $output['merchant']['alarm_amount'];?>"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>
                 <td colspan="2" class="required"><label class="validation" for="credit_bonus">授信额度:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" id="credit_bonus" name="credit_bonus" class="txt" value="<?php echo $output['merchant']['credit_bonus'];?>"></td>
+                <td class="vatop"><input type="text" id="credit_bonus" name="credit_bonus" class="txt" value="<?php echo $output['merchant']['credit_bonus'];?>"></td>
                 <td class="vatop tips"></td>
             </tr>
+            <tr>
+                <td colspan="2" class="required"><label class="validation" for="time_out">失效时间(分钟):</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop"><input type="text" id="time_out" name="time_out" class="txt" value="<?php echo $output['merchant']['time_out'] / 60;?>"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label class="validation" for="quality">通道质量:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="">
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 1){ echo 'checked';}?> value="1" type="radio">普通
+                    <input id="activity_state0" name="quality" <?php if($output['merchant']['quality'] == 2){ echo 'checked';}?> value="2" type="radio">快速
+                    <input id="activity_state1" name="quality" <?php if($output['merchant']['quality'] == 3){ echo 'checked';}?> value="3" type="radio">普通+快速通道(优先走普通通道,如果在最长回调时间内不成功切换快速通道,确保成功率)
+
+                </td>
+            </tr>
             </tbody>
             <tfoot>
             <tr class="tfoot">

+ 1 - 1
admin/templates/default/provider.index.php

@@ -104,7 +104,7 @@
                                 <a href="index.php?act=merchant&op=changeProviderState&state=1&id=<?php echo $v['provider_id'] ?>">启用通道</a>
                             <?php }?>
                             | <a href="index.php?act=merchant&op=provider_edit&id=<?php echo $v['provider_id'] ?>">编辑通道</a>
-<!--                            | <a href="index.php?act=merchant&op=provider_del&id=--><?php //echo $v['provider_id'] ?><!--">删除通道</a>-->
+                            | <a href="index.php?act=merchant&op=provider_del&id=<?php echo $v['provider_id'] ?>">删除通道</a>
                         </td>
                     </tr>
                 <?php } ?>

+ 31 - 5
data/config/xyz/refill.ini.php

@@ -245,7 +245,7 @@ $afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
-$tongy_phone = ['name' => 'tongy', 'store_id' => 26,
+$tongy_phone = ['name' => 'tongy', 'store_id' => 31,
     'amount' => [
         30 => [['goods_id' => 6408, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 6408, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
@@ -273,12 +273,37 @@ $tongy_phone = ['name' => 'tongy', 'store_id' => 26,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$weiyi_phone = ['name' => 'weiyi', 'store_id' => 32,
+    'amount' => [
+        10 => [['goods_id' => 6414, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6415, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6416, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6417, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6418, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6419, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6420, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6421, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$tonglu_phone = ['name' => 'tonglu', 'store_id' => 33,
+    'amount' => [
+        10 => [['goods_id' => 6422, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6423, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6424, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6425, 'price' => 47, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6426, 'price' => 94, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6427, 'price' => 188, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6428, 'price' => 282, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6429, 'price' => 470, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
-    ['name' => 'bjb', 'cfg' => $bjb_phone],
-    ['name' => 'bjbyd', 'cfg' => $bjbyd_phone],
-
+//    ['name' => 'bjb', 'cfg' => $bjb_phone],
+//    ['name' => 'bjbyd', 'cfg' => $bjbyd_phone],
 //    ['name' => 'yifa', 'cfg' => $yifa_phone],
 //    ['name' => 'jiec', 'cfg' => $jiec_phone],
 //    ['name' => 'weit', 'cfg' => $weit_phone],
@@ -288,6 +313,7 @@ $phone_providers = [
     ['name' => 'afandnew', 'cfg' => $afandnew_phone],
     ['name' => 'lingzh', 'cfg' => $lingzh_phone],
     ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
-//    ['name' => 'tongy', 'cfg' => $tongy_phone],
+    ['name' => 'tongy', 'cfg' => $tongy_phone],
+    ['name' => 'weiyi', 'cfg' => $weiyi_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
data/model/refill_provider.model.php

@@ -20,7 +20,7 @@ class refill_providerModel extends Model
     {
         return $this->table('refill_provider')->where($condition)->delete();
     }
-    public function getProviderList($condition, $pagesize = '', $field = '*', $order = 'provider_id desc', $limit = '')
+    public function getProviderList($condition, $pagesize = '', $field = '*', $order = 'opened asc , provider_id desc', $limit = '')
     {
         $list = $this->table('refill_provider')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
         if (empty($list)) return [];

+ 2 - 1
helper/fcgisrv/MobileServer.php

@@ -55,7 +55,8 @@ class MobileServer extends BaseServer
             'refill_beixt.php','refill_bxtwt.php','refill_bjb.php','refill_xyz.php',
             '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_afandnew.php','refill_lingzh.php','refill_lingzhdl.php','refill_tongy.php',
+            'refill_weiyi.php'
         ];
 
         $this->setExFiles($exfiles);

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

@@ -12,6 +12,6 @@ class config
     const SHOP_ID = 300000;
     const USER_ID = 100857;
     const KEY = 'E80A1761A46507E65202853367C2E760';
-//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_tongy.php";
-    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_tongy.php";
+//    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
 }

+ 53 - 0
helper/refill/api/xyz/weiyi/RefillCallBack.php

@@ -0,0 +1,53 @@
+<?php
+
+
+namespace refill\weiyi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weiyi/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  = config::USER_ID . $params['ordernum'] . $params['timestamp'] . config::KEY;
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['state']);
+        $order_sn = $params['ordernum'];
+        $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['serialno']) == 'null' ? '' : $params['serialno'];
+
+        if ($status === 2) {
+            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];
+        }
+    }
+}

+ 87 - 0
helper/refill/api/xyz/weiyi/RefillPhone.php

@@ -0,0 +1,87 @@
+<?php
+
+namespace refill\weiyi;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weiyi/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['userid'] = config::USER_ID;
+        $params['orderid'] = $order_sn;
+        $params['echo'] = rand(100000,999999);
+        $params['timestamp'] = date("YmdHis");
+        $params['version'] = '1.0';
+        $params['packcode'] = $amount;
+        $params['mobile'] = $phone;
+        $params['flowtype'] = '1001';
+        $params['callback_url'] = config::NOTIFY_URL;
+        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['chargeSign'] = $sign;
+
+        $params = json_encode($params);
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders);
+        if ($resp === false) {
+            return [false, '系统错误', true];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if ($resp['code'] == 0000) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['desc'], false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['orderid'] = $refill_info['order_sn'];
+        $params['userid'] = config::USER_ID;
+        $params['timestamp'] = date("YmdHis");
+        $content = $params['userid'] . $params['orderid'] . $params['timestamp'] . config::KEY;
+        $params['sign'] = md5($content);
+        $params = json_encode($params);
+        $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
+        if ($resp === false) {
+            return [false, '系统错误'];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            $order_state = -1;
+            if ($resp['code'] == 0000) {
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($resp['code'] == 0004) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($resp['code'] == 0002 || $resp['code'] == 0003) {
+                $order_state = ORDER_STATE_SEND;
+            }
+            if ($order_state == -1) {
+                return [false, $resp['desc']];
+            }
+            return [true, $order_state];
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['userid'] . $params['orderid'] . config::KEY . $params['echo'] . $params['timestamp'];
+        return md5($content);
+    }
+
+}

+ 17 - 0
helper/refill/api/xyz/weiyi/config.php

@@ -0,0 +1,17 @@
+<?php
+
+
+namespace refill\weiyi;
+
+
+class config
+{
+    const ORDER_URL = 'http://115.28.209.246:8081/api/charge.do';
+    const QUERY_URL = 'http://115.28.209.246:8081/api/query_chargestate.do';
+
+    const USER_ID = '8177b4b1d0254c0699bc';
+    const KEY = '0fa29cd709df4ae4b592';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_weiyi.php";
+//    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
+    const ExtHeaders = ['Content-Type: application/json'];
+}

+ 5 - 0
mobile/refill_weiyi.php

@@ -0,0 +1,5 @@
+<?php
+$content = $_SERVER['post_content'];
+$input = json_decode($content,true);
+
+refill\util::push_notify('weiyi',$input);