public function view_ebaySaleExport() { $start = isset($_GET['start']) ? post_check($_GET['start']) : ''; $end = isset($_GET['end']) ? post_check($_GET['end']) : ''; $start = strtotime($start); $end = strtotime($end); //$start = 1396972800; //$end = 1399972800; $where = " where is_delete = 0"; if ($start != '') { $where .= " and feedbacktime >= '{$start}' "; } if ($end != '') { $where .= " and feedbacktime <= '{$end}' "; } $where .= " and (CommentType='Negative' or CommentType='Neutral' or status='21' or status='23' or status='31' or status='32')"; $FBAct = new EbayFeedbackAct(); $reasonList = $FBAct->act_getEbayReasonCategoryInfo('*', ''); $reasonArr = array(); foreach ($reasonList as $v) { $reasonArr[$v['id']] = $v['content']; } $where .= " order by account,id "; $field = " account,sku,CommentType,reasonId,CommentTime,feedbacktime,`status`,orderPayTime "; $fbkList = $FBAct->act_getOrderList($field, $where); $exporter = new ExportDataExcel("browser", "ebaySale_" . date('Y-m-d') . ".xls"); $exporter->initialize(); $exporter->addRow(array('帐号', 'SKU', '采购员', '评价类型', '中差评原因', '评价日期', '付款日期', '备注')); $comAct = new CommonAct(); foreach ($fbkList as $k => $v) { $comsku = ''; $comskulist = ''; $truesku = ''; $num = ''; $moresku = array(); $sku = trim($v['sku']); if ($comAct->act_judgeCombineSku($sku) > 0) { $combineSkuInfo = $comAct->act_getCombineSkuInfo('*', "WHERE combineSku = '{$sku}'"); $comsku = $sku; if (!empty($combineSkuInfo[0]['sku'])) { $truesku = $combineSkuInfo[0]['sku']; $sku = $truesku; } } $goodsInfo = $comAct->act_getGoodsInfo('purchaseId', "WHERE sku = '{$sku}'"); $purchaseId = $goodsInfo[0]['purchaseId']; $userInfo = $comAct->act_getPurchaserInfo('global_user_name', "WHERE global_user_id = '{$purchaseId}'"); $cguser = isset($userInfo[0]['global_user_name']) ? trim($userInfo[0]['global_user_name']) : ''; $account = trim($v['account']); $comment_type = trim($v['CommentType']); $resonId = trim($v['reasonId']); $feedback_note = $reasonArr[$resonId]; $comment_time = trim($v['CommentTime']); $feedbacktime = trim($v['feedbacktime']); $status = trim($v['status']); $feedbacktime = date('Y-m-d', $feedbacktime); $orderPayTime = trim($v['orderPayTime']); if (!empty($orderPayTime)) { $orderPayTime = date('Y-m-d', $orderPayTime); } else { $orderPayTime = ""; } if ($comment_type == "Neutral") { $type = "中评"; } else { $type = "差评"; } if ($status == '21' || $status == '23') { $type = "中评"; } else { if ($status == '31' || $status == '32') { $type = "差评"; } } $data = array($account, $sku, $cguser, $type, $feedback_note, $feedbacktime, $orderPayTime, $comsku); $exporter->addRow($data); } $exporter->finalize(); exit; }