Your Name 2 년 전
부모
커밋
d452df1bee
3개의 변경된 파일58개의 추가작업 그리고 7개의 파일을 삭제
  1. 12 0
      app/shop/database/sell_order.php
  2. 14 1
      service/agent/database/dh_order_ps.php
  3. 32 6
      service/agent/lib/Dhorder.php

+ 12 - 0
app/shop/database/sell_order.php

@@ -997,5 +997,17 @@ return array
             'type' => 'one',
             'col' => 'sum(card_code_cash) as total',
         ),
+
+        'getSellDui' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'id' => 'yes',
+                'state' => 1,
+            ),
+            'type' => 'one',
+            'col' => 'num',
+        ),
     ),
 );

+ 14 - 1
service/agent/database/dh_order_ps.php

@@ -148,6 +148,19 @@ return array
 
     'request' => array
     (
-        
+        'getDui' => array
+        (
+            # 匹配的正则或函数 选填项
+            'option' => array
+            (
+                'mid' => 'yes',
+                'start' => array('yes-cdate','>='),
+                'end' => array('yes-cdate','<='),
+                'state' => 1,
+            ),
+            'type' => 'one',
+            
+            'col' => '*',
+        ),
     ),
 );

+ 32 - 6
service/agent/lib/Dhorder.php

@@ -1333,12 +1333,13 @@ class Dhorder
                 $res[1][$key] = $v['name'];
             }
         }
-        
         return $res;
     }
     public function out_equity_api($data){
         $start = Dever::input('search_option_start_udate');
         $end = Dever::input('search_option_end_udate');
+        $fstart = Dever::input('search_option_start_dever_auth');
+        $fend = Dever::input('search_option_end_dever_auth');
         if($start && $end){
             $where['start'] = $start;
             $where['end'] = $end;
@@ -1347,9 +1348,17 @@ class Dhorder
             $where['end'] = strtotime(date('Y-m-d 23:59:59',
                 strtotime(date('Y-m-01')."+1 month - 1 day")));
         }
+        $w = array();
+        if ($fstart) {
+            $w['start'] = $fstart;
+        }
+        if ($fend) {
+            $w['end'] = $fend;
+        }
+
         $where['type'] = '1,2';
         $res = $this->head(1);
-        $header = array('基础信息', '', '', '', '','', '', '', '', '');
+        $header = array('基础信息', '', '', '', '','', '', '', '');
         $body = array();
         $pg = Dever::input('pg');
         if ($pg == 1) {
@@ -1435,6 +1444,7 @@ class Dhorder
             foreach ($res[0] as $k1 => $v1) {
                 list($type, $type_id) = explode('_', $k1);
                 $goods[$k1] = Dever::db('agent/member_goods')->getTotal(array('end'=>$where['end'],'mid'=>$v['mid'],'type'=>$type, 'type_id' => $type_id));
+                
                 $d[$i] = 0;
                 if ($goods[$k1]) {
                     if(strstr($v1[0],'卡')){
@@ -1460,7 +1470,6 @@ class Dhorder
                    } else {
                         $caipin_cash += $goods[$k1]['cash'] ? $goods[$k1]['cash'] : 0;
                    }
-                    // if ($v)
                     
                 }
                 
@@ -1478,7 +1487,18 @@ class Dhorder
                     if (strstr($v1,'卡')) {
                         $d[$i] = $goods[$k1]['cash']*$goods[$k1]['sell_num'] ? $goods[$k1]['cash']*$goods[$k1]['sell_num'] : 0;
                     } else {
-                        $d[$i] = $goods[$k1]['sell_num'] ? $goods[$k1]['sell_num'] : 0;
+                        $w1 = $w;
+                        $w1['mid'] = $v['mid'];
+                        $order_ps[$k1] = Dever::db('agent/dh_order_ps')->getDui($w1);
+                        foreach($order_ps as $a => $b){
+                            $pc_order = Dever::db('shop/sell_order')->getSellDui(array('id'=>$b['order_id']));
+                            if($pc_order){
+
+                             $d[$i] += $pc_order['num'];
+                            }
+                        }
+                       
+                        // $d[$i] = $goods[$k1]['sell_num'] ? $goods[$k1]['sell_num'] : 0;
                     }
                 }
                 $i++;
@@ -1486,12 +1506,18 @@ class Dhorder
            
             foreach ($res[2] as $k1 => $v1) {
                 list($type, $type_id) = explode('_', $k1);
-                $sku = Dever::db('agent/member_goods')->getCardAll(array('end'=>$where['end'],'type_id'=>$type_id,'type'=>$type,'mid'=>$v['mid']));
+                $w1 = array();
+                $w1['mid'] = $v['mid'];
+                $w1['type'] = $type;
+                $w1['type_id'] = $type_id;
+                $sku = Dever::db('agent/member_goods')->getCardAll($w1);
                 $array = array_column($sku, 'sku_id');
                 $sku_id = implode(",",$array);
 
                 if($sku_id){
-                    $sell_order[$k1] = Dever::db('shop/sell_order')->getCardAlls(array('end'=>$where['end'],'card_code_id'=>$sku_id));
+                    $w1 = $w;
+                    $w1['card_code_id'] = $sku_id;
+                    $sell_order[$k1] = Dever::db('shop/sell_order')->getCardAlls($w1);
                 }else{
                     $sell_order[$k1]['total'] = 0;
                 }