public static function showAliexpressSurfaceList($field, $where) { self::initDB(); $sql = "select {$field} from om_aliexpress_surface where {$where} "; //echo $sql;exit; $queryresult = self::$dbConn->query($sql); if (empty($queryresult)) { //更新失败 self::$errCode = '005'; self::$errMsg = '更新状态失败!'; return FALSE; } return self::$dbConn->fetch_array_all($queryresult); }
public function act_aliTagShipLog() { $time = strtotime($_REQUEST['time']); $accountId = $_REQUEST['account']; $lastTime = $time + 86400; //86400秒=1天 // $data = array(); // //home/ebay_order_cronjob_logs/aliexpress/shipment/order_shipment_$account_$time.log // $file = "/home/ebay_order_cronjob_logs/aliexpress/shipment/order_shipment_$account_$time.log"; // //$file = "E:/erpNew/order.valsun.cn/log/shipment/order_shipment_".$account."_".$time.".log"; // $fh = @fopen($file,"r"); // if($fh){ // while (!feof($fh)) { // $data[] = fgets($fh); // } // } // fclose($fh); //将文件导入改为从数据库导入 $ret = AliexpressSurfaceModel::showAliexpressSurfaceList("*", "1 and use_account='{$accountId}' and shipingtime<{$lastTime} and shipingtime>{$time}"); foreach ($ret as $k => $v) { switch ($v['carrier']) { case "4": // 香港小包挂号 $ret[$k]['carrier'] = 'HKPAM'; // Hongkong Post Air Mail break; case "46": // UPS $ret[$k]['carrier'] = 'UPS'; break; case "8": // DHL $ret[$k]['carrier'] = 'DHL'; break; case "9": // Fedex $ret[$k]['carrier'] = 'FEDEX_IE'; break; case "70": $ret[$k]['carrier'] = 'TNT'; break; case "5": $ret[$k]['carrier'] = 'EMS'; break; case "2": // 中国邮政挂号 $ret[$k]['carrier'] = 'CPAM'; // China Post Air Mail break; case "6": // EUB $ret[$k]['carrier'] = 'EMS_ZX_ZX_US'; // EUB break; case "52": // 新加坡小包挂号 $ret[$k]['carrier'] = 'SGP'; break; case "61": // WEDO $ret[$k]['carrier'] = 'Other'; break; default: break; } $ret[$k]['packingstatus'] = $v['packingstatus'] == '1' ? '非合并包裹' : '合并包裹'; } $fileName = "export_ali_tag_ship_log_" . date("Y-m-d_H_i_s") . ".xls"; $excel = new ExportDataExcel('browser', $fileName); $excel->initialize(); $excel->addRow(array('序号', '订单号', '快递简称', '快递单号', '发货类别', '同步结果')); foreach ($ret as $k => $v) { $row = array($v['id'], $v['order_id'], $v['carrier'], $v['trackno'], $v['packingstatus'], $v['mark_msg']); $excel->addRow($row); } unset($data); $excel->finalize(); exit; }