ソースを参照

Merge branch 'rmaster' into rtest

xiaoyu 3 年 前
コミット
369cb2f578

+ 1 - 1
admin/control/merchant.php

@@ -32,7 +32,7 @@ class merchantControl extends SystemControl
             $condition['company_name'] = ['like', '%'.$_GET['merchant_name'].'%'];
         }
 
-        $merchant_list = $model_merchant->getMerchantList($condition, 100, 'available_predeposit desc,merchant_state asc,mchid desc');
+        $merchant_list = $model_merchant->getMerchantList($condition, 100, 'available_predeposit desc,merchant_state asc,mchid desc', true);
         foreach ($merchant_list as $key => $merchant) {
             $merchant_list[$key]['available_predeposit'] = $merchant['available_predeposit'] - $merchant['credit_bonus'];
         }

+ 1 - 1
admin/control/merchant_info.php

@@ -46,7 +46,7 @@ class merchant_infoControl extends SystemControl
             } else {
                 $merchant = Model('merchant')->getMerchantInfo(['mchid' => $_POST['mchid']]);
                 if(empty($merchant)) {
-                    showMessage('此上游通道不存在!');
+                    showMessage('此机构不存在!');
                 }
                 $mod = Model('merchant_info');
                 $insert_array['mchid'] = $_POST['mchid'];

+ 21 - 2
admin/control/refill_evidence.php

@@ -49,9 +49,9 @@ class refill_evidenceControl extends SystemControl
 
         //充值申请列表
         if(!empty($export)) {
-            $evidence_list = $model_merchant->getRefillEvidence($condition, 1000, 'refill_evidence.*,member.available_predeposit', 'refill_evidence.add_time asc');
+            $evidence_list = $this->GetExportData($condition);
         } else {
-            $evidence_list = $model_merchant->getRefillEvidence($condition, 20, 'refill_evidence.*,member.available_predeposit', 'refill_evidence.add_time desc');
+            $evidence_list = $model_merchant->getRefillEvidence($condition, 20, 'refill_evidence.*,member.available_predeposit', 'refill_evidence.add_time desc', '', true);
         }
         $evidence_list = $this->formatData($evidence_list);
 
@@ -111,4 +111,23 @@ class refill_evidenceControl extends SystemControl
 
         return $data;
     }
+
+    private function GetExportData($condition): array
+    {
+        $i = 0;
+        $result = [];
+        while (true) {
+            $start = $i * 1000;
+            $list = Model('')->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')
+                ->field('refill_evidence.*,member.available_predeposit')->where($condition)->limit("{$start},1000")->master(true)->select();
+            if (empty($list)) {
+                break;
+            }
+            $i++;
+            foreach ($list as $value) {
+                $result[] = $value;
+            }
+        }
+        return $result;
+    }
 }

+ 27 - 28
admin/control/refill_order.php

