private function _getOrderData(&$rs) { $printer = F('steward/print_city_' . steadmin::$adminInfo['city_id']); if (!$printer) { parent::setPrintCache(); $printer = F('steward/print_city_' . steadmin::$adminInfo['city_id']); if (!$printer) { showError('没有打印机信息'); } } $tmpData = array(); //先按店铺取商品数据 foreach ($rs['items'] as $val) { if (!isset($tmpData[$val['shop_id']])) { $tmpData[$val['shop_id']] = array('items' => array(), 'order_amount' => 0); } $tmpData[$val['shop_id']]['items'][] = array('goods_name' => $val['goods_name'], 'goods_spec' => $val['goods_spec'], 'goods_counts' => $val['goods_counts'], 'goods_price' => $val['goods_price'], 'goods_number' => $val['goods_number']); $tmpData[$val['shop_id']]['order_amount'] += $val['goods_counts'] * $val['goods_price']; } // $_getDeploymentUsers = array(); foreach ($tmpData as $key => $val) { $tmpData[$key]['order_amount'] = priceFormat($tmpData[$key]['order_amount']); $tmpData[$key]['shop_name'] = parent::_getShopName($key); // $tmpData[$key]['deployment'] = $this->_getDeploymentUser($key); $tmpData[$key]['print'] = isset($printer['shop'][$key]) ? $printer['shop'][$key][array_rand($printer['shop'][$key], 1)] : ''; if (!$tmpData[$key]['print']) { showError('店铺' . $tmpData[$key]['shop_name'] . '没有打印机信息'); } // $_getDeploymentUsers[] = $tmpData[$key]['deployment']; } $objData = array('info' => array('order_id' => $rs['order_id'], 'order_sn' => $rs['order_sn'], 'address' => $rs['address'], 'phone' => $rs['phone'], 'username' => $rs['username'], 'desc' => $rs['desc'], 'order_time' => outTime($rs['order_time']), 'arrive_date' => outTime($rs['arrive_date'], 2), 'arrive_time' => $rs['arrive_time'], 'order_amount' => $rs['order_amount'], 'shipping_fee' => $rs['shipping_fee'], 'offset' => $rs['credit_offset'] + $rs['coupon_offset'] + $rs['sales_offset'], 'printCounts' => count($tmpData), 'order_no' => sprintf("%04d", D('steorder')->where(array('status[>=]' => 3, 'status[<=]' => 11, 'arrive_date' => $rs['arrive_date'], 'service_id' => $rs['service_id']))->count() + 1)), 'print' => isset($printer['zone'][$rs['service_id']]) ? $printer['zone'][$rs['service_id']][array_rand($printer['zone'][$rs['service_id']], 1)] : '', 'order' => $tmpData); if (!$objData['print']) { showError('该服务点没有打印机信息'); } // F('test_order_data',$objData); // z($objData); return $objData; }