Переглянути джерело

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

stanley-king 3 роки тому
батько
коміт
9b5a895041

+ 18 - 2
admin/control/merchant.php

@@ -9,6 +9,7 @@ defined('InShopNC') or exit('Access Invalid!');
 require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
 require_once(BASE_CONFIG_PATH . CONFIG_PREFIX . '/refill.ini.php');
 require_once(BASE_ROOT_PATH . '/core/framework/function/http.php');
+require_once(BASE_HELPER_PATH . '/stat_helper.php');
 
 class merchantControl extends SystemControl
 {
@@ -1228,8 +1229,23 @@ class merchantControl extends SystemControl
         if (empty($stats_data)) {
             showMessage('对应数据不存在', '');
         }
-
-        showMessage('操作成功');
+        $refill = new statistics\stat_refill();
+        try {
+            $trans = new trans_wapper($mod_stat, __METHOD__);
+            //删除旧数据
+            $mod_stat->delStats(['stat_id' => $stat_id]);
+            //更新新数据
+            if($stats_data['type'] == 'merchant') {
+                $refill->merchant_stat($stats_data['time_stamp'],$stats_data['cid']);
+            }elseif ($stats_data['type'] == 'provider') {
+                $refill->provider_stat($stats_data['time_stamp'],$stats_data['cid']);
+            }
+            $trans->commit();
+            showMessage('操作成功');
+        } catch (Exception $e) {
+            $trans->rollback();
+            showMessage('操作失败');
+        }
     }
 
     public function provider_evidenceOp()

+ 4 - 4
admin/templates/default/system.order.stats.php

@@ -73,7 +73,7 @@
                 <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>
@@ -92,9 +92,9 @@
                         <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 w200">
-                            <a href="index.php?act=merchant&op=OrderStatsReload&stat_id=<?php echo $v['stat_id'];?>">重新统计</a>
-                        </td>
+<!--                        <td class="align-center w200">-->
+<!--                            <a href="index.php?act=merchant&op=OrderStatsReload&stat_id=--><?php //echo $v['stat_id'];?><!--">重新统计</a>-->
+<!--                        </td>-->
                     </tr>
                 <?php } ?>
             <?php } else { ?>

+ 5 - 5
data/config/lingzh/refill.ini.php

@@ -15,11 +15,11 @@ $config['refill_specs'] = [
 
 $haohao_oil = ['name' => 'haohao', 'store_id' => 58,'qualitys' => '1',
     'amount' => [
-        100 => [['goods_id' => 140, 'price' => 96.8, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
-        200 => [['goods_id' => 141, 'price' => 193.6, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
-        300 => [['goods_id' => 142, 'price' => 290.4, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
-        500 => [['goods_id' => 143, 'price' => 484, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
-        1000 => [['goods_id' => 144, 'price' => 968, 'quality' => 1, 'card_type' => 'petrochina,sinopec']]
+        100 => [['goods_id' => 140, 'price' => 96.5, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        200 => [['goods_id' => 141, 'price' => 193, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        300 => [['goods_id' => 142, 'price' => 289.5, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        500 => [['goods_id' => 143, 'price' => 482.5, 'quality' => 1, 'card_type' => 'petrochina,sinopec']],
+        1000 => [['goods_id' => 144, 'price' => 965, 'quality' => 1, 'card_type' => 'petrochina,sinopec']]
     ],
     'period' => [], 'refill_type' => 'api'];
 

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

@@ -125,11 +125,11 @@ $zeheng_oil = ['name' => 'zeheng', 'store_id' => 51,'qualitys' => '1',
 
 $lingzh_oil = ['name' => 'lingzhoil', 'store_id' => 56, 'qualitys' => '1',
     'amount' => [
-        100 => [['goods_id' => 6579, 'price' => 96.9, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
-        200 => [['goods_id' => 6580, 'price' => 193.8, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
-        500 => [['goods_id' => 6581, 'price' => 484.5, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
-        1000 => [['goods_id' => 6582, 'price' => 969, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
-        2000 => [['goods_id' => 6583, 'price' => 1938, 'quality' => 1, 'card_type' => 'sinopec,petrochina']]
+        100 => [['goods_id' => 6579, 'price' => 96.6, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
+        200 => [['goods_id' => 6580, 'price' => 193.2, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
+        500 => [['goods_id' => 6581, 'price' => 483, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
+        1000 => [['goods_id' => 6582, 'price' => 966, 'quality' => 1, 'card_type' => 'sinopec,petrochina']],
+        2000 => [['goods_id' => 6583, 'price' => 1932, 'quality' => 1, 'card_type' => 'sinopec,petrochina']]
     ],
     'period' => [], 'refill_type' => 'api'];
 

+ 4 - 0
data/model/refill_stats.model.php

@@ -28,4 +28,8 @@ class refill_statsModel extends Model
     {
         return $this->where(['stat_id' => $stat_id])->update($data);
     }
+
+    public function delStats($condition){
+        return $this->where($condition)->delete();
+    }
 }

+ 2 - 2
helper/statistics/stat_refill.php

@@ -145,7 +145,7 @@ class stat_refill
         return $order_count;
     }
 
-    private function merchant_stat($day_time,$cur_mchid = 0)
+    public function merchant_stat($day_time,$cur_mchid = 0)
     {
         $cond = [
             'refill_order.inner_status' => 0,
@@ -185,7 +185,7 @@ class stat_refill
             Model('')->table('refill_stats')->insert($params);
         }
     }
-    private function provider_stat($day_time,$cur_storeid = 0)
+    public function provider_stat($day_time,$cur_storeid = 0)
     {
         $cond = [
             'refill_order.inner_status' => 0,