@@ -20,23 +20,23 @@ class refill_orderControl extends SystemControl
     {
         $model_refill_order = Model('refill_order');
         $condition['inner_status'] = 0;
+        $_GET['query_start_time'] = $_GET['query_start_time'] ?? date("Y-m-d 00:00:00");
 
-        $fSingle = false;
         if (!empty($_GET['order_sn'])) {
             $condition['refill_order.order_sn'] = $_GET['order_sn'];
-            $fSingle = true;
+
         }
         if (!empty($_GET['mch_order'])) {
             $condition['refill_order.mch_order'] = $_GET['mch_order'];
-            $fSingle = true;
+
         }
         if (!empty($_GET['ch_trade_no'])) {
             $condition['refill_order.ch_trade_no'] = $_GET['ch_trade_no'];
-            $fSingle = true;
+
         }
         if (!empty($_GET['card_no'])) {
             $condition['refill_order.card_no'] = $_GET['card_no'];
-            $fSingle = true;
+
         }
         if (!empty($_GET['no_mchid'])) {
             $no_mchid = explode(',', $_GET['no_mchid']);
@@ -79,34 +79,33 @@ class refill_orderControl extends SystemControl
         }
 
         $fToday = false;
-        if (!$fSingle) {
-            $start_unixtime = intval(strtotime($_GET['query_start_time']));
-            $end_unixtime = intval(strtotime($_GET['query_end_time']));
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime = intval(strtotime($_GET['query_end_time']));
 
-            if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
-                $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
-            } elseif ($start_unixtime > 0) {
-                $condition['refill_order.order_time'] = ['egt', $start_unixtime];
-            } elseif ($end_unixtime > 0) {
-                $condition['refill_order.order_time'] = ['lt', $end_unixtime];
-            } else {
-                $start = strtotime(date('Y-m-d', time()));
-                $condition['refill_order.order_time'] = ['egt', $start];
-                $fToday = true;
-            }
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['refill_order.order_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['refill_order.order_time'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['refill_order.order_time'] = ['lt', $end_unixtime];
+        } else {
+            $start = strtotime(date('Y-m-d', time()));
+            $condition['refill_order.order_time'] = ['egt', $start];
+            $fToday = true;
+        }
 
-            if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
-                $condition['vr_order.order_state'] = $_GET['order_state'];
-                if ($_GET['order_state'] == ORDER_STATE_SEND) {
-                    if ($_GET['time'] == 1) {
-                        $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
-                    }
-                    if ($_GET['time'] == 2) {
-                        $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
-                    }
+        if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
+            $condition['vr_order.order_state'] = $_GET['order_state'];
+            if ($_GET['order_state'] == ORDER_STATE_SEND) {
+                if ($_GET['time'] == 1) {
+                    $condition['refill_order.order_time'] = ['between', [(time() - 3600), (time() - 1800)]];
+                }
+                if ($_GET['time'] == 2) {
+                    $condition['refill_order.order_time'] = ['lt', (time() - 3600)];
                 }
             }
         }
+
         if (!empty($_GET['export']) || !empty($_GET['export_stats'])) {
             $this->RefillOrderExport($condition);
         }

+ 125 - 0
admin/control/refill_refund.php

@@ -0,0 +1,125 @@
+<?php
+
+
+class refill_refundControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $mod = Model('refill_refund');
+        $condition = [];
+        if(!empty($_GET['provider_id'])) {
+            $condition['provider_id'] = $_GET['provider_id'];
+        }
+        if(!empty($_GET['mchid'])) {
+            $condition['mchid'] = $_GET['mchid'];
+        }
+        $start_unixtime = intval(strtotime($_GET['query_start_time']));
+        $end_unixtime = intval(strtotime($_GET['query_end_time']));
+        if ($start_unixtime > 0 && $end_unixtime > $start_unixtime) {
+            $condition['refund_time'] = [['egt', $start_unixtime], ['lt', $end_unixtime], 'and'];
+        } elseif ($start_unixtime > 0) {
+            $condition['refund_time'] = ['egt', $start_unixtime];
+        } elseif ($end_unixtime > 0) {
+            $condition['refund_time'] = ['lt', $end_unixtime];
+        }
+
+        $providers = [];
+        $provider_list = Model('')->table('refill_provider,store')->field('refill_provider.provider_id,refill_provider.name,store.store_name')->join('inner')
+            ->on('store.store_id=refill_provider.store_id')->limit(1000)->select();
+        foreach ($provider_list as $provider) {
+            $providers[$provider['provider_id']] = $provider;
+        }
+        $merchants = [];
+        $merchant_list = Model('')->table('merchant')->limit(1000)->select();
+        foreach ($merchant_list as  $value) {
+            $merchants[$value['mchid']] = $value;
+        }
+
+        $refund_list = $mod->getRefillRefundList($condition,50);
+        foreach ($refund_list as $key => $value) {
+            $refund_list[$key]['provider_name'] = $providers[$value['provider_id']]['name'];
+            $refund_list[$key]['store_name'] = $providers[$value['provider_id']]['store_name'];
+
+            $refund_list[$key]['merchant_name'] = $merchants[$value['mchid']]['name'];
+            $refund_list[$key]['company_name'] = $merchants[$value['mchid']]['company_name'];
+        }
+        Tpl::output('provider_list', $providers);
+        Tpl::output('merchants', $merchants);
+        Tpl::output('info_list', $refund_list);
+        Tpl::showpage('refill.refund');
+    }
+
+    public function addOp()
+    {
+        if (chksubmit()) {
+            $obj_validate = new Validator();
+            $obj_validate->validateparam = [
+                ["input" => $_POST["mchid"], "require" => "true", "message" => '机构不能为空'],
+                ["input" => $_POST["provider_id"], "require" => "true", "message" => '通道不能为空'],
+                ["input" => $_POST["mch_amount"], "require" => "true", "message" => '机构退款金额不能为空'],
+                ["input" => $_POST["channel_amount"], "require" => "true", "message" => '通道退款金额不能为空'],
+                ["input" => $_POST["refund_time"], "require" => "true", "message" => '退款日期不能为空'],
+                ["input" => $_POST["card_no"], "require" => "true", "message" => '退款卡号不能为空'],
+                ["input" => $_POST["card_type"], "require" => "true", "message" => '卡类型不能为空'],
+                ["input" => $_POST["refill_amount"], "require" => "true", "message" => '面值不能为空']
+            ];
+            $error = $obj_validate->validate();
+            if ($error != '') {
+                showMessage($error);
+            } else {
+                $merchant = Model('merchant')->getMerchantInfo(['mchid' => $_POST['mchid']]);
+                if(empty($merchant)) {
+                    showMessage('此机构不存在!');
+                }
+                $provider = Model('refill_provider')->getProviderInfo(['provider_id' => $_POST['provider_id']]);
+                if(empty($provider)) {
+                    showMessage('此上游通道不存在!');
+                }
+                $mod = Model('refill_refund');
+                $insert_array['mchid'] = $_POST['mchid'];
+                $insert_array['provider_id'] = $_POST['provider_id'];
+                $insert_array['mch_amount'] = $_POST['mch_amount'];
+                $insert_array['channel_amount'] = $_POST['channel_amount'];
+                $insert_array['refund_time'] = strtotime($_POST['refund_time']);
+                $insert_array['bz'] = $_POST['bz'] ?? '';
+                $insert_array['add_time'] = time();
+                $result = $mod->addRefund($insert_array);
+                if ($result) {
+                    showMessage('添加成功', 'index.php?act=refill_refund&op=index');
+                } else {
+                    showMessage('添加失败');
+                }
+            }
+        }
+        else
+        {
+            $merchant_list = Model('')->table('merchant')->limit(1000)->select();
+            $provider_list = Model('')->table('refill_provider,store')->field('refill_provider.provider_id,store.store_name')->join('inner')
+                ->on('store.store_id=refill_provider.store_id')->limit(1000)->select();
+
+            Tpl::output('provider_list', $provider_list);
+            Tpl::output('merchant_list', $merchant_list);
+            Tpl::showpage('refill.refund.add');
+        }
+    }
+
+    public function delOp()
+    {
+        $id = $_GET['id'];
+        $mod = Model('refill_refund');
+        $provider_info = $mod->getRefundInfo(['id' => $id]);
+        if (empty($provider_info)) {
+            showMessage('退款信息不存在');
+        }
+        $result = $mod->DelRefund(['id' => $id]);
+        if (!$result) {
+            showMessage('删除失败');
+        }
+        showMessage('删除成功','index.php?act=refill_refund&op=index');
+    }
+}

