Your Name 3 gadi atpakaļ
vecāks
revīzija
48b733dfbd
2 mainītis faili ar 27 papildinājumiem un 0 dzēšanām
  1. 12 0
      service/bill/database/shop_stat.php
  2. 15 0
      service/bill/lib/Cron.php

+ 12 - 0
service/bill/database/shop_stat.php

@@ -198,6 +198,18 @@ $config = array
             'list_order' => 8,
         ),
 
+        'nei_money'      => array
+        (
+            'type'      => 'decimal-11,2',
+            'name'      => '名额内创V<br/>业绩',
+            'default'   => '0',
+            'desc'      => '创V名额内业绩',
+            'match'     => 'is_numeric',
+            'update'    => 'text',
+            'list'      => true,
+            'list_order' => 9,
+        ),
+
         'state'     => array
         (
             'type'      => 'tinyint-1',

+ 15 - 0
service/bill/lib/Cron.php

@@ -555,6 +555,13 @@ class Cron
                             $shop[$k]['out_money'][] = Dever::db('agent/order')->getVCount(array('mid'=>$v3['id'],'start'=>$v['cdate'][$k1],'end'=>$end,'role'=>8,'state'=>1));
                         }
                     }
+                    #创V名额内业绩
+                    $nei = Dever::db('agent/member')->guidian(array('parent_mid'=>$v1,'start'=>$v['cdate'][$k1],'role'=>8,'prize_type'=>2));
+                    if(isset($nei) && $nei){
+                        foreach($nei as $v3){
+                            $shop[$k]['nei_money'][] = Dever::db('agent/order')->getVCount(array('mid'=>$v3['id'],'start'=>$v['cdate'][$k1],'end'=>$end,'role'=>8,'state'=>1));
+                        }
+                    }
                 // }
                 
              }
@@ -603,6 +610,13 @@ class Cron
             }else{
                 $shop[$key]['out_money'] = 0;
             }
+
+            #创V名额内业绩
+            if(isset($val['nei_money']) && $val['nei_money']){
+                $shop[$key]['nei_money'] = array_sum(array_map(function($val){return $val['total'];}, $val['nei_money']));
+            }else{
+                $shop[$key]['nei_money'] = 0;
+            }
            
             $insert['shop_id'] = $val['id'];
             $insert['mids'] = $val['mids'];
@@ -616,6 +630,7 @@ class Cron
             $insert['month'] = $start;
             $insert['out_num'] = $val['out_num'];
             $insert['out_money'] = $shop[$key]['out_money'];
+            $insert['nei_money'] = $shop[$key]['nei_money'];
 
             if($insert){
                 $res = Dever::db('bill/shop_stat')->getState(array('start'=>$start,'end'=>$end,'shop_id'=>$insert['shop_id'],'state'=>1));