function initPcGoodsCombine() { $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $pcGoodsCombineList = $omAvailableAct->act_getTNameList('pc_goods_combine', '*', $where); if (count($pcGoodsCombineList) == 0) { return false; } $expire = 0; global $memc_obj; foreach ($pcGoodsCombineList as $value) { $combineSku = $value['combineSku']; $relationArr = array(); $relationList = $omAvailableAct->act_getTNameList('pc_sku_combine_relation', 'sku,count', "WHERE combineSku='{$combineSku}'"); if (!empty($relationList)) { foreach ($relationList as $tmp) { $relationArr[] = $tmp; } } $value['detail'] = $relationArr; $key = 'pc_goods_combine_' . $combineSku; $ret = $memc_obj->set_extral($key, $value, $expire); echo 'key=' . $key . "\n"; if (!$ret) { echo $key; echo '写入缓存出错,请查看mencache相关信息'; return false; } } return true; }
function initPurchaser2Id() { $omAvailableAct = new OmAvailableAct(); $where = ''; $field = 'global_user_id, global_user_name'; $resultList = $omAvailableAct->act_getTNameList('power_global_user', $field, $where); if (count($resultList) == 0) { return false; } //$expire = 0; global $memc_obj, $global_expire; foreach ($resultList as $result) { $id = $result['global_user_id']; $name = $result['global_user_name']; if ($name == '') { continue; } $key = 'purchase_purchaser_name_' . $name; $ret = $memc_obj->set_extral($key, $id, $global_expire); echo "key = {$key} \n"; if (!$ret) { echo $key; echo '写入缓存出错,请查看mencache相关信息/n'; return false; } } return true; }
function initPcGoodsCategorys() { $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $pcGoodsCategoryList = $omAvailableAct->act_getTNameList('pc_goods_category', '*', $where); if (count($pcGoodsCategoryList) == 0) { return false; } $expire = 0; global $memc_obj; $key = 'pc_goods_category_all'; $ret = $memc_obj->set_extral($key, $pcGoodsCategoryList, $expire); echo 'key=' . $key . "\n"; if (!$ret) { echo $key; echo '写入缓存出错,请查看mencache相关信息'; return false; } return true; }
public function view_getSpuPrefixList() { //调用action层, 获取列表数据 $omAvailableAct = new OmAvailableAct(); $status = $_GET['status'] ? $_GET['status'] : ''; $tName = 'pc_auto_create_spu_prefix'; $select = '*'; $where = 'WHERE 1=1 '; $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "order by id " . $page->limit; $spuPrefixList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=spu&act=getSpuPrefixList', 'title' => 'SPU自动生成前缀管理')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 24); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', 'SPU自动生成前缀管理'); $this->smarty->assign('status', $status); $this->smarty->assign('spuPrefixList', empty($spuPrefixList) ? null : $spuPrefixList); $this->smarty->display("spuPrefixList.htm"); }
function initPcGoods() { $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $pcGoodsList = $omAvailableAct->act_getTNameList('pc_goods', '*', $where); if (count($pcGoodsList) == 0) { return false; } $expire = 0; global $memc_obj; foreach ($pcGoodsList as $value) { $sku = $value['sku']; $key = 'pc_goods_' . $sku; $ret = $memc_obj->set_extral($key, $value, $expire); echo 'key=' . $key . "\n"; if (!$ret) { echo $key; echo '写入缓存出错,请查看mencache相关信息'; return false; } } return true; }
function initPcPm() { $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $pcPmList = $omAvailableAct->act_getTNameList('pc_packing_material', '*', $where); if (count($pcPmList) == 0) { return false; } $expire = 0; global $memc_obj; foreach ($pcPmList as $value) { $pmId = $value['id']; $key = 'pc_pm_' . $pmId; $ret = $memc_obj->set_extral($key, $value, $expire); echo 'key=' . $key . "\n"; if (!$ret) { echo $key; echo '写入缓存出错,请查看mencache相关信息'; return false; } } return true; }
public function view_deleteBlackList() { $id = isset($_GET['id']) ? post_check($_GET['id']) : ''; $status = ''; if (intval($id) == 0) { $status = '数据异常,删除失败'; header("location:index.php?mod=omBlackList&act=getOmBlackList&status={$status}"); exit; } $omAvailableAct = new OmAvailableAct(); $tName = 'om_blacklist'; $where = "WHERE is_delete=0 and id='{$id}'"; $count = $omAvailableAct->act_getTNameCount($tName, $where); if (!$count) { $status = '记录不存在,删除失败'; header("location:index.php?mod=omBlackList&act=getOmBlackList&status={$status}"); exit; } $set = "SET is_delete=1 "; $where = "WHERE id='{$id}'"; $affectRow = $omAvailableAct->act_updateTNameRow($tName, $set, $where); if ($affectRow) { $status = '删除成功'; } else { $status = '删除失败'; } header("location:index.php?mod=omBlackList&act=getOmBlackList&status={$status}"); }
/** *功能:获取用户表信息 *@return $ret array 用户数据 * */ public function getPurchaseUser() { $fields = " global_user_id as id,global_user_name as username "; $table = "power_global_user"; $where = "WHERE global_user_is_delete =0 AND global_user_status = 1 AND global_user_dept = 6 ORDER BY username ASC "; $ret = OmAvailableAct::getTNameList($table, $fields, $where); if (isset($ret[0]['id'])) { return $ret; } self::$errCode = '0130'; self::$errMsg = "获取采购列表失败"; }
<?php define('SCRIPTS_PATH_CRONTAB', '/data/web/purchase.valsun.cn/crontab/'); require_once SCRIPTS_PATH_CRONTAB . "scripts.comm.php"; $omAvailableAct = new OmAvailableAct(); $where = ''; $resultList = $omAvailableAct->act_getTNameList('ebay_partner', '*', $where); if (count($resultList) == 0) { return false; } $partner = array(); foreach ($resultList as $key => $result) { $partner['id'] = $result['id']; $partner['company_name'] = $result['company_name']; $partner['username'] = $result['username']; $partner['tel'] = $result['tel']; $partner['phone'] = $result['mobile']; $partner['fax'] = $result['fax']; $partner['QQ'] = $result['QQ']; $partner['AliIM'] = $result['AliIM']; $partner['shoplink'] = $result['shop_link']; $partner['e_mail'] = $result['mail']; $partner['address'] = $result['address']; $partner['note'] = $result['note']; $partner['city'] = $result['city']; $partner['sms_status'] = $result['is_sms']; $partner['email_status'] = $result['is_email']; $purchaser = isset($result['purchaseuser']) ? trim($result['purchaseuser']) : ''; $purchaserId = getPurchaserId($purchaser); $partner['purchaseuser_id'] = $purchaserId; $partner['company_id'] = 1;
function __handle_ebay_orderxml(&$SellerOrderArray, $ebay_account) { global $FLIP_GLOBAL_EBAY_ACCOUNT; if (!isset($FLIP_GLOBAL_EBAY_ACCOUNT)) { $omAvailableAct = new OmAvailableAct(); $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 '); $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT); } global $mctime, $_allow_spide_itemid; $account_suffix = get_account_suffix($ebay_account); $message = ""; foreach ($SellerOrderArray as $SellerOrder) { //每个订单号 $oSellerOrderID = $SellerOrder->getElementsByTagName('OrderID')->item(0)->nodeValue; //oCreatingUserRole用于判断是否是 combined payments $oCreatingUserRole = @$SellerOrder->getElementsByTagName('CreatingUserRole')->item(0)->nodeValue; $oAmountPaid = $SellerOrder->getElementsByTagName('AmountPaid')->item(0)->nodeValue; $shippingDeatil = $SellerOrder->getElementsByTagName('ShippingDetails')->item(0); $oRecordNumber = $shippingDeatil->getElementsByTagName('SellingManagerSalesRecordNumber')->item(0)->nodeValue; $shippingDeatil = null; unset($shippingDeatil); //订单状态 $CheckoutStatus = $SellerOrder->getElementsByTagName('CheckoutStatus')->item(0); $LastTimeModified = strtotime($CheckoutStatus->getElementsByTagName('LastModifiedTime')->item(0)->nodeValue); $oeBayPaymentStatus = $CheckoutStatus->getElementsByTagName('eBayPaymentStatus')->item(0)->nodeValue; $oCompleteStatus = $CheckoutStatus->getElementsByTagName('Status')->item(0)->nodeValue; $oCheckStatus = $CheckoutStatus->getElementsByTagName('Status')->item(0)->nodeValue; $CheckoutStatus = null; unset($CheckoutStatus); //该订单交易信息 $osoTransArray = $SellerOrder->getElementsByTagName('Transaction'); //其他交易信息比如payapl整合到ebay $oTid = 0; //兼容表结构,其实此时还没有交易号的概念 $ExtTran = $SellerOrder->getElementsByTagName('ExternalTransaction')->item(0); $noptid_trans = false; if (!empty($ExtTran)) { $oPtid = $ExtTran->getElementsByTagName('ExternalTransactionID')->item(0)->nodeValue; $oFeeOrCreditAmount = $ExtTran->getElementsByTagName('FeeOrCreditAmount')->item(0)->nodeValue; } else { $oPtid = '0'; $oFeeOrCreditAmount = 0.0; echo " Notice : [{$oSellerOrderID}]Not ebay offical paypal trans\n"; $noptid_trans = true; } //以下信息强制以订单的transation数据中第一条交易为准而取 if (is_object($osoTransArray->item(0)->getElementsByTagName('Buyer')->item(0))) { $oEmail = str_rep($osoTransArray->item(0)->getElementsByTagName('Buyer')->item(0)->getElementsByTagName('Email')->item(0)->nodeValue); } else { echo "\n同步订单未获取邮箱\n"; $oEmail = ""; } $oSite = str_rep($osoTransArray->item(0)->getElementsByTagName('Item')->item(0)->getElementsByTagName('Site')->item(0)->nodeValue); if (empty($oSite)) { $oSite = str_rep($osoTransArray->item(0)->getElementsByTagName('TransactionSiteID')->item(0)->nodeValue); } //货币类型 $oCurrency = $osoTransArray->item(0)->getElementsByTagName('TransactionPrice')->item(0)->attributes->item(0)->nodeValue; //userid $oUserID = str_rep($SellerOrder->getElementsByTagName('BuyerUserID')->item(0)->nodeValue); $BuyerInfo = $SellerOrder->getElementsByTagName('ShippingAddress')->item(0); $oName = str_rep($BuyerInfo->getElementsByTagName('Name')->item(0)->nodeValue); $oName = mysql_real_escape_string($oName); $oStreet1 = str_rep($BuyerInfo->getElementsByTagName('Street1')->item(0)->nodeValue); $oStreet2 = str_rep($BuyerInfo->getElementsByTagName('Street2')->item(0)->nodeValue); $oCityName = str_rep($BuyerInfo->getElementsByTagName('CityName')->item(0)->nodeValue); $oStateOrProvince = str_rep($BuyerInfo->getElementsByTagName('StateOrProvince')->item(0)->nodeValue); $oCountry = str_rep($BuyerInfo->getElementsByTagName('Country')->item(0)->nodeValue); $oCountryName = str_rep($BuyerInfo->getElementsByTagName('CountryName')->item(0)->nodeValue); $oPostalCode = str_rep($BuyerInfo->getElementsByTagName('PostalCode')->item(0)->nodeValue); $oPhone = $BuyerInfo->getElementsByTagName('Phone')->item(0)->nodeValue; $BuyerInfo = null; unset($BuyerInfo); //顾客留言 $oBuyerCheckoutMessage = @str_rep($SellerOrder->getElementsByTagName('BuyerCheckoutMessage')->item(0)->nodeValue); //顾客购买留言 $oBuyerCheckoutMessage = str_replace('<![CDATA[', '', $oBuyerCheckoutMessage); $oBuyerCheckoutMessage = str_replace(']]>', '', $oBuyerCheckoutMessage); //付款时间 $oPaidTime = strtotime($SellerOrder->getElementsByTagName('PaidTime')->item(0)->nodeValue); $oCreateTime = strtotime($SellerOrder->getElementsByTagName('CreatedTime')->item(0)->nodeValue); $oShippedTime = @strtotime($SellerOrder->getElementsByTagName('ShippedTime')->item(0)->nodeValue); $SSS = $SellerOrder->getElementsByTagName('ShippingServiceSelected')->item(0); $oShipingService = $SSS->getElementsByTagName('ShippingService')->item(0)->nodeValue; $oShipingFee = $SSS->getElementsByTagName('ShippingServiceCost')->item(0)->nodeValue; $SSS = null; unset($SSS); //店铺收款paypal account //$oPayPalEmailAddress = @$SellerOrder->getElementsByTagName('PayPalEmailAddress')->item(0)->nodeValue; $_itemid = $osoTransArray->item(0)->getElementsByTagName('ItemID')->item(0)->nodeValue; $oPayPalEmailAddress = $this->getPayPalEmailAddress($_itemid); //var_dump($Item_Elements); //$oPayPalEmailAddress = $Item_Elements->getElementsByTagName('PayPalEmailAddress')->nodeValue; //echo $oCompleteStatus."======".$oeBayPaymentStatus."======".$oPaidTime; echo "\n"; if ($oCompleteStatus == "Complete" && $oeBayPaymentStatus == "NoPaymentFailure" && $oPaidTime > 0) { $oOrderStatus = 1; } if ($noptid_trans === true) { //不是通过ebay官方交易的paypal交易 if ($oCompleteStatus == "Complete" && $oeBayPaymentStatus == "NoPaymentFailure" && $oPaidTime > 0) { $oOrderStatus = 687; } } $is_allow_spide_itemid = false; if ($oPaidTime <= 0 || $oPaidTime == '' || empty($oPaidTime) && count($osoTransArray) == 1) { $_QuantityPurchased = $osoTransArray->item(0)->getElementsByTagName('QuantityPurchased')->item(0)->nodeValue; if (in_array($_itemid, $_allow_spide_itemid) && $_QuantityPurchased > 0) { echo "未付款促销订单抓取--------"; $oOrderStatus = $_QuantityPurchased == 1 ? 687 : 688; $oAmountPaid = 9999; $oPaidTime = $oCreateTime; $is_allow_spide_itemid = true; $buyAddress = $this->getSellerTransactions($oSellerOrderID); $oName = str_rep($buyAddress->getElementsByTagName('Name')->item(0)->nodeValue); $oName = mysql_real_escape_string($oName); $oStreet1 = str_rep($buyAddress->getElementsByTagName('Street1')->item(0)->nodeValue); $oCityName = str_rep($buyAddress->getElementsByTagName('CityName')->item(0)->nodeValue); $oStateOrProvince = str_rep($buyAddress->getElementsByTagName('StateOrProvince')->item(0)->nodeValue); $oCountry = str_rep($buyAddress->getElementsByTagName('Country')->item(0)->nodeValue); $oCountryName = str_rep($buyAddress->getElementsByTagName('CountryName')->item(0)->nodeValue); $oPostalCode = str_rep($buyAddress->getElementsByTagName('PostalCode')->item(0)->nodeValue); $oPhone = $buyAddress->getElementsByTagName('Phone')->item(0)->nodeValue; } } if ($oShippedTime > 0) { $oOrderStatus = 2; } //已经发货 $oRefundAmount = 0; //表示未垦退款 if ($oOrderStatus == 1 && $oShippedTime <= 0 && $oPaidTime > 0 || $oOrderStatus == 4 && $oShippedTime <= 0 || in_array($oOrderStatus, array(687, 688)) && $oShippedTime <= 0 && $is_allow_spide_itemid == true) { echo "eBay订单号[{$oSellerOrderID}]有效 ,订单类型[{$oOrderStatus}] "; $check_ebayorderid = true; //检查汇总表该 eBay 订单号是否已经存在 //echo "===={$oSellerOrderID}==={$ebay_account}====";//检测重复抓单信息 $where = " where orderid='" . $oSellerOrderID . "' and accountId='" . $FLIP_GLOBAL_EBAY_ACCOUNT[$ebay_account] . "' "; $check_ebayorderid = OrderidsModel::judgeOrderidsList('orderid', $where); //取消 $check_ebayorderid == false; $new_ebay_id = true; if ($check_ebayorderid === false) { //添加订单汇总 /* 生成一个本地系统订单号 */ //$our_sys_ordersn=date('Y-m-d-His').mt_rand(100,999).$oRecordNumber; $oorder_no = ''; //已废弃 $isNote = 0; if (!empty($oBuyerCheckoutMessage)) { $isNote = 1; } $orderData = array(); $orderData = array('orderData' => array('recordNumber' => $oRecordNumber, 'platformId' => 1, 'accountId' => $FLIP_GLOBAL_EBAY_ACCOUNT[$ebay_account], 'ordersTime' => $oCreateTime, 'paymentTime' => $oPaidTime, 'onlineTotal' => $oAmountPaid, 'actualTotal' => $oAmountPaid, 'transportId' => '', 'actualShipping' => $oShipingFee, 'orderStatus' => C("STATEPENDING"), 'orderType' => C("STATEPENDING_CONV"), 'orderAttribute' => 1, 'channelId' => '', 'orderAddTime' => $mctime, 'isNote' => $isNote, 'storeId' => 1), 'orderExtenData' => array('declaredPrice' => 0.0, 'paymentStatus' => $oCompleteStatus, 'transId' => 1, 'PayPalPaymentId' => $oPtid, 'site' => $oSite, 'orderId' => $oSellerOrderID, 'platformUsername' => $oUserID, 'currency' => $oCurrency, 'feedback' => $oBuyerCheckoutMessage, 'PayPalEmailAddress' => $oPayPalEmailAddress, 'eBayPaymentStatus' => $oeBayPaymentStatus), 'orderUserInfoData' => array('username' => $oName, 'platformUsername' => $oUserID, 'email' => $oEmail, 'countryName' => $oCountryName, 'countrySn' => $oCountry, 'currency' => $oCurrency, 'state' => $oStateOrProvince, 'city' => $oCityName, 'street' => $oStreet1, 'address2' => $oStreet2, 'address3' => '', 'landline' => $oPhone, 'phone' => $ebay_state, 'zipCode' => $oPostalCode)); echo "\tUserID:{$oUserID}" . " AMT:{$oAmountPaid} recordNO:{$oRecordNumber} 付款状态:{$oCompleteStatus} 付款时间:" . date('Y-m-d H:i:s', $oPaidTime) . "\n"; //添加订单明细 $obj_order_detail_data = array(); foreach ($osoTransArray as $transaction) { //该交易的销售编号 $tran_recordnumber = $transaction->getElementsByTagName('ShippingDetails')->item(0)->getElementsByTagName('SellingManagerSalesRecordNumber')->item(0)->nodeValue; /* 多属性订单 */ $attribute = ''; $buy_with_attr = false; $tran_varia = $transaction->getElementsByTagName('Variation')->item(0); if (is_object($tran_varia)) { //未添加明细的属性 20130301 if ($tran_varia->hasChildNodes()) { $Variation = $tran_varia->getElementsByTagName('NameValueList')->item(0); if (!empty($Variation) && $Variation->hasChildNodes()) { foreach ($Variation as $variate) { $aname = $variate->getElementsByTagName('Name')->item(0)->nodeValue; $avalue = $variate->getElementsByTagName('Value')->item(0)->nodeValue; $attribute .= $aname . ":" . $avalue . " "; } } $buy_with_attr = true; $Variation = null; unset($Variation); } } $tran_id = $transaction->getElementsByTagName('TransactionID')->item(0)->nodeValue; //该交易的物品信息 $odItem = $transaction->getElementsByTagName('Item')->item(0); if ($buy_with_attr === true) { $odItemTitle = @$tran_varia->getElementsByTagName('VariationTitle')->item(0)->nodeValue; $odSKU = @$tran_varia->getElementsByTagName('SKU')->item(0)->nodeValue; } else { $odItemTitle = str_rep($odItem->getElementsByTagName('Title')->item(0)->nodeValue); $odSKU = str_rep($odItem->getElementsByTagName('SKU')->item(0)->nodeValue); } $is_suffix = 0; if (!empty($account_suffix)) { list($truesku, $skusuffix) = explode(':', $odSKU); if (!empty($skusuffix)) { $odSKU = $truesku; $is_suffix = 1; } } ###########悲剧 目前getorder api 无法取得下面2个值######### //ebay刊登物品的分类ID,备用字段 //$CategoryID = @$odItem->getElementsByTagName('PrimaryCategory')->item(0)->getElementsByTagName('CategoryID')->item(0)->nodeValue; //$ListingType = @$odItem->getElementsByTagName('ListingType')->item(0)->nodeValue; $CategoryID = 0; $ListingType = ''; //购买数量 $QuantityPurchased = $transaction->getElementsByTagName('QuantityPurchased')->item(0)->nodeValue; //交易创建时间 $CreatedDate = strtotime($transaction->getElementsByTagName('CreatedDate')->item(0)->nodeValue); $FinalValueFee = $transaction->getElementsByTagName('FinalValueFee')->item(0)->nodeValue; $tran_price = $transaction->getElementsByTagName('TransactionPrice')->item(0)->nodeValue; $goodsshippingcost = $transaction->getElementsByTagName('ActualShippingCost')->item(0)->nodeValue; $goodsshippingcost = empty($goodsshippingcost) ? '0.0' : $goodsshippingcost; $tran_itemid = $odItem->getElementsByTagName('ItemID')->item(0)->nodeValue; $tran_site = $odItem->getElementsByTagName('Site')->item(0)->nodeValue; //$obj_order_detail =new eBayOrderDetail(); $obj_order_detail_data[] = array('orderDetailData' => array('recordNumber' => $tran_recordnumber, 'itemPrice' => $tran_price, 'sku' => strtoupper($odSKU), 'amount' => $QuantityPurchased, 'shippingFee' => $goodsshippingcost, 'createdTime' => $mctime), 'orderDetailExtenData' => array('itemId' => $tran_itemid, 'transId' => $tran_id, 'itemTitle' => $odItemTitle, 'itemURL' => '', 'shippingType' => $oShipingService, 'FinalValueFee' => $FinalValueFee, 'FeeOrCreditAmount' => $oFeeOrCreditAmount, 'ListingType' => $ListingType, 'note' => $oBuyerCheckoutMessage)); } $orderData['orderDetail'] = $obj_order_detail_data; $rtn = OldsystemModel::orderErpInsertorder($orderData); //var_dump($rtn); $insertData = array(); if ($rtn['errcode'] == 200) { var_dump($rtn); $rtn_data = $rtn['data']; $orderId = $rtn_data['orderId']; echo "插入老系统成功,订单编号 [{$orderId}] \n"; $pmId = $rtn_data['pmId']; $totalweight = $rtn_data['totalweight']; $shipfee = $rtn_data['shipfee']; $carrier = $rtn_data['carrier']; $carrierId = $rtn_data['carrierId']; $status = $rtn_data['status']; $orderData['orderData']['id'] = $orderId; //赋予新系统订单编号@20140501 $calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data); //计算重量和包材 //var_dump($calcInfo); $orderData['orderData']['ORcalcWeight'] = $calcInfo[0]; $orderData['orderData']['calcWeight'] = $calcInfo[0]; $orderData['orderData']['pmId'] = $calcInfo[1]; if ($orderData['orderData']['calcWeight'] != $totalweight) { $insertData['old_totalweight'] = $totalweight; $insertData['new_totalweight'] = $orderData['orderData']['calcWeight']; } if ($orderData['orderData']['pmId'] != $pmId) { $insertData['old_pmId'] = $pmId; $insertData['new_pmId'] = $orderData['orderData']['pmId']; } if (count($orderData['orderDetail']) > 1) { $orderData['orderData']['orderAttribute'] = 3; } else { if (isset($orderData['orderDetail'][0]['orderDetailData']['amount']) && $orderData['orderDetail'][0]['orderDetailData']['amount'] > 1) { $orderData['orderData']['orderAttribute'] = 2; } } $calcShippingInfo = TransAPIModel::trans_carriers_best_get($orderData['orderData']['calcWeight'], $orderData['orderUserInfoData']['countryName'], $ebay_account, $orderData['orderData']['actualTotal']); //计算运费 //var_dump($calcShippingInfo); $orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']; $orderData['orderData']['transportId'] = $calcShippingInfo['carrierId']; $orderData['orderData']['ORtransportId'] = $calcShippingInfo['carrierId']; $orderData['orderData']['channelId'] = $calcShippingInfo['channelId']; $orderData['orderData']['ORchannelId'] = $calcShippingInfo['channelId']; if ($orderData['orderData']['calcShipping'] != $shipfee) { $insertData['old_shippfee'] = $shipfee; $insertData['new_shippfee'] = $orderData['orderData']['calcShipping']; } if ($orderData['orderData']['transportId'] != $carrierId) { $insertData['old_carrierId'] = $carrierId; $insertData['new_carrierId'] = $orderData['orderData']['transportId']; } if (!empty($insertData)) { $insertData['ebay_id'] = $orderId; $insertData['addtime'] = time(); var_dump($insertData); OldsystemModel::insertTempSyncRecords($insertData); // 插入临时对比记录表 } $orderData = AutoModel::auto_contrast_intercept($orderData); $statusArr = StatusMenuModel::getStatusMenuByOldStatus($status); if (empty($statusArr)) { echo "未获取老系统状态{$status}转换新码\n"; } else { $orderData['orderData']['ORorderStatus'] = $statusArr[0]; $orderData['orderData']['ORorderType'] = $statusArr[1]; $orderData['orderData']['orderStatus'] = $statusArr[0]; $orderData['orderData']['orderType'] = $statusArr[1]; } if (OrderAddModel::insertAllOrderRow($orderData)) { echo "本地 Record No. [{$oRecordNumber}] 入库成功\n"; $message .= "<font color='green'>本地订单号 [{$oRecordNumber}] 入库成功</font><br>"; } else { echo OrderAddModel::$errMsg; $message .= "<font color='red'>本地订单号 [{$oRecordNumber}] 入库失败</font><br>"; } } else { var_dump($rtn); } //exit; } else { echo "本地订单号 [{$oRecordNumber}] 入库失败\n"; $message .= "<font color='red'>本地订单号 [{$oRecordNumber}] 入库失败</font><br>"; } } else { echo "eBay订单号[{$oSellerOrderID}] 记录编号[{$oRecordNumber}] 无效 不入库...\t"; $message .= "<font color='red'>{$oSellerOrderID}无效 不入库...</font><br>"; if ($oShippedTime > 0 || $oOrderStatus == 2) { echo "已经发货\t"; $message .= "<font color='red'>{$oSellerOrderID}已经发货</font><br>"; } if ($oPaidTime <= 0 || $oPaidTime == '' || empty($oPaidTime)) { echo "未付款\t"; $message .= "<font color='red'>{$oSellerOrderID}未付款</font><br>"; } echo "\n"; //pop_ebay_orderid_queue($oSellerOrderID,$ebay_account); } } return $message; }
public function view_getOrderList() { global $memc_obj; $pagesize = isset($_GET['pnum']) && intval($_GET['pnum']) > 0 && intval($_GET['pnum']) < 101 ? intval($_GET['pnum']) : 20; //页面大小 if ($_GET['debug'] == 1) { $starttime = time() + microtime(); echo microtime() . '-----' . $starttime . "\n"; } //菜单 $status = ''; $search = isset($_REQUEST['search']) ? $_REQUEST['search'] : ''; //搜索时使用的数据 //order表 $searchPlatformId = isset($_GET['platformId']) ? $_GET['platformId'] : ''; //搜索平台 $searchAccountId = isset($_GET['accountId']) ? $_GET['accountId'] : ''; //搜索账号 $searchIsNote = isset($_GET['isNote']) ? $_GET['isNote'] : ''; //是否有留言 $searchTransportationType = isset($_GET['transportationType']) ? $_GET['transportationType'] : ''; //运输类型 $searchTransportation = isset($_GET['transportation']) ? $_GET['transportation'] : ''; //运输方式 $searchIsBuji = isset($_GET['isBuji']) ? $_GET['isBuji'] : ''; //是否补寄订单 $searchIsLock = isset($_GET['isLock']) ? $_GET['isLock'] : ''; //是否锁定 $searchOrderTime1 = isset($_GET['OrderTime1']) ? $_GET['OrderTime1'] : ''; //搜索下单初始时间 $searchOrderTime2 = isset($_GET['OrderTime2']) ? $_GET['OrderTime2'] : ''; //搜索下单结束时间 //order_detail表 $searchReviews = isset($_GET['reviews']) ? $_GET['reviews'] : ''; //是否评价 $searchSku = isset($_GET['sku']) ? $_GET['sku'] : ''; //sku //$searchOmOrderId = ''; //订单编号 $searchOrderType = isset($_GET['selectOrderType']) ? $_GET['selectOrderType'] : ''; //订单种类 //order_userInfo表 //$searchUsername = ''; //买家名 //$searchEmail = ''; $countryName = isset($_GET['country']) ? $_GET['country'] : ""; $state = isset($_GET['state']) ? $_GET['state'] : ""; $city = isset($_GET['city']) ? $_GET['city'] : ""; $zipCode = isset($_GET['zipCode']) ? $_GET['zipCode'] : ""; //order_warehouse表 //$weighTimeStart = isset($_GET['searchTimeStart'])? $_GET['searchTimeStart']:""; //$weighTimeEnd = isset($_GET['searchTimeEnd'])? $_GET['searchTimeEnd']:""; $searchTimeType = isset($_GET['searchTimeType']) ? $_GET['searchTimeType'] : ''; //order_tracknumbe表 //$searchTracknumber = ''; //跟踪号 //order_extension_ebay表 //$searchTransId = ''; //交易ID $searchKeywordsType = isset($_GET['KeywordsType']) ? $_GET['KeywordsType'] : ''; //搜索关键字类型 $searchKeywords = isset($_GET['Keywords']) ? $_GET['Keywords'] : ''; //搜索关键字 $this->smarty->assign('searchPlatformId', $searchPlatformId); $this->smarty->assign('searchAccountId', $searchAccountId); $this->smarty->assign('searchIsNote', $searchIsNote); $this->smarty->assign('searchTransportationType', $searchTransportationType); $this->smarty->assign('searchTransportation', $searchTransportation); $this->smarty->assign('searchIsBuji', $searchIsBuji); $this->smarty->assign('searchIsLock', $searchIsLock); $this->smarty->assign('searchOrderTime1', $searchOrderTime1); $this->smarty->assign('searchOrderTime2', $searchOrderTime2); $this->smarty->assign('searchReviews', $searchReviews); $this->smarty->assign('searchSku', $searchSku); $this->smarty->assign('searchOrderType', $searchOrderType); //$this->smarty->assign('searchEmail', $searchEmail); $this->smarty->assign('searchKeywordsType', $searchKeywordsType); $this->smarty->assign('searchKeywords', $searchKeywords); $this->smarty->assign('searchCountry', $countryName); $this->smarty->assign('searchState', $state); $this->smarty->assign('searchCity', $city); $this->smarty->assign('searchZipCode', $zipCode); //$this->smarty->assign('searchTimeStart', $weighTimeStart); //$this->smarty->assign('searchTimeEnd', $weighTimeEnd); $this->smarty->assign('searchTimeType', $searchTimeType); if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "firsttime ==={$dotime}=== " . ($dotime - $starttime) . "\n\n"; } $OrderRefundAct = new OrderRefundAct(); $omAvailableAct = new OmAvailableAct(); $OrderindexAct = new OrderindexAct(); //平台信息 $OmAccountAct = new OmAccountAct(); $WarehouseAPIAct = new WarehouseAPIAct(); if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "secondtime === " . ($dotime1 - $dotime) . "\n\n"; } $AbOrderList = $WarehouseAPIAct->act_getAbOrderList(); //var_dump($AbOrderList); exit; if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "thirdtime === " . ($dotime - $dotime1) . "\n\n"; } $AbOrderListArr = array(); $AbOrderids = array(); $AbOrderShow = array(); foreach ($AbOrderList as $orderId) { $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']); $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo; $AbOrderids[] = $orderId['originOrderId']; $AbOrderShow[$orderId['originOrderId']] = $orderId['id']; } if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "forthtime === " . ($dotime1 - $dotime) . "\n\n"; } //var_dump($AbOrderListArr); exit; $this->smarty->assign('AbOrderListArr', $AbOrderListArr); $this->smarty->assign('AbOrderShow', $AbOrderShow); //$platform = $omAvailableAct->act_getTNameList('om_platform','id,platform','WHERE is_delete=0'); $platform = $OmAccountAct->act_getPlatformListByPower(); //var_dump($platform); if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "fiftytime === " . ($dotime - $dotime1) . "\n\n"; } $this->smarty->assign('platform', $platform); /**导航 start**/ $default_ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : C('STATEPENDING'); /*if(isset($_GET['ostatus']) && !empty($_GET['ostatus'])){ $ostatus = $_GET['ostatus']; }else{ $ostatus = C('STATEPENDING'); }*/ $ostatus = $_GET['ostatus']; //echo C('STATEPENDING'); $this->smarty->assign('ostatus', $ostatus); $otype = isset($_GET['otype']) ? $_GET['otype'] : ''; $this->smarty->assign('otype', $otype); //二级目录 $StatusMenuAct = new StatusMenuAct(); $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0'); //var_dump($ostatusList); $this->smarty->assign('ostatusList', $ostatusList); if ($ostatus) { $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0'); } else { $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $default_ostatus . '" AND is_delete=0'); } if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "sixtytime === " . ($dotime1 - $dotime) . "\n\n"; } //var_dump($otypeList); $this->smarty->assign('otypeList', $otypeList); /*$o_secondlevel = $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc'); $this->smarty->assign('o_secondlevel', $o_secondlevel);*/ $second_count = array(); $second_type = array(); $accountacc = $_SESSION['accountacc']; //var_dump($ostatusList); echo "<br>"; foreach ($ostatusList as $o_secondinfo) { $orderStatus = $o_secondinfo['statusCode']; //echo $orderStatus."============"; echo "<br>"; $s_total = 0; //$OrderindexAct->act_showSearchOrderNum($orderStatus); //echo $orderStatus."==".$s_total; echo "<br>"; $second_count[$o_secondinfo['statusCode']] = $s_total; //$s_type = $omAvailableAct->act_getTNameList("om_status_menu","*","WHERE is_delete=0 and groupId='$orderStatus' order by sort asc"); $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc'); $second_type[$orderStatus] = $s_type[0]['statusCode']; } if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "seventime === " . ($dotime - $dotime1) . "\n\n"; } //var_dump($second_count); $this->smarty->assign('second_count', $second_count); $this->smarty->assign('second_type', $second_type); //var_dump($second_type); //退款数量 $accountList = $_SESSION['accountList']; $platformList = $_SESSION['platformList']; //echo "<pre>"; print_r($accountList); exit; $where = " WHERE is_delete=0 "; $platformsee = array(); for ($i = 0; $i < count($platformList); $i++) { $platformsee[] = $platformList[$i]; } if ($platformsee) { $where .= ' AND platformId IN (' . join(",", $platformsee) . ') '; } else { //$where .= " AND 1=2 "; } $accountsee = array(); for ($i = 0; $i < count($accountList); $i++) { $accountsee[] = $accountList[$i]; } if ($accountsee) { $where .= ' AND accountId IN (' . join(",", $accountsee) . ') '; } else { //$where .= " AND 1=2 "; } //echo $where; //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 "); $refund_total = $OrderRefundAct->act_getRecordNums(); $this->smarty->assign('refund_total', $refund_total); $parameterArr = array(); //var_dump($AbOrderids); $parameterArr['AbOrderList'] = $AbOrderids; $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr); $this->smarty->assign('abnormal_total', $total); if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "8time === " . ($dotime1 - $dotime) . "\n\n"; } //三级目录 $three_count = array(); if ($ostatus) { $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc"); foreach ($o_threelevel as $o_threeinfo) { $orderType = $o_threeinfo['statusCode']; /*$or_where = " where orderStatus='$ostatus' and orderType='$orderType' "; if($accountacc){ $or_where .= ' AND ('.$accountacc.') '; }*/ //$s_total = $OrderindexAct->act_showSearchOrderNum($ostatus, $orderType); $s_total = $default_ostatus == 900 && $orderType == 21 ? 'n' : $OrderindexAct->act_showSearchOrderNum($default_ostatus, $orderType); //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $or_where); $three_count[$o_threeinfo['statusCode']] = $s_total; } } else { $or_where = "WHERE is_delete=0 and groupId='{$default_ostatus}' "; if ($accountacc) { $or_where .= ' AND (' . $accountacc . ') '; } $or_where .= " order by sort asc"; $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$default_ostatus}' order by sort asc"); foreach ($o_threelevel as $o_threeinfo) { $orderType = $o_threeinfo['statusCode']; /*$or_where = " where orderStatus='$ostatus' and orderType='$orderType' "; if($accountacc){ $or_where .= ' AND ('.$accountacc.') '; }*/ $s_total = $default_ostatus == 900 && $orderType == 21 ? 'n' : $OrderindexAct->act_showSearchOrderNum($default_ostatus, $orderType); //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $or_where); $three_count[$o_threeinfo['statusCode']] = $s_total; } } // if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "9time === " . ($dotime - $dotime1) . "\n\n"; } $this->smarty->assign('o_threelevel', $o_threelevel); $this->smarty->assign('three_count', $three_count); $toptitle = '订单显示页面'; //头部title $this->smarty->assign('toptitle', $toptitle); $this->smarty->assign('toplevel', 0); $threelevel = '1'; //当前的三级菜单 $this->smarty->assign('threelevel', $threelevel); $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0 '); $this->smarty->assign('statusMenu', $statusMenu); $value = ''; $where = ''; switch ($searchTransportationType) { case '1': $transportation = CommonModel::getCarrierList(1); //快递 break; case '2': $transportation = CommonModel::getCarrierList(0); //平邮 break; default: $transportation = CommonModel::getCarrierList(); //所有的 break; } if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "10time === " . ($dotime1 - $dotime) . "\n\n"; } //var_dump($transportation); exit; $transportationList = array(); foreach ($transportation as $tranValue) { $transportationList[$tranValue['id']] = $tranValue['carrierNameCn']; } //var_dump($transportationList); exit; $this->smarty->assign('transportation', $transportation); $this->smarty->assign('transportationList', $transportationList); if ($search == '') { /*$where = ' WHERE is_delete = 0 AND storeId = 1 AND orderStatus = '.$ostatus; if($otype != ''){ $where .= ' AND orderType = '.$otype; }*/ //$total = $omAvailableAct->act_getTNameCount($orderForm, $where); $total = $OrderindexAct->act_showOrder($ostatus, $otype); //echo $total; exit; $num = $pagesize; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); //$where .= " ORDER BY ordersTime " . $page->limit; //echo "========订单系统升级中========="; echo "<br>"; $omOrderList = $OrderindexAct->act_showOrder($ostatus, $otype, $page->limit); //echo "<pre>"; var_dump($omOrderList); exit; //$omOrderList = $omAvailableAct->act_getTNameList($orderForm, '*', $where); } else { $parameterArr = array(); $parameterArr['searchPlatformId'] = $searchPlatformId; $parameterArr['searchAccountId'] = $searchAccountId; $parameterArr['searchIsNote'] = $searchIsNote; $parameterArr['searchTransportationType'] = $searchTransportationType; $parameterArr['searchTransportation'] = $searchTransportation; $parameterArr['searchIsBuji'] = $searchIsBuji; $parameterArr['searchIsLock'] = $searchIsLock; $parameterArr['searchOrderTime1'] = $searchOrderTime1; $parameterArr['searchOrderTime2'] = $searchOrderTime2; $parameterArr['searchReviews'] = $searchReviews; $parameterArr['searchSku'] = trim($searchSku); $parameterArr['searchOrderType'] = $searchOrderType; $parameterArr['searchKeywordsType'] = $searchKeywordsType; $parameterArr['countryName'] = trim($countryName); $parameterArr['state'] = trim($state); $parameterArr['city'] = trim($city); $parameterArr['zipCode'] = trim($zipCode); $parameterArr['searchTimeType'] = trim($searchTimeType); $parameterArr['searchKeywords'] = trim($searchKeywords); //$parameterArr['searchKeywords'] = trim($searchKeywords); /*if($_SESSION['sysUserId'] == 8){ var_dump($ostatus.'---'.$otype); }*/ //echo "订单系统升级中。。。。。。。<br>"; //var_dump($parameterArr); echo "<br>"; //$total = $OrderindexAct->act_index($parameterArr,$searchKeywordsType,$searchKeywords); $total = $OrderindexAct->act_showOrder($ostatus, $otype, '', $parameterArr); //echo $total; exit; $num = $pagesize; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); //$limit = $page->limit; //var_dump($parameterArr); $omOrderList = $OrderindexAct->act_showOrder($ostatus, $otype, $page->limit, $parameterArr); //var_dump($omOrderList); //$omOrderList = OrderindexAct::act_index($parameterArr,$searchKeywordsType,$searchKeywords,$limit,$ostatus); } if ($_GET['debug'] == 1) { $dotime = time() + microtime(); echo "11time ={$dotime}== " . ($dotime - $dotime1) . "\n\n"; } //$sku = array(); $account_where = ' WHERE is_delete = 0 '; if ($searchPlatformId) { $account_where .= ' AND platformId = ' . $searchPlatformId; } $UserCompetenceAct = new UserCompetenceAct(); $accountList = $UserCompetenceAct->act_showGlobalUser(); if ($accountList) { $account_where .= ' AND id in ( ' . join(',', $accountList) . ' ) '; } //帐号信息 $accountList = $omAvailableAct->act_getTNameList('om_account', '*', $account_where); //var_dump($accountList); exit; $account = array(); foreach ($accountList as $v) { $account[$v['id']] = $v['account']; } //包材信息 $pm = GoodsModel::getMaterInfoByList(); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } //var_dump($page); if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } //echo $show_page; //获取系统所有状态 $statusList = copyOrderModel::selectStatusList(); if ($_GET['debug'] == 1) { $dotime1 = time() + microtime(); echo "12time ={$dotime1}== " . ($dotime1 - $dotime) . "\n\n"; } //echo $show_page; $this->smarty->assign('statusList', $statusList); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('account', $account); $this->smarty->assign('accountList', $accountList); $this->smarty->assign('pm', $pm); $this->smarty->assign('omOrderList', $omOrderList); $this->smarty->display('orderindex.htm'); }
function checkDuplicateOrder($orderId, $platformId) { $omAvailableAct = new OmAvailableAct(); $where = " WHERE recordNumber = '{$orderId}' AND is_delete = 0 and platformId = '{$platformId}'"; $res = $omAvailableAct->act_getTNameList('om_unshipped_order', 'id', $where); $res2 = $omAvailableAct->act_getTNameList('om_shipped_order', 'id', $where); if (empty($res) && empty($res2)) { return false; } else { return true; } }
public function view_abnormalStockList() { global $memc_obj; $pagesize = 200; //页面大小 //var_dump($AbOrderList); exit; $omAvailableAct = new OmAvailableAct(); $TransAPIAct = new TransAPIAct(); $OrderindexAct = new OrderindexAct(); $GoodsAct = new GoodsAct(); $OrderRefundAct = new OrderRefundAct(); //平台信息 $OmAccountAct = new OmAccountAct(); $WarehouseAPIAct = new WarehouseAPIAct(); $AbOrderList = $WarehouseAPIAct->act_getAbOrderList(); //var_dump($AbOrderList); exit; $AbOrderListArr = array(); $AbOrderids = array(); $AbOrderShow = array(); foreach ($AbOrderList as $orderId) { $AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($orderId['id']); $AbOrderListArr[$orderId['originOrderId']] = $AbOrderInfo; $AbOrderids[] = $orderId['originOrderId']; $AbOrderShow[$orderId['originOrderId']] = $orderId['id']; } //var_dump($AbOrderListArr); exit; $this->smarty->assign('AbOrderListArr', $AbOrderListArr); $this->smarty->assign('AbOrderShow', $AbOrderShow); //var_dump($AbOrderListArr); exit; $platform = $OmAccountAct->act_getPlatformListByPower(); $this->smarty->assign('platform', $platform); $account = $OmAccountAct->act_accountAllListById(); //账号信息 /**导航 start**/ $ostatus = isset($_GET['ostatus']) ? $_GET['ostatus'] : 0; $this->smarty->assign('ostatus', 770); $StatusMenuAct = new StatusMenuAct(); $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0'); //var_dump($ostatusList); $this->smarty->assign('ostatusList', $ostatusList); //二级目录 /*$o_secondlevel = $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc'); $this->smarty->assign('o_secondlevel', $o_secondlevel);*/ $second_count = array(); $second_type = array(); foreach ($ostatusList as $o_secondinfo) { $orderStatus = $o_secondinfo['statusCode']; //echo $orderStatus."============"; echo "<br>"; $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus); //echo $orderStatus."==".$s_total; echo "<br>"; $second_count[$o_secondinfo['statusCode']] = $s_total; $s_type = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $orderStatus . '" AND is_delete=0 order by sort asc'); $second_type[$orderStatus] = $s_type[0]['statusCode']; } $this->smarty->assign('second_count', $second_count); $this->smarty->assign('second_type', $second_type); //退款数量 $where = " WHERE is_delete=0 "; $accountList = $_SESSION['accountList']; $platformList = $_SESSION['platformList']; //echo "<pre>"; print_r($accountList); exit; $platformsee = array(); for ($i = 0; $i < count($platformList); $i++) { $platformsee[] = $platformList[$i]; } if ($platformsee) { $where .= ' AND platformId IN (' . join(",", $platformsee) . ') '; } else { //$where .= " AND 1=2 "; } $accountsee = array(); for ($i = 0; $i < count($accountList); $i++) { $accountsee[] = $accountList[$i]; } if ($accountsee) { $where .= ' AND accountId IN (' . join(",", $accountsee) . ') '; } else { //$where .= " AND 1=2 "; } //if($where){ //$refund_total = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 "); $refund_total = $OrderRefundAct->act_getRecordNums(); //}else{ //$refund_total = 0; //} $this->smarty->assign('refund_total', $refund_total); //三级目录 /*$refund_one = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=0"); $this->smarty->assign('refund_one', $refund_one); $refund_two = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=1"); $this->smarty->assign('refund_two', $refund_two); $refund_three = $omAvailableAct->act_getTNameCount("om_order_refund"," where is_delete=0 and status=2"); $this->smarty->assign('refund_three', $refund_three);*/ /**导航 end**/ $toptitle = '异常缺货统计页面'; //头部title $this->smarty->assign('toptitle', $toptitle); $this->smarty->assign('toplevel', 0); $threelevel = '1'; //当前的三级菜单 $this->smarty->assign('threelevel', $threelevel); $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0'); $this->smarty->assign('statusMenu', $statusMenu); /* $where = ' WHERE is_delete = 0 '.$where; $total = $omAvailableAct->act_getTNameCount('om_order_refund', $where);*/ $parameterArr = array(); $parameterArr['AbOrderList'] = $AbOrderids; $total = $OrderindexAct->act_showABOrder($ostatus, $otype, '', $parameterArr); $this->smarty->assign('abnormal_total', $total); //echo $total; exit; $num = $pagesize; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); //$limit = $page->limit; //var_dump($parameterArr); $omOrderList = $OrderindexAct->act_showABOrder($ostatus, $otype, $page->limit, $parameterArr); $this->smarty->assign('omOrderList', $omOrderList); $pm = $GoodsAct->act_getMaterInfoByList(); $transportationList = $TransAPIAct->act_getCarrierListById(); $this->smarty->assign('transportationList', $transportationList); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } //获取系统所有状态 //$statusList = copyOrderModel::selectStatusList(); //var_dump($statusList); exit; //$this->smarty->assign('statusList', $statusList); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('account', $account); //$this->smarty->assign('sku', $sku); $this->smarty->assign('pm', $pm); $this->smarty->assign('omOrderList', $omOrderList); $this->smarty->display('orderindex.htm'); }
public function view_scanUpdateAccountList() { $omAvailableAct = new OmAvailableAct(); $id = isset($_GET['id']) ? post_check($_GET['id']) : ''; if (intval($id) == 0) { //id为空时,跳转到列表页面,输出错误信息 $status = '<font color="red">数据异常</font>'; header("location:index.php?mod=omAccount&act=getAccountList&status={$status}"); exit; } $where = "WHERE id={$id} "; $omAccountList = $omAvailableAct->act_getTNameList('om_account', '*', $where); if (empty($omAccountList)) { $status = '<font color="red">找不到要修改记录的id</font>'; header("location:index.php?mod=omAccount&act=getOmAccountList&status={$status}"); exit; } else { $value = $omAccountList[0]; } //设置修改页面上指定字段的值 $navlist = array(array('url' => 'index.php?mod=omPlatform&act=getOmPlatformList', 'title' => '系统设置'), array('url' => 'index.php?mod=omAccount&act=getAccountList', 'title' => '平台账号'), array('url' => '', 'title' => '修改账号')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('toptitle', '修改账号'); $this->smarty->assign('toplevel', 3); $this->smarty->assign('secondlevel', '32'); $this->smarty->assign("id", $value['id']); $this->smarty->assign("account", $value['account']); $this->smarty->assign("appname", $value['appname']); $this->smarty->assign("platformId", $value['platformId']); $this->smarty->assign("email", $value['email']); $this->smarty->assign("suffix", $value['suffix']); $this->smarty->assign("charger", $value['charger']); $this->smarty->display("omUpdateAccountList.htm"); }
require_once WEB_PATH_LIB_SDK_TAOBAO . 'lib/taobao.logistics.offline.send.php'; //$taobao_user = '******'; $configFile = WEB_PATH_CONF_SCRIPTS_KEYS_TAOBAO . "config_" . $taobao_user . ".php"; $logfile = SCRIPT_DATA_LOG . "taobao/shipment/taobao_shipment_" . $taobao_user . "_" . date("Y-m-d") . ".log"; //echo $logfile;die; if (file_exists($configFile)) { include_once $configFile; } else { echo "error: 未找对应的config文件!\n"; exit; } $debug_mode = 'false'; $user = '******'; $start = strtotime("-72 hour"); $account_info = get_account_id($account); $omAvailableAct = new OmAvailableAct(); $where = " WHERE accountId = '{$account_info['accountid']}' AND is_delete = 0 AND b.weighTime>{$start}"; $alldata = $omAvailableAct->act_getTNameList('om_shipped_order as a left join om_shipped_order_warehouse as b on a.id=b.omOrderId', 'a.id,a.recordNumber,a.accountId,a.transportId', $where); $sum = sizeof($alldata); if ($sum > 0) { foreach ($alldata as $val) { $log_data = array(); $carrier = CommonModel::getShipingNameById($val['transportId']); $where = " WHERE omOrderId = '{$val['id']}' AND is_delete = 0 "; $res = $omAvailableAct->act_getTNameList('om_order_tracknumber', 'tracknumber', $where); $log_data['time'] = date("Y-m-d H:i:s"); $log_data['recordnumber'] = $recordnumber = $val['recordnumber']; $log_data['ebay_carrier'] = $carrier; $log_data['tracknumber'] = $tracknumber = $res[0]['tracknumber']; $log_data['ebay_id'] = $val['id']; $company_code = getLogisticCode($carrier);
public function view_deletePlatformList() { $id = isset($_GET['id']) ? post_check($_GET['id']) : ''; $status = ''; if (intval($id) == 0) { $status = '数据异常,删除失败'; header("location:index.php?mod=omPlatform&act=getOmPlatformList&status={$status}"); exit; } $omAvailableAct = new OmAvailableAct(); $tName = 'om_platform'; $where = "WHERE is_delete=0 and id='{$id}'"; $count = $omAvailableAct->act_getTNameCount($tName, $where); if (!$count) { $status = '记录不存在,删除失败'; header("location:index.php?mod=omPlatform&act=getOmPlatformList&status={$status}"); exit; } //获取原始平台账号 $platformInfo = $omAvailableAct->act_getTNameList($tName, 'platform', ' where id=' . $id); $old_platform = $platformInfo[0]['platform']; $set = "SET is_delete=1 "; $where = "WHERE id='{$id}'"; $affectRow = $omAvailableAct->act_updateTNameRow($tName, $set, $where); if ($affectRow) { //更新老系统 $returnInfo = OldsystemModel::erpSyncPlatform($old_platform, 'delete', $old_platform); if ($returnInfo['res_code'] == 200) { $status = '删除成功'; } else { $status = '更新老系统失败'; } } else { $status = '删除失败'; } header("location:index.php?mod=omPlatform&act=getOmPlatformList&status={$status}"); }
public function view_getInputList() { //调用action层, 获取列表数据 $omAvailableAct = new OmAvailableAct(); $status = $_GET['status'] ? $_GET['status'] : ''; $inputName = $_GET['inputName'] ? post_check(trim($_GET['inputName'])) : ''; $textStatus = $_GET['textStatus'] ? post_check(trim($_GET['textStatus'])) : ''; $pid = $_GET['pid'] ? post_check(trim($_GET['pid'])) : ''; $tName = 'pc_archive_input'; $select = '*'; $where = 'WHERE 1=1 '; if (!empty($inputName)) { $where .= "AND inputName='{$inputName}' "; } if (!empty($textStatus)) { $where .= "AND textStatus='{$textStatus}' "; } if (!empty($pid)) { $where .= "AND categoryPath REGEXP '^{$pid}(-[0-9]+)*\$' "; //$where .= "AND categoryPath='$pid' "; } $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= $page->limit; $inputList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $navlist = array(array('url' => 'index.php?mod=category&act=getCategoryList', 'title' => '类别管理'), array('url' => 'index.php?mod=property&act=getInputList', 'title' => '文本属性列表')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 4); $this->smarty->assign('twovar', 43); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', '文本属性列表'); $this->smarty->assign('status', $status); //取得搜索类别的记录 $pidArr = explode('-', $pid); $this->smarty->assign('pidArr', $pidArr); $this->smarty->assign('inputList', empty($inputList) ? null : $inputList); $this->smarty->display("inputList.htm"); }
public function view_getNoPassSpuList() { $omAvailableAct = new OmAvailableAct(); $spu = isset($_GET['spu']) ? post_check($_GET['spu']) : ''; $purchaseId = isset($_GET['purchaseId']) ? post_check($_GET['purchaseId']) : ''; $pid = isset($_GET['pid']) ? post_check($_GET['pid']) : ''; $isCounterAudit = isset($_GET['isCounterAudit']) ? post_check($_GET['isCounterAudit']) : ''; $tName = 'pc_spu_archive_no_pass_record'; $select = '*'; $where = 'WHERE 1=1 '; if (!empty($spu)) { $where .= "AND spu='{$spu}' "; } if (!empty($pid)) { $where .= "AND categoryPath REGEXP '^{$pid}(-[0-9]+)*\$' "; } if (intval($purchaseId) != 0) { $where .= "AND purchaseId='{$purchaseId}' "; } if ($isCounterAudit == 1 || $isCounterAudit == 2) { $where .= "AND isCounterAudit='{$isCounterAudit}' "; } $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= 'order by id desc '; $where .= $page->limit; $spuNoPassList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($spuNoPassList)) { $platformList = getAllPlatformInfo(); $platformArr = array(); $spuStatusArr = displayAllSpuStatus(); foreach ($platformList as $value) { $platformArr[$value['id']] = $value['platform']; } $countSpuNoPass = count($spuNoPassList); for ($i = 0; $i < $countSpuNoPass; $i++) { $spuNoPassList[$i]['platformName'] = $platformArr[$spuNoPassList[$i]['platformId']]; $spuNoPassList[$i]['spuStatusName'] = $spuStatusArr[$spuNoPassList[$i]['spuStatus']]['statusName']; } } if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $navlist = array(array('url' => 'index.php?mod=autoCreateSpu&act=getAutoCreatePrefixList', 'title' => 'SPU管理'), array('url' => 'index.php?mod=autoCreateSpu&act=getNoPassSpuList', 'title' => 'SPU审核不通过管理')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 2); $this->smarty->assign('twovar', 25); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', 'SPU审核不通过管理'); //取得搜索类别的记录 $pidArr = explode('-', $pid); $this->smarty->assign('pidArr', $pidArr); $this->smarty->assign('spuNoPassList', empty($spuNoPassList) ? null : $spuNoPassList); $this->smarty->display("spuNoPassList.htm"); }
function act_getCategoryInfoAndIsHasChild() { $id = $_POST['id']; $list = CategoryModel::getCategoryList("*", "where is_delete=0 and pid='{$id}'"); if ($list) { $count = CategoryModel::getCategoryCount("where is_delete=0 and path like '%{$id}-%-%'"); return array($list, $count); } else { self::$errCode = 101; self::$errMsg = 'error'; return false; } }
} //define('SCRIPTS_PATH_CRONTAB', '/data/web/erpNew/order.valsun.cn/crontab/'); require_once WEB_PATH . "crontab/scripts.comm.php"; require_once WEB_PATH_CONF_SCRIPTS . "script.ebay.config.php"; //$taobao_user = '******'; $configFile = WEB_PATH_CONF_SCRIPTS_KEYS_TAOBAO . "config_" . $taobao_user . ".php"; if (file_exists($configFile)) { include_once $configFile; } else { echo "error: 未找对应的config文件!\n"; exit; } require_once WEB_PATH_LIB_SDK_TAOBAO . 'lib/taobao.trade.get.php'; require_once WEB_PATH_LIB_SDK_TAOBAO . 'lib/taobao.trades.sold.get.php'; require_once WEB_PATH_LIB_SCRIPTS_TAOBAO . 'taobao_order_func.php'; $omAvailableAct = new OmAvailableAct(); $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', " WHERE is_delete = 0 AND platformId in(12,13) "); //echo $account; echo "\n"; $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT); //$debug_mode = 'false'; //调试模式 //获取第一页数据 //2013-05-14 01:01:00 //$json_data = taobaoTradesSoldGet($url,$session,$appSecret,$appKey,"WAIT_SELLER_SEND_GOODS",1,$page_size,"","","wanchi1224"); $json_data = taobaoTradesSoldGet($url, $session, $appSecret, $appKey, $status, 1, $page_size); //print_r(get_account_id($account));die; //var_dump($json_data);die; //exit; //分页获取后面的数据 $total_page = 1; if (isset($json_data['trades_sold_get_response']['total_results'])) { $total = intval($json_data['trades_sold_get_response']['total_results']); if ($total > $page_size) {
public function view_getNewGoodsList() { //调用action层, 获取列表数据 $start1 = getMicrotime(); $sku = $_GET['sku'] ? post_check(trim($_GET['sku'])) : ''; $purchaseId = intval($_GET['purchaseId']) > 0 ? intval($_GET['purchaseId']) : 0; $whId = intval($_GET['whId']) > 0 ? intval($_GET['whId']) : 1; $omAvailableAct = new OmAvailableAct(); $tName = 'pc_goods'; $select = 'spu'; $where = "WHERE is_delete=0 AND isNew=1 AND substring(sku, 1, 1)<>'M' AND substring(sku, 1, 1)<>'Z' and substring(sku, 1, 1)<>'F' "; if (!empty($sku)) { $where .= "AND sku like'{$sku}%' "; } if (!empty($purchaseId)) { $where .= "AND purchaseId='{$purchaseId}' "; } //第一步筛选,选出isNew=1,并且goodsName!=''和'无',sku不已F和Z开头的spu $spuList1 = $omAvailableAct->act_getTNameList($tName, $select, $where); $spuArr1 = array(); foreach ($spuList1 as $value) { if (!empty($value['spu'])) { $spuArr1[] = $value['spu']; } } //此时 $spuSkuRelationArr1中保存的是spu和sku的关系数组,形如 array('1201'=>array('1201_B','1201_W'),'1202'=>array('1202')); //此时 $spuSkuRelationArr1中保存的是spu和sku的关系数组,形如 array('1201'=>array('1201_B','1201_W'),'1202'=>array('1202')); //第二步,选择出制作表已经存在的数据 $tName = 'pc_products'; $select = 'sku'; $where = "WHERE is_delete=0 "; $skuList2 = OmAvailableModel::getTNameList($tName, $select, $where); $spuArr2 = array(); foreach ($skuList2 as $value) { $tmpArr = explode('_', $value['sku']); if (!empty($tmpArr[0])) { $spu = $tmpArr[0]; $spuArr2["{$spu}"] = $spu; //SPU } } //第三步,找出新品领料单中存在的sku; $tName = 'pc_products_iostore_detail'; $select = 'sku'; $where = "WHERE is_delete=0 AND iostoreTypeId=1 AND useTypeId=1 AND isAudit<3 "; $skuList3 = OmAvailableModel::getTNameList($tName, $select, $where); $spuArr3 = array(); foreach ($skuList3 as $value) { $tmpArr = explode('_', $value['sku']); if (!empty($tmpArr[0])) { $spu = $tmpArr[0]; $spuArr3["{$spu}"] = $spu; //SPU } } $saveSpuArr = array(); //要保留的SPU foreach ($spuArr1 as $value) { if (!in_array($value, $spuArr2, true) && !in_array($value, $spuArr3, true)) { //SPU不在$spuArr2,$spuArr3时保留 $saveSpuArr[] = "'" . $value . "'"; } $saveSpuArr = array(); //要保留的SPU foreach ($spuArr1 as $value) { if (!in_array($value, $spuArr2) && !in_array($value, $spuArr3)) { //SPU不在$spuArr2,$spuArr3时保留 $saveSpuArr[] = "'" . $value . "'"; } } if (empty($saveSpuArr)) { $saveSpuStr = "'0'"; } else { $saveSpuStr = implode(',', $saveSpuArr); } $tName = 'pc_goods'; $select = 'spu,sku,isNew'; $where = "WHERE is_delete=0 AND spu IN({$saveSpuStr})"; $skuList4 = OmAvailableModel::getTNameList($tName, $select, $where); $spuSkuRelationArr1 = array(); $unSaveSpu = ''; } $tName = 'pc_goods'; $select = 'spu,sku,isNew'; $where = "WHERE is_delete=0 AND spu IN({$saveSpuStr})"; $skuList4 = OmAvailableModel::getTNameList($tName, $select, $where); $spuSkuRelationArr1 = array(); $unSaveSpu = ''; foreach ($skuList4 as $value) { if ($value['isNew'] == 0) { //过滤出全是新品的SPU $unSaveSpu = $value['spu']; } if ($unSaveSpu == $value['spu']) { continue; } $spuSkuRelationArr1[$value['spu']][] = $value['sku']; } $skuArr4 = array(); foreach ($skuList4 as $value) { $skuArr4[] = "'" . $value['sku'] . "'"; } if (empty($skuArr4)) { $skuArrStr = "'0'"; } else { $skuArrStr = implode(',', $skuArr4); } $tName = 'pc_goods_whId_location_raletion'; $select = 'sku'; $where = "WHERE location<>'' AND sku In({$skuArrStr}) "; $where .= "AND whId={$whId} "; $skuList5 = OmAvailableModel::getTNameList($tName, $select, $where); $spuSkuRelationArr2 = array(); foreach ($skuList5 as $value) { $tmpSpuArr = explode('_', $value['sku']); if (!empty($tmpSpuArr[0])) { $spuSkuRelationArr2[$tmpSpuArr[0]][] = $value['sku']; } } $spuLastArr = array(); foreach ($spuSkuRelationArr1 as $spu => $skuArr) { $tmpArray = $spuSkuRelationArr2[$spu]; if (count($skuArr) == count($tmpArray)) { $spuLastArr[] = "'" . $spu . "'"; } } if (empty($spuLastArr)) { $spuLastStr = "'0'"; } else { $spuLastStr = implode(',', $spuLastArr); } $tName = 'pc_goods'; $select = 'spu,sku,goodsName,purchaseId,goodsCreatedTime'; $where = "WHERE is_delete=0 AND spu IN({$spuLastStr})"; $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 1000; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "order by sku " . $page->limit; $newGoodsList = $omAvailableAct->act_getTNameList($tName, $select, $where); $total = $omAvailableAct->act_getTNameCount($tName, $where); $num = 1000; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "order by sku " . $page->limit; $newGoodsList = $omAvailableAct->act_getTNameList($tName, $select, $where); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $navlist = array(array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '新品列表')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('onevar', 5); $this->smarty->assign('twovar', 55); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('title', '新品列表'); $whInfo = getWhInfo(); $whArr = array(); foreach ($whInfo as $value) { $whArr[$value['id']] = $value['whName']; } if (!empty($newGoodsList)) { $countNewGL = count($newGoodsList); for ($i = 0; $i < $countNewGL; $i++) { $tName = 'pc_goods_whId_location_raletion'; $select = '*'; $where = "WHERE sku='{$newGoodsList[$i]['sku']}' "; $skuInfoList = OmAvailableModel::getTNameList($tName, $select, $where); $newGoodsList[$i]['whId'] = $skuInfoList[0]['whId']; $newGoodsList[$i]['wh'] = $whArr[$skuInfoList[0]['whId']]; $newGoodsList[$i]['location'] = $skuInfoList[0]['location']; $newGoodsList[$i]['storageTime'] = $skuInfoList[0]['storageTime']; } } $end1 = getMicrotime(); //echo $end1-$start1;exit; $this->smarty->assign('newGoodsList', empty($newGoodsList) ? array() : $newGoodsList); $this->smarty->display("newGoodsList.htm"); }
public function addOrder($account) { if (!defined('WEB_PATH')) { define("WEB_PATH", "/data/web/order.valsun.cn/"); } require_once WEB_PATH . "crontab/scripts.comm.php"; require_once WEB_PATH_CONF_SCRIPTS . "script.ebay.config.php"; require_once WEB_PATH_LIB_SDK_EBAY . "GetCertainOrder.php"; require_once WEB_PATH_LIB_SCRIPTS_EBAY . "ebay_order_cron_func.php"; $rmq_config = C("RMQ_CONFIG"); $rabbitMQClass = new RabbitMQClass($rmq_config['fetchOrder'][1], $rmq_config['fetchOrder'][2], $rmq_config['fetchOrder'][4], $rmq_config['fetchOrder'][0]); //队列对象 $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $where .= 'AND platformId in(1,5) '; $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', $where); $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT); if (!preg_match('#^[\\da-zA-Z]+$#i', $account)) { $message .= "<font color='red'>Invalid ebay account: {$account}!</font><br>"; self::$errCode = 101; self::$errMsg = $mesage; return false; } if (!in_array($account, $GLOBAL_EBAY_ACCOUNT)) { //exit("$account is not support now !\n"); $message .= "<font color='red'>{$account} is not support now !</font><br>"; self::$errCode = 102; self::$errMsg = $mesage; return false; } //预先判断ebaytoken文件 $__token_file = WEB_PATH_CONF_SCRIPTS_KEYS_EBAY . 'keys_' . $account . '.php'; if (!file_exists($__token_file)) { //exit($__token_file." does not exists!!!"); $message .= "<font color='red'>{$__token_file} does not exists!!!</font><br>"; self::$errCode = 103; self::$errMsg = $mesage; return false; } $express_delivery = array(); $express_delivery_value = array(); $no_express_delivery = array(); $no_express_delivery_value = array(); $express_delivery_arr = CommonModel::getTransCarrierInfo(1); foreach ($express_delivery_arr['data'] as $value) { $express_delivery_value[$value['id']] = $value['carrierNameCn']; } $express_delivery = array_keys($express_delivery_value); //var_dump($express_delivery); $no_express_delivery_arr = CommonModel::getTransCarrierInfo(); foreach ($no_express_delivery_arr['data'] as $value) { $no_express_delivery_value[$value['id']] = $value['carrierNameCn']; } $no_express_delivery = array_keys($no_express_delivery_value); //var_dump($no_express_delivery); exit; #########全局变量设置######## date_default_timezone_set('Asia/Chongqing'); $detailLevel = 0; $Sordersn = "eBay"; $mctime = time(); $cc = $mctime; $nowtime = date("Y-m-d H:i:s", $cc); $nowd = date("Y-m-d", $cc); #################以下账号用于测试############# //$account= $__ebayaccount; #############类或API 实例化############## $api_gco = new GetCertainOrderAPI($account); //$oa =new OrderAction(); //程序计时器 $time_start = $cc; //echo "\n=====[".date('Y-m-d H:i:s',$time_start)."] 系统【开始】抓取账号【 $account 】订单 ====>\n\n"; $message = $api_gco->GetCertainOrder($account); //监听获取队列信息 if ($message === true) { self::$errCode = 200; self::$errMsg = "成功抓取订单!"; return true; } elseif ($message === false) { self::$errCode = 104; self::$errMsg = "抓取订单失败!"; return false; } else { self::$errCode = 105; self::$errMsg = $message; return; } //return $message; }
function act_updateTNameRow($tName, $set, $where) { $ret = OmAvailableModel::updateTNameRow($tName, $set, $where); if ($ret !== FALSE) { return $ret; } else { self::$errCode = OmAvailableModel::$errCode; self::$errMsg = OmAvailableModel::$errMsg; return false; } }
function act_updateSkuCountInStock() { $orderId = isset($_GET['orderId']) ? trim($_GET['orderId']) : ''; $sku_id = isset($_GET['sku_id']) ? trim($_GET['sku_id']) : ''; $stockqty = isset($_GET['stockqty']) ? trim($_GET['stockqty']) : ''; $status = isset($_GET['status']) ? trim($_GET['status']) : ''; if ($orderId == '') { self::$errCode = 101; self::$errMsg = '参数有误!'; return false; } if ($status != '') { $ret = OmAvailableAct::act_updateTNameRow("ph_order", "SET status = '4'", "WHERE id = '{$orderId}'"); if ($ret === false) { self::$errCode = 102; self::$errMsg = '更新采购订单状态出错!'; return false; } } if ($sku_id != '' && $stockqty != '') { $ret = OmAvailableAct::act_updateTNameRow("ph_order_detail", "SET stockqty = '{$stockqty}'", "WHERE po_id = '{$orderId}' AND sku_id = '{$sku_id}'"); if ($ret === false) { self::$errCode = 103; self::$errMsg = '更新采购订单料号数量出错!'; return false; } } self::$errCode = 0; self::$errMsg = '更新成功!'; return json_encode(array(true)); }
public function view_modifyOrderList() { global $memc_obj; $sysUserId = $_SESSION['sysUserId']; $modify_showerrorinfo = ''; $OrderModifyAct = new OrderModifyAct(); $OrderindexAct = new OrderindexAct(); $UserCompetenceAct = new UserCompetenceAct(); //var_dump($_GET); exit; if (isset($_GET) && !empty($_GET)) { $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : ''; $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus']; $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype']; } if (isset($_POST) && !empty($_POST)) { //var_dump($_POST); echo "<br>"; exit; $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : ''; $ostatus = isset($_POST['edit_ostatus']) ? $_POST['edit_ostatus'] : $_POST['ostatus']; $otype = isset($_POST['edit_otype']) ? $_POST['edit_otype'] : $_POST['otype']; $update_order = array(); $update_userinfo = array(); $update_tracknumber = array(); //$orderid = $_POST['orderid']; //var_dump($_POST); exit; $updatestatus = false; if ($_POST['action'] == 'addDetail') { //var_dump($_GET); echo "<br>"; exit; $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : ''; $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus']; $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype']; if ($OrderModifyAct->act_batchAdd($orderid, $_POST)) { $modify_showerrorinfo = "<font color='green'>添加成功</font>"; } else { $modify_showerrorinfo = "<font color='red'>添加失败</font>"; } } else { if ($_POST['action'] == 'addNote') { //var_dump($_GET); echo "<br>"; exit; $orderid = isset($_GET['orderid']) ? $_GET['orderid'] : ''; $ostatus = isset($_GET['edit_ostatus']) ? $_GET['edit_ostatus'] : $_GET['ostatus']; $otype = isset($_GET['edit_otype']) ? $_GET['edit_otype'] : $_GET['otype']; if ($OrderModifyAct->act_addNote($orderid, $_POST)) { $modify_showerrorinfo = "<font color='green'>添加成功</font>"; } else { $modify_showerrorinfo = "<font color='red'>添加失败</font>"; } } else { $visible_movefolder = $UserCompetenceAct->act_getInStatusIds($_POST['otype'], $sysUserId); if (!in_array($_POST['edit_otype'], $visible_movefolder)) { $modify_showerrorinfo = "<font color='red'>您没有改变订单状态的权限</font>"; } else { if ($_POST['username'] != $_POST['edit_username']) { $update_userinfo['username'] = $_POST['edit_username']; } if ($_POST['ostatus'] != $_POST['edit_ostatus']) { $update_order['orderStatus'] = $_POST['edit_ostatus']; } if ($_POST['otype'] != $_POST['edit_otype']) { $update_order['orderType'] = $_POST['edit_otype']; $updatestatus = true; } if ($_POST['street'] != $_POST['edit_street']) { $update_userinfo['street'] = $_POST['edit_street']; } if ($_POST['platformUsername'] != $_POST['edit_platformUsername']) { $update_userinfo['platformUsername'] = $_POST['edit_platformUsername']; } if ($_POST['address2'] != $_POST['edit_address2']) { $update_userinfo['address2'] = $_POST['edit_address2']; } if ($_POST['actualShipping'] != $_POST['edit_actualShipping']) { $update_order['actualShipping'] = $_POST['edit_actualShipping']; } if ($_POST['city'] != $_POST['edit_city']) { $update_userinfo['city'] = $_POST['edit_city']; } if ($_POST['state'] != $_POST['edit_state']) { $update_userinfo['state'] = $_POST['edit_state']; } if ($_POST['countryName'] != $_POST['edit_countryName']) { $update_userinfo['countryName'] = $_POST['edit_countryName']; } if ($_POST['zipCode'] != $_POST['edit_zipCode']) { $update_userinfo['zipCode'] = $_POST['edit_zipCode']; } if ($_POST['landline'] != $_POST['edit_landline']) { $update_userinfo['landline'] = $_POST['edit_landline']; } if ($_POST['phone'] != $_POST['edit_phone']) { $update_userinfo['phone'] = $_POST['edit_phone']; } if ($_POST['transportId'] != $_POST['edit_transportId']) { $update_order['transportId'] = $_POST['edit_transportId']; } if ($_POST['edit_tracknumber']) { $update_tracknumber['omOrderId'] = $orderid; $update_tracknumber['tracknumber'] = $_POST['edit_tracknumber']; $update_tracknumber['addUser'] = $sysUserId; $update_tracknumber['createdTime'] = time(); //var_dump($update_tracknumber); exit; } BaseModel::begin(); //开始事务 if ($update_order) { //$sql = "UPDATE om_unshipped_order set ".array2sql($update_order)." WHERE id = ".$orderid; //$msg = OrderLogModel::orderLog($orderid,$update_order['orderStatus'],$update_order['orderType'],$sql); if (OrderindexModel::updateOrder('om_unshipped_order', $update_order, ' WHERE id = ' . $orderid)) { if ($updatestatus) { $ProductStatus = new ProductStatus(); if (!$ProductStatus->updateSkuStatusByOrderStatus(array($orderid), $batch_ostatus_val, $batch_otype_val)) { BaseModel::rollback(); } } $modify_showerrorinfo = "<font color='green'>更新成功</font>"; } else { $modify_showerrorinfo = "<font color='red'>更新失败</font>"; BaseModel::rollback(); } } if ($update_userinfo) { //var_dump($update_userinfo); if (OrderindexModel::updateOrder('om_unshipped_order_userInfo', $update_userinfo, ' WHERE omOrderId = ' . $orderid)) { $modify_showerrorinfo = "<font color='green'>更新成功</font>"; } else { $modify_showerrorinfo = "<font color='red'>更新失败</font>"; BaseModel::rollback(); } } if ($update_tracknumber) { //echo $msg; if (!OrderAddModel::insertOrderTrackRow($update_tracknumber)) { /*self :: $errCode = "001"; self :: $errMsg = "跟踪号插入失败"; return false;*/ $modify_showerrorinfo = "<font color='red'>跟踪号插入失败</font>"; BaseModel::rollback(); } } BaseModel::commit(); BaseModel::autoCommit(); } } } } $this->smarty->assign('modify_showerrorinfo', $modify_showerrorinfo); $omAvailableAct = new OmAvailableAct(); //平台信息 $platform = $omAvailableAct->act_getTNameList('om_platform', 'id,platform', 'WHERE is_delete=0'); //var_dump($platform); $platformList = array(); foreach ($platform as $v) { $platformList[$v['id']] = $v['platform']; } $this->smarty->assign('platformList', $platformList); /**导航 start**/ $this->smarty->assign('ostatus', $ostatus); $this->smarty->assign('otype', $otype); //二级目录 $StatusMenuAct = new StatusMenuAct(); $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0'); //var_dump($ostatusList); $this->smarty->assign('ostatusList', $ostatusList); $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0'); //var_dump($otypeList); $this->smarty->assign('otypeList', $otypeList); /*$o_secondlevel = $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc'); $this->smarty->assign('o_secondlevel', $o_secondlevel);*/ $second_count = array(); $second_type = array(); foreach ($ostatusList as $o_secondinfo) { $orderStatus = $o_secondinfo['statusCode']; /*$accountacc = $_SESSION['accountacc']; $oc_where = " where orderStatus='$orderStatus' "; if($accountacc){ $oc_where .= ' AND ('.$accountacc.') '; }*/ $s_total = $OrderindexAct->act_showSearchOrderNum($orderStatus); //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order", $oc_where); $second_count[$o_secondinfo['statusCode']] = $s_total; $s_type = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$orderStatus}' order by sort asc"); $second_type[$o_secondinfo['statusCode']] = $s_type[0]['statusCode']; } //var_dump($second_count); $this->smarty->assign('second_count', $second_count); $this->smarty->assign('second_type', $second_type); //退款数量 $refund_total = $omAvailableAct->act_getTNameCount("om_order_refund", " where is_delete=0"); $this->smarty->assign('refund_total', $refund_total); //三级目录 $o_threelevel = $omAvailableAct->act_getTNameList("om_status_menu", "*", "WHERE is_delete=0 and groupId='{$ostatus}' order by sort asc"); $this->smarty->assign('o_threelevel', $o_threelevel); $three_count = array(); foreach ($o_threelevel as $o_threeinfo) { $orderType = $o_threeinfo['statusCode']; $s_total = $OrderindexAct->act_showSearchOrderNum($ostatus, $orderType); //$s_total = $omAvailableAct->act_getTNameCount("om_unshipped_order"," where orderStatus='$ostatus' and orderType='$orderType' and storeId=1 and is_delete=0"); $three_count[$o_threeinfo['statusCode']] = $s_total; } $this->smarty->assign('three_count', $three_count); $toptitle = '订单显示页面'; //头部title $this->smarty->assign('toptitle', $toptitle); $this->smarty->assign('toplevel', 0); $threelevel = '1'; //当前的三级菜单 $this->smarty->assign('threelevel', $threelevel); $statusMenu = $omAvailableAct->act_getTNameList('om_status_menu', ' * ', 'WHERE is_delete=0 '); $this->smarty->assign('statusMenu', $statusMenu); $value = ''; $where = ''; switch ($searchTransportationType) { case '1': $transportation = CommonModel::getCarrierList(1); //快递 break; case '2': $transportation = CommonModel::getCarrierList(0); //平邮 break; default: $transportation = CommonModel::getCarrierList(); //所有的 break; } //var_dump($transportation); exit; $transportationList = array(); foreach ($transportation as $tranValue) { $transportationList[$tranValue['id']] = $tranValue['carrierNameCn']; } //var_dump($transportationList); exit; $this->smarty->assign('transportation', $transportation); $this->smarty->assign('transportationList', $transportationList); //var_dump($orderid, $ostatus,$otype); $omOrderList = $OrderModifyAct->act_getModifyOrderList($orderid, $ostatus, $otype, $storeId = 1); //var_dump($omOrderList); //$sku = array(); $account_where = ' WHERE is_delete = 0 '; if ($searchPlatformId) { $account_where .= ' AND platformId = ' . $searchPlatformId; } $accountList = $UserCompetenceAct->act_showGlobalUser(); if ($accountList) { $account_where .= ' AND id in ( ' . join(',', $accountList) . ' ) '; } //帐号信息 $accountList = $omAvailableAct->act_getTNameList('om_account', '*', $account_where); //var_dump($accountList); exit; $account = array(); foreach ($accountList as $v) { $account[$v['id']] = $v['account']; } //包材信息 $pm = GoodsModel::getMaterInfoByList(); //获取系统所有状态 $statusList = copyOrderModel::selectStatusList(); $CurrencyAct = new CurrencyAct(); $currencyList = $CurrencyAct->act_getCurrencyListById(); //echo "<pre>"; print_r($currencyList); exit; $this->smarty->assign('currencyList', $currencyList); $this->smarty->assign('statusList', $statusList); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('account', $account); $this->smarty->assign('accountList', $accountList); $this->smarty->assign('pm', $pm); $this->smarty->assign('omOrderList', $omOrderList); $this->smarty->display('orderModify.htm'); }
public function act_updateDetail() { global $memc_obj; $start = time(); //ob_start();//不加这个是不行的(貌似不加可以) $omAvailableAct = new OmAvailableAct(); global $definedArr; require_once WEB_PATH . "conf/scripts/script.ebay.config.php"; $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 '); $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT); $definedArr = get_defined_vars(); /*$end = time(); echo $end-$start; echo "<br>"; $start = $end;*/ //var_dump($_POST); exit; $orderid = $_POST['orderid']; $omOrderDetailId = $_POST['omOrderDetailId']; //$data = unset($_POST['omOrderDetailId']); $update_detail = array(); $update_detail_extral = array(); $update_detail['recordNumber'] = $_POST['recordNumber']; $update_detail['sku'] = $_POST['sku']; $update_detail_extral['itemTitle'] = $_POST['itemTitle']; $update_detail['itemPrice'] = $_POST['itemPrice']; $update_detail['shippingFee'] = $_POST['shippingFee']; $update_detail['amount'] = $_POST['amount']; $update_detail_extral['note'] = $_POST['note']; $platformId = $_POST['detail_platformId']; $platfrom = omAccountModel::getPlatformSuffixById($platformId); $extension = $platfrom['suffix']; //获取后缀名称 $detailArr = explode(',', $omData); //缺少事件 BaseModel::begin(); //开始事务 $tableName = "om_unshipped_order_detail"; $where = " WHERE id = " . $omOrderDetailId; if ($update_detail) { $rtn = OrderindexModel::updateOrder($tableName, $update_detail, $where); if ($rtn) { /*$tableName = "om_unshipped_order"; $where = " WHERE id = ".$orderid; $updateOrder = array(); $orderData = OrderindexModel::showOrderList($tableName, $where); $orderData = $orderData[$orderid]; //var_dump($orderData); $orderDetail = $orderData['orderDetail']; $calcInfo = CommonModel :: calcAddOrderWeight($orderDetail);//计算重量和包材 //var_dump($calcInfo); exit; $updateOrder['calcWeight'] = $calcInfo[0]; $updateOrder['pmId'] = $calcInfo[1]; if(count($orderDetail) > 1){ $updateOrder['orderAttribute'] = 3; }else if(isset($orderDetail[0]['orderDetailData']['amount']) && $orderDetail[0]['orderDetailData']['amount'] > 1){ $updateOrder['orderAttribute'] = 2; } $calcShippingInfo = CommonModel :: calcAddOrderShippingFee($orderData,1);//计算运费 //var_dump($calcShippingInfo); exit; //$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee']; $updateOrder['channelId'] = $calcShippingInfo['fee']['channelId']; $interceptInfo = CommonModel :: auto_contrast_intercept($orderData); //print_r($interceptInfo); exit; $updateOrder['orderStatus'] = $interceptInfo['orderStatus']; $updateOrder['orderType'] = $interceptInfo['orderType']; $rtn2 = OrderindexModel::updateOrder($tableName, $updateOrder, $where); if(!$rtn2){ BaseModel :: rollback(); }*/ } else { BaseModel::rollback(); } } //ob_end_clean(); if ($update_detail_extral) { $tableName = "om_unshipped_order_detail_extension_" . $extension; $where = " WHERE omOrderdetailId = " . $omOrderDetailId; $rtn = OrderindexModel::updateOrder($tableName, $update_detail_extral, $where); if (!$rtn) { BaseModel::rollback(); } } BaseModel::commit(); BaseModel::autoCommit(); self::$errCode = OrderindexModel::$errCode; self::$errMsg = OrderindexModel::$errMsg; return $rtn; }
public function act_eubTrucknumber() { date_default_timezone_set("Asia/Chongqing"); error_reporting(0); $transportationlist = CommonModel::getCarrierList(); $transportation = array(); foreach ($transportationlist as $k1 => $v1) { $transportation[$v1['id']] = $v1['carrierNameCn']; } /* $strOrder = ''; $arr_orders = array(); $arr_accounts = array(); $arr_records = explode(',', $strTxet); foreach ($arr_records as $k => $v) { list($order,$account) = explode('--', $v); $arr_orders[] = $order; $arr_accounts[] = $account; $strOrder .= "','".$order; } echo "<pre>"; echo $strOrder; //print_r($arr_orders); //print_r($arr_accounts); exit;*/ /*$table = " `om_unshipped_order_detail` AS b LEFT JOIN `om_unshipped_order` AS a ON a.id = b.omOrderId LEFT JOIN `om_unshipped_order_userInfo` AS c ON a.id = c.omOrderId LEFT JOIN `om_unshipped_order_extension_aliexpress` AS d ON a.id = d.omOrderId LEFT JOIN `om_unshipped_order_detail_extension_aliexpress` AS e ON b.id = e.omOrderdetailId LEFT JOIN `om_order_tracknumber` as f ON a.id = f.omOrderId LEFT JOIN `om_account` AS g ON a.accountId = g.id "; $field = " a.recordNumber,g.account,c.platformUsername,a.ordersTime,a.paymentTime,a.onlineTotal,a.actualShipping,a.actualTotal,d.currency,a.calcWeight,d.declaredPrice,d.PayPalPaymentId,b.sku,b.amount,e.itemTitle,d.feedback,c.username,c.countryName,c.state,c.city,c.street,c.zipCode,c.landline,c.phone,a.transportId "; $where = " WHERE a.platformId = '16' AND a.orderAddTime > '1394035200' AND a.orderAddTime < '1394467200' "; $omAvailableAct = new OmAvailableAct(); $unShipOrderList = $omAvailableAct->act_getTNameList($table, $field, $where); foreach ($unShipOrderList as $k2 => $v2) { //key代表最外层的维数 $detail = $v; $detail['transportName'] = $transportation[$v2['transportId']]; unset($detail['transportId']); $excel->addRow($detail); } echo "<pre>"; print_r($unShipOrderList); exit;*/ $fileName = "UnShipments" . date('Y-m-d') . ".xls"; $excel = new ExportDataExcel('browser', $fileName); $excel->initialize(); $row = array('订单编号', '买家名称', '买家邮箱1', '买家邮箱2', '买家邮箱3', '下单时间', '付款时间', '产品总金额', '物流费用', '订单金额', '币种', 'Transaction ID', '申报价值', '估算重量', 'SKU', '数量', '产品名称', '订单备注', '收货人名称', '收货国家', '州/省', '城市', '地址', '邮编', '联系电话1', '联系电话2', '联系电话3', '手机', '买家选择物流', '平台账号', '跟踪号'); $excel->addRow($row); $table = " `om_shipped_order_detail` AS b \n LEFT JOIN `om_shipped_order` AS a ON a.id = b.omOrderId\n LEFT JOIN `om_shipped_order_userInfo` AS c ON a.id = c.omOrderId\n LEFT JOIN `om_shipped_order_extension_aliexpress` AS d ON a.id = d.omOrderId\n LEFT JOIN `om_shipped_order_detail_extension_aliexpress` AS e ON b.id = e.omOrderdetailId LEFT JOIN `om_order_tracknumber` as f ON a.id = f.omOrderId \n LEFT JOIN `om_account` AS g ON a.accountId = g.id \n LEFT JOIN `om_order_notes` AS h ON a.id = h.omOrderId "; $field = " a.recordNumber,a.ordersTime,a.paymentTime,a.onlineTotal,a.actualShipping,a.actualTotal,a.calcWeight,a.transportId,d.declaredPrice,d.PayPalPaymentId,b.sku,b.amount,e.itemTitle,d.feedback,c.platformUsername,c.email,c.username,c.countryName,c.currency,c.state,c.city,c.street,c.zipCode,c.landline,c.phone,f.tracknumber,g.account,h.content "; $where = " WHERE a.recordNumber in ('559220080488213','61291048149790','61291014326917','61285636311954','61299676786510','61257847770012','1171653376007','1342566038012','1342550690012','1342524909012','1342515426012','1342413527012','1342399574012','1342390599012','1342367093012','1342314002012','1342310983012','1342290240012','1342133149012','1342120869012','1342118622012','1342081543012','1172474925007','1172315504007','1172299770007','1172296184007','1172272680007','1172232882007','1172223365007','1172182526007','1172126469007','558981387361611','558487478479670','558460023922925','557494022572438','DD14030800858','DD14030800269','DD14030800028','DD14030800525','DD14030800473','DD14030800333','DD14030800327','DD14030800255','DD14030800252','DD14030800222','DD14030800123','DD14030800120','DD14030800114','DD14030800111','DD14030701909','DD14030701900','DD14030701897','DD14030701870','DD14030701862','DD14030701825','DD14030701804','DD14030701724','DD14030701628','DD14030701582','DD14030701521','DD14030701456','DD14030701453','DD14030800027','DD14030701839','DD14030701759','171854-1','171795-1','21230-1','21221-1','61300512856554','DD14030600356','560386182450074','560445368025526','560735706789508','tt26353 clock-maker-2003','557295691973440','560574194439744','560875202763990','560762748300826','559871057882405','1171983566007','559987766894519','558843852813198','026-2038948-1825953','560195307202708','560118439761577','560614570129474','560604162366800','61233033960335','61225401138144','61275776866334','61283751550514','61284381471047','61271644078579','61285971256188','61286694581510','61286457896555','61273360806194','61287102116285','61288784939131','61289515402687','61290457641996','61291268481630','61292236773732','61278564524075','61298273217872','61284209829125','61300945144583','61271728212854','61303225891249','61266347810315','61282400441698','61257905772517','61283695281297','61273648438832','61279523250615','61297173545612','61300390671128','61301813182124','61283752032239','61284146363591','61287931644618','61293690836849','61299950555255','61300354697689','61288949877623','61286041305506','61301553743972','61277379550615','61294274238692','61281604636692','61261903830103','61257008371173','61275686039202','61291354923312','61291893569713','61278566094239','61278769877617','61293864388329','61282765315776','61298697699029','61284928938443','61299558787159','61302422095276','61272643402639','202-8393434-1143552','224697','188403','026-9661670-0337959','58452','223786','223741','220371','188117','186781','188235','223689','218802','197544','188074','60262','558246027770826','528226','223407','218656','101770','1341546884012','1760855','176832','526693','219168','CN100013211','222168','61270307460048','105-8385470-2341026','106-8240274-1106603','523208','218133','61274545010953','61280384012104','61281919468547','61285998314076','61278855631594','61280505522639','61268603902803','61219012417370','61279110037621','61274064981817','61264566746663','61279266542058','61282198497751','61283350036547','61275139782894','61276103852273','61280872818965','61280057928870','61278504882195','61281135133896','61281392411898','61281294973925','61268565467244','61282631771728','61269563947797','61279838412445','61274342499990','61263606811067','61274785500124','61222565934461','26354','26356','26349','26345 jerikavazquezbermudez','61275958205863','61269285568291','61270402108315','61274339549496','61274546569687','61274802947529','61275751827350','61262847093901','61276629817558','61278175910616','61266721802310','61279901031227','61280690942912','61286380743625','61297839638906','61307624738338','61277028514524','61261240188489','61299055455120','26335','DD14030700132','DD14030601731','DD14030601397','DD14030601302','DD14030601298','DD14030700978','DD14030700788','DD14030700499','DD14030700332','DD14030700214','DD14030700204','DD14030601996','DD14030601838','DD14030601748','DD14030601585','DD14030601395','DD14030601384','DD14030601297','DD14030601284','DD14030700241','DD14030700069','DD14030601842','DD14030601707','171767','171755','171731','171724','171716','171676','21193','171659','171636','23640','10060#EF14030600078#00001','10058#EF14030600033#00001','10053#ED14030500099#00003','10052#ED14030500099#00002','10052#CIC14030600011#00001','10051#EF14030600007#00002','10050#EF14030600001#00004','10039#ED14022800279#00001','61288625724862','61301695017139','61262016159344','61268148743481','61302659500997','61281583119393','61286067476828','61273077999487','61288025605103','1325','1324','1323','1319','1318','1317','1341033505012','1341009132012','1341824240012','1341696946012','1341694163012','1341575187012','1341552132012','1171516107007','1171507984007','1171492136007','1171575046007','1172017468007','1172004350007','1171994219007','1171984578007','1171926583007','1171924919007','1171904569007','1171903716007','1171840428007','1171820921007','1171933127007','1341496314012','1341452776012','1341430719012','1341387307012','1341344799012','1341318614012','1341248976012','1341228817012','1341187566012','1341113133012','1171038439007','1171033243007','1170993495007','1171481958007','1171474896007','1171472379007','1171457400007','1171449215007','1171447905007','1171416970007','1171251355007','1171196353007','1171165850007','1171147108007','1171039940007','26337','DL00063245','61281572272997','61280185621112','558897626662002','559457550085319','559964179142377','559936580977023','559364883586789','558042806763467','557981705438975','558266733802235','558198507852622','557953639231007','557957714549391','557958516721499','557183300613704','557882892610971','557616359665851','1171017114007','1171004617007','1170988981007','1170976546007','1170433249007','558951559459508','559400560676789','559630880572235','559540508725117','559070020338919','558834837695702','1169337760','5581989066539311','558007554317350','559143459057814','1456015806','1456031064','558064192600975','1168657452','CYBS06140309','559167238163972','557996971531592','557659877402622','558001924546789','557729957608803','558094428083493','558167306158085','558274562942401','558386251311684','558527284183280','880823','558088270434082','558796179128106','558923216912503','558797711647636','558884118112405','219398','112-8281922-9312205','558575557867256','1455857822','1455944107','1455944508','1455957240','1455959108','1455959695','1455964405','1455964817','1455974683','1455975207','1455991212','1456014821','1456020637','1456021409','1456043496','1456045982','1455952462','1455953028','1455956237','1455962265','1455962496','1455971675','1455971936','1455973327','1455976832','1455985967','1455987643','1455996313','526380','157972','187584','223184','223181','CYBS13140316','525712','223049','89562','CN100012942','DL00079730','DL00079644','DD14030502002','DD14030501926','DD14030501877','DD14030501771','DD14030501558','DD14030501507','DD14030501495','DD14030501444','DD14030501147','DD14030601105','DD14030601102','DD14030600470','DD14030600252','DD14030501930','DD14030501886','DD14030501804','DD14030501297','DD14030501232','BD14030601169','187186','DL00080075','DL00077878','218374','187024','523612','33598','558057068255073','557772672117459','1455848911','1455941088','1455954864','1455957247','1455959313','1455967410','196296','186350') "; $omAvailableAct = new OmAvailableAct(); $unShipOrderList = $omAvailableAct->act_getTNameList($table, $field, $where); foreach ($unShipOrderList as $k2 => $v2) { //key代表最外层的维数 $detail = $v2; $ordersTime = date('Y-m-d', $detail['ordersTime']); $paymentTime = date('Y-m-d', $detail['paymentTime']); $transport = $transportation[$v2['transportId']]; $note = $detail['content'] . ' ' . $detail['feedback']; $detailRow = array($detail['recordNumber'], $detail['platformUsername'], $detail['email'], '', '', $ordersTime, $paymentTime, $detail['onlineTotal'], $detail['actualShipping'], $detail['actualTotal'], $detail['currency'], $detail['PayPalPaymentId'], $detail['declaredPrice'], $detail['calcWeight'], $detail['sku'], $detail['amount'], $detail['itemTitle'], $note, $detail['username'], $detail['countryName'], $detail['state'], $detail['city'], $detail['street'], $detail['zipCode'], $detail['landline'], '', '', $detail['phone'], $transport, $detail['account'], $detail['tracknumber']); $excel->addRow($detailRow); } $excel->finalize(); exit; }
public static function overWeightSplitB2B($omOrderId) { !self::$dbConn ? self::initDB() : null; global $memc_obj; //调用memcache获取sku信息 $mctime = time(); //var_dump($moOrderIdArr); $tableName = 'om_unshipped_order'; $where = ' WHERE id = ' . $omOrderId . ' and is_delete = 0 and storeId = 1'; $orderData = OrderindexModel::showOrderList($tableName, $where); $orderDetail = $orderData[$omOrderId]['orderDetail']; $obj_order_data = $orderData[$omOrderId]['orderData']; $orderExtenData = $orderData[$omOrderId]['orderExtenData']; $orderUserInfoData = $orderData[$omOrderId]['orderUserInfoData']; $_actualTotal = $obj_order_data['actualTotal']; $_actualShipping = $obj_order_data['actualShipping']; $_platformId = $obj_order_data['platformId']; $_mainId = $obj_order_data['id']; $_transportId = $obj_order_data['transportId']; //var_dump($orderDetail); exit; $omAvailableAct = new OmAvailableAct(); $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 AND platformId in(1,5) '); $weightlists = array(); $skuinfo = array(); $goods_sn_nums = 0; $shippfee_arr = array(); $ebay_total_be = 0; foreach ($orderDetail as $k => $f) { $sku = trim($f['orderDetailData']['sku']); $amount = $f['orderDetailData']['amount']; $shippingFee = $f['orderDetailData']['shippingFee']; $goods_sn_nums += $amount; $ebay_total_be += $f['orderDetailData']['amount'] * $f['orderDetailData']['itemPrice']; $shippfee_arr[$sku] = round($shippingFee / $amount, 3); //单个料号的运费 $skuinfo[$sku] = $f; for ($i = 1; $i <= $amount; $i++) { $var = $sku; $oneskuweight = CommonModel::calcOnlySkuWeight($var, 1); //一个sku的重量 $weightlists[$var][] = $oneskuweight[0]; } } $rate = $_actualTotal / $ebay_total_be; //var_dump($weightlists); exit; if ($goods_sn_nums <= 1) { self::$errCode = '0020'; self::$errMsg = "只有一个料号组成,不允许超重拆分"; return false; } //echo "==========="; exit; $keyarray = array(); $keyarrays = array(); $checkweight = 0; $arrinfo = CommonModel::calcNowOrderWeight($omOrderId); //var_dump($arrinfo); exit; $realweight = $arrinfo[0]; $realcosts = $arrinfo[2]; $itemprices = $arrinfo[3]; foreach ($weightlists as $wk => $wv) { foreach ($wv as $weightlist) { $checkweight += $weightlist; if ($checkweight > 1.85) { $keyarrays[] = $keyarray; $keyarray = array(); $checkweight = $weightlist; $keyarray[$wk][] = $wk; } else { $keyarray[$wk][] = $wk; } } } if (!empty($keyarray)) { $keyarrays[] = $keyarray; } //var_dump($keyarrays); exit; BaseModel::begin(); //开始事务 $insert_orderData = array(); foreach ($keyarrays as $keyarray) { $ebay_total = 0; $totalweight = 0; $insert_ebay_ids = array(); //var_dump($skuinfo); echo "<br>"; foreach ($keyarray as $k => $kav) { //var_dump($skuinfo[$k]['orderDetailData']['itemPrice'], count($kav)); //$ebay_total += ($skuinfo[$k]['orderDetailData']['itemPrice'] + $shippfee_arr[$k]) * count($kav); $ebay_total += $skuinfo[$k]['orderDetailData']['itemPrice'] * count($kav); } $ebay_total = $rate * $ebay_total; $shipfee = 0; //$val = generateOrdersn(); $insert_obj_order_data = $obj_order_data; unset($insert_obj_order_data['id']); $insert_obj_order_data['actualTotal'] = $ebay_total; $insert_obj_order_data['orderType'] = C('STATEPENDING_OWDONE'); $insert_obj_order_data['orderAddTime'] = $mctime; $insert_obj_order_data['isSplit'] = 2; $insert_orderExtenData = $orderExtenData; unset($insert_orderExtenData['id']); $insert_orderUserInfoData = $orderUserInfoData; unset($insert_orderUserInfoData['id']); $insert_orderData = array('orderData' => $insert_obj_order_data, 'orderExtenData' => $insert_orderExtenData, 'orderUserInfoData' => $insert_orderUserInfoData); /*$sql = "insert into ebay_splitorder (recordnumber, main_order_id, split_order_id, create_date) values ('$recordnumber', '$ebay_id', '$insert_ebay_id', '".date("Y-m-d H:i:s")."')"; $split_log .= "添加主定单和拆分订单到关系表中\r\n".$sql ."\r\n"; $dbcon->execute($sql) or die("Fail : $sql");*/ $obj_order_detail_data = array(); foreach ($keyarray as $k => $kav) { $sku = $k; $amount = count($kav); $insert_orderDetailData = $skuinfo[$k]['orderDetailData']; unset($insert_orderDetailData['id']); $insert_orderDetailData['sku'] = strtoupper($sku); $insert_orderDetailData['amount'] = $amount; $insert_orderDetailData['createdTime'] = $mctime; if (isset($shippfee_arr[$sku])) { $insert_orderDetailData['shippingFee'] = $shippfee_arr[$sku] * $amount; //相同料号运费拆分 } $insert_orderDetailExtenData = $skuinfo[$k]['orderDetailExtenData']; unset($insert_orderDetailExtenData['id']); $obj_order_detail_data[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData); } $insert_orderData['orderDetail'] = $obj_order_detail_data; //echo "<pre>"; //var_dump($obj_order_detail_data); exit; $calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data); //计算重量和包材 //var_dump($calcInfo); exit; $insert_orderData['orderData']['calcWeight'] = $calcInfo[0]; $insert_orderData['orderData']['pmId'] = $calcInfo[1]; //var_dump($insert_orderData); exit; $calcShippingInfo = CommonModel::calcAddOrderShippingFee($insert_orderData, 1); //计算运费 //var_dump($calcShippingInfo); exit; $insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee']; $insert_orderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId']; /*$interceptInfo = CommonModel :: auto_contrast_intercept($orderData); //print_r($interceptInfo); exit; $orderData['orderData']['orderStatus'] = $interceptInfo['orderStatus']; $orderData['orderData']['orderType'] = $interceptInfo['orderType'];*/ if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insert_orderData)) { //echo $split_log .= 'insert success!' . "\n"; exit; //var_dump($_mainId,$_spitId); exit; if (!OrderLogModel::insertOrderLog($_spitId, 'INSERT ORDER')) { BaseModel::rollback(); self::$errCode = '0021'; self::$errMsg = "split error!"; return false; } if (!OrderRecordModel::insertSpitRecords($_mainId, $_spitId)) { BaseModel::rollback(); self::$errCode = '0022'; self::$errMsg = "split error!"; return false; } } else { $split_log .= 'insert error!' . "\n"; BaseModel::rollback(); self::$errCode = '0023'; self::$errMsg = "split error!"; return false; } if (!OrderindexModel::deleteOrderData($tableName, $where)) { self::$errCode = '0024'; self::$errMsg = "split error!"; return false; } if (!OrderLogModel::insertOrderLog($_mainId, 'DELETE ORDER')) { BaseModel::rollback(); self::$errCode = '0025'; self::$errMsg = "split error!"; return false; } BaseModel::commit(); BaseModel::autoCommit(); } self::$errCode = '200'; self::$errMsg = "split success!"; return true; }
if (strtoupper($site) == "UK") { //uk站点的url $serviceURL = "https://mws.amazonservices.co.uk"; } $config = array('ServiceURL' => $serviceURL, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3); $service = new MarketplaceWebService_Client(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, $config, APPLICATION_NAME, APPLICATION_VERSION); //var_dump($service); exit; //exit('ffff'); $marketplaceIdArray = array("Id" => array(MARKETPLACE_ID)); $now = date(DATE_ATOM); //当前时间 $nowtime = time(); $mctime = $nowtime; $start = strtotime(date('Y-m-d', $nowtime - 3600 * $hours) . ' 00:00:00'); $end = strtotime(date('Y-m-d', $nowtime) . ' 23:59:59'); $omAvailableAct = new OmAvailableAct(); $where = 'WHERE is_delete=0 '; $where .= 'AND platformId = 11 '; $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', $where); //var_dump($GLOBAL_EBAY_ACCOUNT); $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT); $accountId = $FLIP_GLOBAL_EBAY_ACCOUNT[$account]; /*$order_sql = " select ebay_orderid,ebay_account,ebay_ordersn,ebay_countryname, ebay_id,ebay_tracknumber,ebay_carrier,ebay_combine,recordnumber from ebay_order where ebay_user='******' AND ((scantime>=$start AND scantime<=$end) or ebay_status = '614') AND ebay_combine!='1' AND (ShippedTime ='' or ShippedTime is null) AND ebay_tracknumber!='' AND ebay_carrier!=''
function get_account_id($accountName) { $info = array(); $omAvailableAct = new OmAvailableAct(); $where = " WHERE account = '{$accountName}' AND is_delete = 0 "; $res = $omAvailableAct->act_getTNameList('om_account', 'id,platformId', $where); $info = array('accountid' => $res[0]['id'], 'platformid' => $res[0]['platformId']); return $info; }