+ 1 - 0
admin/include/menu.php

@@ -108,6 +108,7 @@ $arr = array(
 					array('args'=>'index,merchant_info,merchant',			'text'=>'机构信息管理'),
 					array('args'=>'index,refill_cron,merchant',				'text'=>'订单排队查询'),
 					array('args'=>'index,refill_config,merchant',			'text'=>'充值系统设置'),
+					array('args'=>'index,refill_refund,merchant',			'text'=>'退款信息管理'),
 				)
 			),
 			4 => array(

+ 4 - 4
admin/templates/default/merchant.add.php

@@ -16,17 +16,17 @@
         <table class="table tb-type2">
             <tbody>
             <tr class="noborder">
-                <td colspan="2" class="required"><label class="validation" for="name">机构账号:</label></td>
+                <td colspan="2" class="required"><label class="validation" for="name">机构公司名称:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" value="" name="name" id="name" class="txt"></td>
+                <td class="vatop rowform"><input type="text" value="" name="company_name" id="company_name" class="txt"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr class="noborder">
-                <td colspan="2" class="required"><label class="validation" for="name">机构公司名称:</label></td>
+                <td colspan="2" class="required"><label class="validation" for="name">机构账号:</label></td>
             </tr>
             <tr class="noborder">
-                <td class="vatop rowform"><input type="text" value="" name="company_name" id="company_name" class="txt"></td>
+                <td class="vatop rowform"><input type="text" value="" name="name" id="name" class="txt"></td>
                 <td class="vatop tips"></td>
             </tr>
             <tr>

+ 11 - 11
admin/templates/default/merchant.order.stats.php

@@ -123,11 +123,11 @@
                 <th class="align-center">成功订单数</th>
                 <th class="align-center">成功金额</th>
                 <th class="align-center">下游金额</th>
-                <th class="align-center">上游金额</th>
-                <th class="align-center">利润</th>
-                <th class="align-center">订单总量</th>
-                <th class="align-center">失败订单数量</th>
-                <th class="align-center">成功占比</th>
+<!--                <th class="align-center">上游金额</th>-->
+<!--                <th class="align-center">利润</th>-->
+<!--                <th class="align-center">订单总量</th>-->
+<!--                <th class="align-center">失败订单数量</th>-->
+<!--                <th class="align-center">成功占比</th>-->
                 <th class="align-center">下游成功单量</th>
                 <th class="align-center">下游成功金额</th>
                 <th class="align-center">单量误差</th>
@@ -135,7 +135,7 @@
                 <th class="align-center">备注</th>
                 <th class="align-center">匹配状态</th>
                 <th class="align-center">统计日期类型</th>
-                <th class="align-center"><?php echo $lang['operation']; ?></th>
+                <th class="align-center">操作</th>
             </tr>
             </thead>
             <tbody>
@@ -148,11 +148,11 @@
                         <td class="align-center"><?php echo $v['success_count']; ?></td>
                         <td class="align-center"><?php echo $v['success_refill_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['success_mch_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['success_channel_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['profit_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['order_count']; ?></td>
-                        <td class="align-center"><?php echo $v['cancel_count']; ?></td>
-                        <td class="align-center"><?php echo $v['success_ratio']; ?></td>
+<!--                        <td class="align-center">--><?php //echo $v['success_channel_amounts']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['profit_amounts']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['order_count']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['cancel_count']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['success_ratio']; ?><!--</td>-->
                         <td class="align-center"><?php echo $v['corder_success_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['gap_order_count']; ?></td>

+ 4 - 6
admin/templates/default/order.stats.check.php

@@ -5,11 +5,9 @@
         <div class="item-title">
             <h3>对账管理</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=merchant&op=provider_evidence"><span>上游充值申请记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=provider_evidence_add"><span>新增上游充值申请</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=system"><span>平台对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=provider"><span>通道对账记录</span></a></li>
-                <li><a href="index.php?act=merchant&op=OrderStats&type=merchant"><span>商户对账记录</span></a></li>
+                <li><a href="index.php?act=orderstats&op=index&type=system"><span>平台对账记录</span></a></li>
+                <li><a href="index.php?act=orderstats&op=index&type=provider"><span>通道对账记录</span></a></li>
+                <li><a href="index.php?act=orderstats&op=index&type=merchant"><span>商户对账记录</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span>对账</span></a></li>
             </ul>
         </div>
@@ -67,7 +65,7 @@
         });
         $('#user_form').validate({
             errorPlacement: function (error, element) {
-                error.appendTo(element.parent().parent().prev().find('td:first'));
+            error.appendTo(element.parent().parent().prev().find('td:first'));
             },
             rules: {
                 corder_success_count: {

+ 82 - 11
admin/templates/default/provider.order.stats.php

@@ -122,11 +122,11 @@
                 <th class="align-center">成功订单数</th>
                 <th class="align-center">成功金额</th>
                 <th class="align-center">上游金额</th>
-                <th class="align-center">下游金额</th>
-                <th class="align-center">利润</th>
-                <th class="align-center">订单总量</th>
-                <th class="align-center">失败订单数量</th>
-                <th class="align-center">成功占比</th>
+<!--                <th class="align-center">下游金额</th>-->
+<!--                <th class="align-center">利润</th>-->
+<!--                <th class="align-center">订单总量</th>-->
+<!--                <th class="align-center">失败订单数量</th>-->
+<!--                <th class="align-center">成功占比</th>-->
                 <th class="align-center">上游成功单量</th>
                 <th class="align-center">上游成功金额</th>
                 <th class="align-center">单量误差</th>
@@ -134,7 +134,7 @@
                 <th class="align-center">备注</th>
                 <th class="align-center">匹配状态</th>
                 <th class="align-center">统计日期类型</th>
-                <th class="align-center"><?php echo $lang['operation']; ?></th>
+                <th class="align-center">操作</th>
             </tr>
             </thead>
             <tbody>
@@ -147,11 +147,11 @@
                         <td class="align-center"><?php echo $v['success_count']; ?></td>
                         <td class="align-center"><?php echo $v['success_refill_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['success_channel_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['success_mch_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['profit_amounts']; ?></td>
-                        <td class="align-center"><?php echo $v['order_count']; ?></td>
-                        <td class="align-center"><?php echo $v['cancel_count']; ?></td>
-                        <td class="align-center"><?php echo $v['success_ratio']; ?></td>
+<!--                        <td class="align-center">--><?php //echo $v['success_mch_amounts']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['profit_amounts']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['order_count']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['cancel_count']; ?><!--</td>-->
+<!--                        <td class="align-center">--><?php //echo $v['success_ratio']; ?><!--</td>-->
                         <td class="align-center"><?php echo $v['corder_success_count']; ?></td>
                         <td class="align-center"><?php echo $v['corder_success_amounts']; ?></td>
                         <td class="align-center"><?php echo $v['gap_order_count']; ?></td>
@@ -170,6 +170,7 @@
                         <td class="align-center w200">
                             <a href="index.php?act=merchant&op=OrderStatsReload&stat_id=<?php echo $v['stat_id'];?>">重新统计</a>
                             |<a href="index.php?act=merchant&op=OrderStatsCheck&stat_id=<?php echo $v['stat_id'] ?>">编辑</a>
+                            <a href="#" class="examine">11</a>
                         </td>
                     </tr>
                 <?php } ?>
@@ -338,5 +339,75 @@
                 // console.log('data', data);
             })
         })
+        $('.examine').click(function() {
+            layer.open({
+            type: 1,
+            title: "对账",
+            area: ['900px', '500px'],
+            shadeClose: true, //点击遮罩关闭
+            content: `<form id="user_form" enctype="multipart/form-data" method="post">
+        <input type="hidden" name="form_submit" value="ok"/>
+        <input type="hidden" name="stat_id" value="<?php echo $_GET['stat_id'];?>"/>
+        <table class="table tb-type2">
+            <tbody>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="corder_success_count"><?php echo $output['stats_type'];?>成功订单数量:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="corder_success_count" id="corder_success_count" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="name"><?php echo $output['stats_type'];?>成功订单金额:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="corder_success_amounts" id="corder_success_amounts" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label>备注信息:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><textarea name="remark" rows="6" class="tarea"></textarea></td>
+                <td class="vatop tips"></td>
+            </tr>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>`,
+    $("#submitBtn").click(function () {
+            if ($("#user_form").valid()) {
+                $("#user_form").submit();
+            }
+        });
+        $('#user_form').validate({
+            errorPlacement: function (error, element) {
+            error.appendTo(element.parent().parent().prev().find('td:first'));
+            },
+            rules: {
+                corder_success_count: {
+                    required: true,
+                },
+                corder_success_amounts: {
+                    required: true,
+                },
+            },
+            messages: {
+                corder_success_count: {
+                    required: '不能为空',
+                },
+                corder_success_amounts: {
+                    required: '不能为空',
+                }
+            }
+        });
+    });
+    
+
+        });
     });
 </script>

+ 215 - 0
admin/templates/default/refill.refund.add.php

@@ -0,0 +1,215 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<style>
+   .layui-form-select .layui-input {
+    padding: 13px 5px;
+}
+.layui-form-select dl {
+    top: 29px !important;
+}
+.layui-form-select {
+    width: 85%;
+}
+.layui-select-title {
+    width: 100%;
+}
+.page .fixed-bar .item-title h3 {
+    margin-top: 18px !important;
+    margin-bottom: 10px !important;
+    font-weight: 700 !important;
+}
+.tab-base li span {
+    font-size: 12px !important;
+}
+</style>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>退款信息管理</h3>
+            <ul class="tab-base">
+                <li><a href="index.php?act=refill_refund&op=index"><span>退款信息管理</span></a></li>
+                <li><a href="JavaScript:void(0);" class="current"><span>新增</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form id="user_form" enctype="multipart/form-data" method="post" class="layui-form">
+        <input type="hidden" name="form_submit" value="ok"/>
+        <table class="table tb-type2 nobdb">
+            <tbody>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="provider_id">通道选择:</label></td>
+            </tr>
+            <tr class="">
+                <td class="">
+                    <select name="provider_id" id="provider_id" lay-verify="" lay-search>
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach($output['provider_list'] as $provider){?>
+                            <option value="<?php echo $provider['provider_id']?>"><?php echo $provider['store_name']?></option>
+                        <?php }?>
+                    </select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="channel_amount">通道退款金额:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="channel_amount" id="channel_amount" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="mchid">机构选择:</label></td>
+            </tr>
+            <tr class="">
+                <td class="">
+                    <select name="mchid" id="mchid" class="layui_in" lay-verify="" lay-search>
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach($output['merchant_list'] as $merchant){?>
+                            <option value="<?php echo $merchant['mchid']?>"><?php echo $merchant['company_name']??$merchant['name'];?></option>
+                        <?php }?>
+                    </select>
+                </td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="mch_amount">机构退款金额:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="mch_amount" id="mch_amount" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="card_no">退款卡号:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="card_no" id="card_no" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="card_type">卡类型:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="card_type" id="card_type" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation" for="refill_amount">面值:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><input type="text" value="" name="refill_amount" id="refill_amount" class="txt"></td>
+                <td class="vatop tips"></td>
+            </tr>
+            <tr class="noborder">
+                <td colspan="2" class="required"><label class="validation">退款日期:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform">
+                    <input class="txt date" type="text" id="refund_time" name="refund_time"  autocomplete="off" style="width:230px" />
+                <td class="vatop tips"></td>
+            </tr>
+            <tr>
+                <td colspan="2" class="required"><label>备注:</label></td>
+            </tr>
+            <tr class="noborder">
+                <td class="vatop rowform"><textarea name="bz" rows="6" class="tarea"></textarea></td>
+            </tr>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td colspan="15"><a href="JavaScript:void(0);" class="btn" id="submitBtn"><span><?php echo $lang['nc_submit']; ?></span></a></td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/jquery.ui.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/i18n/zh-CN.js"
+        charset="utf-8"></script>
+ <link rel="stylesheet" type="text/css"
+      href="<?php echo RESOURCE_SITE_URL; ?>/js/jquery-ui/themes/ui-lightness/jquery.ui.css"/>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
+<script type="text/javascript">
+    $(function () {
+     
+        //按钮先执行验证再提交表单
+        $("#submitBtn").click(function () {
+            if ($("#user_form").valid()) {
+                $("#user_form").submit();
+            }
+        });
+        $('#user_form').validate({
+            errorPlacement: function (error, element) {
+                error.appendTo(element.parent().parent().prev().find('td:first'));
+            },
+            rules: {
+                mchid: {
+                    required: true,
+                },
+                provider_id: {
+                    required: true,
+                },
+                mch_amount: {
+                    required: true,
+                },
+                channel_amount: {
+                    required: true,
+                },
+                refund_time: {
+                    required: true,
+                },
+                card_no: {
+                    required: true,
+                },
+                card_type: {
+                    required: true,
+                },
+                refill_amount: {
+                    required: true,
+                },
+            },
+            messages: {
+                mchid: {
+                    required: '必须选择机构',
+                },
+                provider_id: {
+                    required: '必须选择通道',
+                },
+                mch_amount: {
+                    required: '不能为空',
+                },
+                channel_amount: {
+                    required: '不能为空',
+                },
+                refund_time: {
+                    required: '不能为空',
+                },
+                card_no: {
+                    required: '不能为空',
+                },
+                card_type: {
+                    required: '不能为空',
+                },
+                refill_amount: {
+                    required: '不能为空',
+                },
+            }
+        });
+  
+       // 日期选择器
+       laydate.render({
+            elem: '#refund_time',
+            type: 'datetime'
+        });
+       function trim(str) {
+      if (str && typeof str === "text") {
+        return str.replace(/(^\s*)|(\s*)$/g,""); //去除前后空白符
+      }
+    }
+});
+
+ 
+</script>

+ 160 - 0
admin/templates/default/refill.refund.php

@@ -0,0 +1,160 @@
+<?php defined('InShopNC') or exit('Access Invalid!'); ?>
+<style>
+    .page .fixed-bar .item-title h3 {
+        margin-top:18px !important;
+        margin-bottom:10px !important;
+        font-weight:700 !important;
+    }
+    .tab-base li span {
+        font-size:12px !important;
+    }
+    .layui-form-select .layui-input {
+        height:26px;
+    }
+    input::placeholder{ 
+        color:#333; 
+    }
+</style>
+<div class="page">
+    <div class="fixed-bar">
+        <div class="item-title">
+            <h3>退款信息管理</h3>
+            <ul class="tab-base">
+                <li><a href="JavaScript:void(0);" class="current"><span>退款信息管理</span></a></li>
+                <li><a href="index.php?act=refill_refund&op=add"><span>新增</span></a></li>
+            </ul>
+        </div>
+    </div>
+    <div class="fixed-empty"></div>
+    <form method="get" name="formSearch" id="formSearch" class="layui-form">
+        <input type="hidden" value="refill_refund" name="act">
+        <input type="hidden" value="index" name="op">
+        <table class="tb-type1 noborder search">
+            <tbody>
+            <tr>
+                <th><label>通道名称</label></th>
+                <td>
+                    <select name="provider_id" class="querySelect" lay-verify="" lay-search>
+                        <option  value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach($output['provider_list'] as $provider){?>
+                            <option value="<?php echo $provider['provider_id']?>"
+                                    <?php if ($_GET['provider_id'] == $provider['provider_id']){ ?>selected<?php } ?>><?php echo $provider['store_name']?>
+                            </option>
+                        <?php }?>
+                    </select>
+                </td>
+
+                <th><label>机构名称</label></th>
+                <td>
+                    <select name="mchid" class="querySelect" lay-verify="" lay-search>
+                        <option  value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php foreach($output['merchants'] as $merchant){?>
+                            <option value="<?php echo $merchant['mchid']?>"
+                                    <?php if ($_GET['mchid'] == $merchant['mchid']){ ?>selected<?php } ?>><?php echo $merchant['company_name'] ?? $merchant['name'];?>
+                            </option>
+                        <?php }?>
+                    </select>
+                </td>
+
+                <th><label for="query_start_time">退款日期</label></th>
+                <td>
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_start_time']; ?>"
+                           id="startTime" name="query_start_time" autocomplete="off" style="width:120px" />
+                    <label for="query_start_time">~</label>
+                    <input class="txt date" type="text" value="<?php echo $_GET['query_end_time']; ?>"
+                           id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
+                </td>
+                <td><a href="javascript:void(0);" id="ncsubmit" class="btn-search "
+                       title="<?php echo $lang['nc_query']; ?>">&nbsp;</a>
+            </tr>
+            </tbody>
+        </table>
+    </form>
+    <form method="post" id="merchant_name_form">
+        <input type="hidden" name="form_submit" value="ok"/>
+        <table class="table tb-type2">
+            <thead>
+            <tr class="thead">
+                <th class="align-center">记录ID</th>
+                <th class="align-center">通道名称</th>
+                <th class="align-center">通道ID</th>
+                <th class="align-center">通道退款金额</th>
+                <th class="align-center">机构编码</th>
+                <th class="align-center">机构名称</th>
+                <th class="align-center">机构退款金额</th>
+                <th class="align-center">退款卡号</th>
+                <th class="align-center">退款卡类型</th>
+                <th class="align-center">退款面值</th>
+                <th class="align-center">退款日期</th>
+                <th class="align-center">记录生成日期</th>
+                <th class="align-center">备注</th>
+                <th class="align-center">操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <?php if (!empty($output['info_list']) && is_array($output['info_list'])) { ?>
+                <?php foreach ($output['info_list'] as $k => $v) { ?>
+                    <tr class="trFlex">
+                        <td class="align-center"><?php echo $v['id']; ?></td>
+                        <td class="align-center"><?php echo $v['provider_name']; ?> (<?php echo $v['store_name'];?>)</td>
+                        <td class="align-center"><?php echo $v['provider_id']; ?></td>
+                        <td class="align-center"><?php echo $v['channel_amount']; ?></td>
+                        <td class="align-center"><?php echo $v['mchid']; ?></td>
+                        <td class="align-center"><?php echo $v['company_name'] ?? $v['name']; ?></td>
+                        <td class="align-center"><?php echo $v['mch_amount']; ?></td>
+                        <td class="align-center"><?php echo $v['card_no']; ?></td>
+                        <td class="align-center"><?php echo $v['card_type']; ?></td>
+                        <td class="align-center"><?php echo $v['refill_amount']; ?></td>
+                        <td class="align-center"><?php echo date('Y-m-d H:i:s', $v['refund_time']); ?></td>
+                        <td class="align-center"><?php echo date('Y-m-d H:i:s', $v['add_time']); ?></td>
+                        <td class="align-center"><?php echo $v['bz']; ?></td>
+                        <td class="align-center w200">
+                            <a href="index.php?act=refill_refund&op=del&id=<?php echo $v['id'] ?>">删除</a>
+                        </td>
+                    </tr>
+                <?php } ?>
+            <?php } else { ?>
+                <tr class="no_data">
+                    <td colspan="14"><?php echo $lang['nc_no_record']; ?></td>
+                </tr>
+            <?php } ?>
+            </tbody>
+            <tfoot>
+            <tr class="tfoot">
+                <td></td>
+                <td colspan="14">
+                    <div class="pagination"><?php echo $output['page']; ?></div>
+                </td>
+            </tr>
+            </tfoot>
+        </table>
+    </form>
+</div>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/js/jquery.edit.js" charset="utf-8"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/laydate/laydate.js"></script>
+<script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
+<link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
+<script>
+    $(function () {
+        // 日期选择器
+        laydate.render({
+            elem: '#startTime',
+            type: 'datetime'
+        });
+        laydate.render({
+            elem: '#endTime',
+            type: 'datetime'
+        });
+        $('#ncsubmit').click(function () {
+            $('#formSearch').submit();
+        });
+        // 表格hover时背景
+        $('.trFlex').each(function () {
+            $(this).hover(function () {
+                $(this)[0].style.backgroundColor = '#cbe9f3'
+            },function() {
+                $(this)[0].style.backgroundColor = '#fff'
+            })
+        })
+    });
+</script>

+ 3 - 0
core/framework/function/http.php

@@ -22,6 +22,7 @@ function http_request($url, $params = array(), $method = 'GET', $multi = false,
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt($ci, CURLOPT_HEADER, false);
+    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 60);
     curl_setopt($ci, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
 
     $headers = (array) $extheaders;
@@ -87,6 +88,7 @@ function http_post_data($url, $body, $headers = array(),&$net_errno = 0)
     curl_setopt($ci, CURLOPT_POSTFIELDS, $body);
     curl_setopt($ci, CURLINFO_HEADER_OUT, TRUE);
     curl_setopt($ci, CURLOPT_URL, $url);
+    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 60);
     curl_setopt($ci, CURLOPT_POST, TRUE);
 
     if (!empty($headers)) {
@@ -116,6 +118,7 @@ function https_request($url, $params = array(), $method = 'GET', $multi = false,
     curl_setopt($ci, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ci, CURLOPT_SSL_VERIFYHOST, 2);
+    curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 60);
     curl_setopt($ci, CURLOPT_HEADER, false);
     $headers = (array) $extheaders;
     switch ($method)

+ 76 - 76
data/model/merchant.model.php

@@ -1,77 +1,77 @@
-<?php
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class merchantModel extends Model
-{
-    public function getMerchant($mchid)
-    {
-        return $this->table('merchant')->where(['mchid' => $mchid])->find();
-    }
-
-    public function addMerchant($insert){
-        return $this->table('merchant')->insert($insert);
-    }
-
-    public function getMerchantInfo($condition, $field = '*')
-    {
-        $result = $this->table('merchant')->where($condition)->field($field)->find();
-        return $result;
-    }
-
-    public function getMerchantList($condition, $page = null, $order = '', $field = '*', $limit = '')
-    {
-        $result = $this->table('merchant,member')->join('inner')->on('member.member_id=merchant.admin_id')
-            ->field($field)->where($condition)->order($order)->limit($limit)->page($page)->select();
-        return $result;
-    }
-
-
-    public function getPrices($mchid, $amount,$quality)
-    {
-        return $this->table('merchant_price')->where(['mchid' => $mchid, 'spec' => $amount , 'quality' => $quality])->select();
-    }
-
-    public function delPrices($condition){
-        return $this->table('merchant_price')->where($condition)->delete();
-    }
-
-    public function insertPrices($params){
-        return $this->table('merchant_price')->insertAll($params);
-    }
-
-    public function editMerchant($update, $condition)
-    {
-        return $this->table('merchant')->where($condition)->update($update);
-    }
-
-    public function getPdlog($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
-    {
-        $pdlog = $this->table('pd_log')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
-        if (empty($pdlog)) return [];
-        return $pdlog;
-    }
-
-    public function addRefillEvidence($params)
-    {
-        return $this->table('refill_evidence')->insert($params);
-    }
-
-    public function getRefillEvidence($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
-    {
-        $list = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
-        if (empty($list)) return [];
-        return $list;
-    }
-
-    public function getRefillEvidenceInfo($condition, $field = '*')
-    {
-        $result = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->where($condition)->field($field)->find();
-        return $result;
-    }
-
-    public function editRefillEvidence($condition , $update)
-    {
-        return $this->table('refill_evidence')->where($condition)->update($update);
-    }
+<?php
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class merchantModel extends Model
+{
+    public function getMerchant($mchid)
+    {
+        return $this->table('merchant')->where(['mchid' => $mchid])->find();
+    }
+
+    public function addMerchant($insert){
+        return $this->table('merchant')->insert($insert);
+    }
+
+    public function getMerchantInfo($condition, $field = '*')
+    {
+        $result = $this->table('merchant')->where($condition)->field($field)->find();
+        return $result;
+    }
+
+    public function getMerchantList($condition, $page = null, $order = '', $master = false, $field = '*', $limit = '')
+    {
+        $result = $this->table('merchant,member')->join('inner')->on('member.member_id=merchant.admin_id')
+            ->field($field)->where($condition)->order($order)->limit($limit)->page($page)->master($master)->select();
+        return $result;
+    }
+
+
+    public function getPrices($mchid, $amount,$quality)
+    {
+        return $this->table('merchant_price')->where(['mchid' => $mchid, 'spec' => $amount , 'quality' => $quality])->select();
+    }
+
+    public function delPrices($condition){
+        return $this->table('merchant_price')->where($condition)->delete();
+    }
+
+    public function insertPrices($params){
+        return $this->table('merchant_price')->insertAll($params);
+    }
+
+    public function editMerchant($update, $condition)
+    {
+        return $this->table('merchant')->where($condition)->update($update);
+    }
+
+    public function getPdlog($condition, $pagesize = '', $field = '*', $order = '', $limit = '')
+    {
+        $pdlog = $this->table('pd_log')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
+        if (empty($pdlog)) return [];
+        return $pdlog;
+    }
+
+    public function addRefillEvidence($params)
+    {
+        return $this->table('refill_evidence')->insert($params);
+    }
+
+    public function getRefillEvidence($condition, $pagesize = '', $field = '*', $order = '', $limit = '', $master = false)
+    {
+        $list = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->master($master)->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function getRefillEvidenceInfo($condition, $field = '*', $master = false)
+    {
+        $result = $this->table('refill_evidence,member')->join('inner')->on('member.member_id=refill_evidence.member_id')->where($condition)->field($field)->master($master)->find();
+        return $result;
+    }
+
+    public function editRefillEvidence($condition , $update)
+    {
+        return $this->table('refill_evidence')->where($condition)->update($update);
+    }
 }

+ 38 - 0
data/model/refill_refund.model.php

@@ -0,0 +1,38 @@
+<?php
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class refill_refundModel extends Model
+{
+    public function __construct()
+    {
+        parent::__construct('refill_refund');
+    }
+
+    public function getRefillRefundList($condition, $pagesize = '', $field = '*', $order = 'refund_time desc', $limit = '')
+    {
+        $list = $this->field($field)->where($condition)->page($pagesize)->order($order)->limit($limit)->select();
+        if (empty($list)) return [];
+        return $list;
+    }
+
+    public function addRefund($insert)
+    {
+        return $this->insert($insert);
+    }
+
+    public function getRefundInfo($condition)
+    {
+        return $this->where($condition)->find();
+    }
+
+    public function editRefund($update,$condition)
+    {
+        return $this->where($condition)->update($update);
+    }
+
+    public function DelRefund($condition)
+    {
+        return $this->where($condition)->delete();
+    }
+}

+ 1 - 1
helper/refill/RefillBase.php

@@ -135,7 +135,7 @@ class RefillBase
                     [$can_retry,$params] = $this->retry($refill_info, $order_info);
                     if ($can_retry)
                     {
-                        $mod_refill->edit($order_id, ['is_retrying' => 1]);
+                        $mod_refill->edit($order_id, ['is_retrying' => 1,'notify_time' => time()]);
                         $tran->commit();
                         util::push_add($params);
                         return true;

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

@@ -12,7 +12,7 @@ class config
     const QUERY_URL = 'https://esales.iyuanmai.com:28001/charge/mobileOrderQuery.do';
     const USER_ID = '202106261336161975';
     const KEY = 'a6f5b39a9ff14fc599a325b98dfc5308dd0dbf1829b044e18d1ea95ecf2f7ec46475be4ccf3e4855b8d9456766659f7b193293e8d67543cb824c523f34e16321';
-    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_yuanmai.php";
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yuanmai.php";
 
 //      测试环境
 //    const ORDER_URL = 'http://223.93.131.115:18080/charge/recharge.do';

+ 23 - 12
helper/refill/policy/chctl.php

@@ -169,8 +169,8 @@ class chctl
     const sleep_commit_count  = 5;
     const sleep_notify_count  = 5;
 
-
     const profit_count = 90;
+    const avg_order_time = 180;
 
 
     private function sleep_item($ctls)
@@ -369,7 +369,11 @@ class chctl
             return "{$name} {$state} time={$time} commit_succ={$commit_succ} notify_count={$notify_count} ratio={$ratio} profit_ratio={$profit_ratio}";
         };
 
-        $desc_profit = function ($l, $r) use($out_price,$formater) {
+        $left_times = intval($left_time / self::avg_order_time);
+        $left_times = $left_times <= 0 ? 1 : $left_times;
+        Log::record("left_times = {$left_times}",Log::DEBUG);
+
+        $desc_profit = function ($l, $r) use($out_price,$formater,$left_times) {
             [$lCount,$lRatio] = $l->notify_ratio();
             [$rCount,$rRatio] = $r->notify_ratio();
 
@@ -386,7 +390,17 @@ class chctl
             $lRatio  = $formater($lRatio);
             $rRatio  = $formater($rRatio);
 
-            if($lProfitRatio > $rRrofitRatio) return -1;
+            $lRatios = intval($lRatio * $left_times + 0.05);
+            $rRatios = intval($rRatio * $left_times + 0.05);
+            $lRatios = $lRatios > 1 ? 1 : $lRatios;
+            $rRatios = $rRatios > 1 ? 1 : $rRatios;
+
+            if($lRatios == $rRatios && $lRatios == 1) { //次数大概率成功,按利润优先
+                if($lProfit > $rRrofit) return -1;
+                elseif($lProfit < $rRrofit) return 1;
+                else return 0;
+            }
+            elseif($lProfitRatio > $rRrofitRatio) return -1;
             elseif($lProfitRatio < $rRrofitRatio) return 1;
             elseif($lProfitRatio == 0) //利润获得概率为0,说明成功率或者利润可能性为0
             {
@@ -463,7 +477,7 @@ class chctl
 
         $can_feed = true;
         $ctls = $speed_locker($names,$spec,$card_type,$quality);
-        [$sleeps,$workers] = $this->knockout($ctls,$spec);
+        [$sleeps,$workers] = $this->knockout($ctls,$out_price);
         $logger($sleeps,'sleeps');
         $logger($workers,'workers');
 
@@ -474,9 +488,11 @@ class chctl
             $ctls = $workers;
         }
 
+        //找出需要喂单
         [$feeds,$profits] = $this->feed_as_commit($ctls);
-
         usort($feeds, $desc_profit);
+
+        $profits = array_merge($profits, $sleeps);
         usort($profits, $desc_profit);
 
         $feed_names = [];
@@ -489,15 +505,10 @@ class chctl
             $profit_names[] = $item->name();
         }
 
-        $sleep_names = [];
-        foreach ($sleeps as $item) {
-            $sleep_names[] = $item->name();
-        }
-
         if ($can_feed) {
-            $result = array_merge($feed_names, $profit_names,$sleep_names);
+            $result = array_merge($feed_names, $profit_names);
         } else {
-            $result = array_merge($profit_names,$feed_names,$sleep_names);
+            $result = array_merge($profit_names,$feed_names);
         }
 
         $scan_feed = $can_feed ? 'true' : 'false';

+ 1 - 1
mobile/control/refill_evidence.php

@@ -16,7 +16,7 @@ class refill_evidenceControl extends mbMerchantControl
         if ($_GET['start_time'] && $_GET['end_time']) {
             $cond['add_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
         }
-        $list = $model_merchant->getRefillEvidence($cond, $this->page, '*', 'add_time desc', 10);
+        $list = $model_merchant->getRefillEvidence($cond, $this->page, '*', 'add_time desc', 10, true);
         $list = $this->RefillEvidenceFormat($list);
         $result['data'] = $list;
         $result['total'] = $model_merchant->gettotalpage();