strtotime(date('Y-m-1')), 'sale_time|sthan' => strtotime(date('Y-m-d 23:59:59')), 'shop_id' => $skuList['bill']['shop_id'] ); $sales = app::get('ome')->model('sales')->getList('sale_id', $saleFilter); if(empty($sales)) { return array(); } $sql = "select product_id, sum(sales_amount) as sales_all from sdb_ome_sales_items where sale_id in('".implode("','", array_map('current', $sales))."') and product_id in('".implode("','", $this->originalSkuId)."') group by product_id"; $saleItems = kernel::database()->select($sql); if(empty($saleItems)) { return array(); } $porth = array(); foreach ($saleItems as $v) { if($this->originalSkuCombinationItems[$v['product_id']]) { $tmpCI = $this->originalSkuCombinationItems[$v['product_id']]; $options = array ( 'part_total' => $v['sales_all'], 'part_field' => 'money', 'porth_field' => $tmpCI['porth'], ); $items = kernel::single('ome_order')->calculate_part_porth($tmpCI['items'], $options); foreach ($items as $iv) { $porth[$iv['bm_id']] += $iv['money']; } } else { $porth[$v['product_id']] += $v['sales_all']; } } return $porth; } }