本文整理汇总了PHP中CommonModel::calcshippingfee方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::calcshippingfee方法的具体用法?PHP CommonModel::calcshippingfee怎么用?PHP CommonModel::calcshippingfee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonModel
的用法示例。
在下文中一共展示了CommonModel::calcshippingfee方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: act_repeatShipments2
//.........这里部分代码省略.........
$address = $orderUserInfoStreet1 . "\n" . $orderUserInfoStreet2 . "\n" . $orderUserInfoCity . "\n" . $orderUserInfoState . "\n" . $orderUserInfoZip . "\n" . $orderUserInfoCountryName;
//字段拼接成地址
$orderWhInfoWeighTime = date('Y-m-d', $orderWhInfoData['weighTime']);
//称重时间,亦可以当做发货时间 $scantime
$OrderCalcWeight = $orderData['calcWeight'];
//估算重量,单位是kg $calculate_weight
$orderWhInfoActualWeight = number_format($orderWhInfoData['actualWeight'] / 1000, 3);
//实际重量 $orderweight2
$totalweight = $orderWhInfoActualWeight;
//总重量
$mailway_c = $channels[$OrderChannelId];
//根据运输管理系统的接口获取
$isContainCombineSku = CommonModel::judge_contain_combinesku($orderId);
//$ebay_combineorder 判断订单是否包含组合料号,返回true or false
if (count($orderDetail) == 1) {
//订单明细中只有一条记录时,订单中只有一种料号
$orderDetailTotalData = array_pop($orderDetail);
//取得orderDetail中的这条总记录数据,包括orderDetailData和orderDetailExtenData
$orderDetailData = $orderDetailTotalData['orderDetailData'];
//明细中的常用数据
$orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
//明细中的扩展数据
$orderDetailSku = $orderDetailData['sku'];
//该明细下的$sku
$orderDetailExtenItemId = $orderDetailExtenData['itemId'];
//itemId $ebay_itemid
$orderDetailAmount = intval($orderDetailData['amount']);
//$amount 该明细下的sku对应的数量
$orderDetailRecordnumber = $orderDetailData['recordNumber'];
//该明细对应平台的recordnumber $recordnumber
$orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount;
//itemPrice(平台对应的销售单价)*对应数量 $ebay_itemprice
// $ebay_shipfee = round_num(($OrderActualTotal - $orderDetailItemPrice), 2);
$ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
//round_num(($OrderActualTotal - $orderDetailItemPrice), 2); //订单总价-sku对应的总价得出运费,$ebay_shipfee
$ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
$skus = GoodsModel::get_realskuinfo($orderDetailSku);
//获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息)
$values_skus = array_values($skus);
//得到sku的数量
$goods_location = CommonModel::getPositionBySku($orderDetailSku);
//仓位
$goodsInfo = GoodsModel::getSkuinfo($orderDetailSku);
//获取真实sku的详细信息,包括采购名称和可用库存
$goodsWeight = $goodsInfo['goodsWeight'];
//料号重量
$goods_cost = isset($goodsInfo['goodsCost']) ? round($goodsInfo['goodsCost'], 2) : 0;
//采购成本
$pmId = isset($goodsInfo['pmId']) ? $goodsInfo['pmId'] : '';
//包材Id
$ebay_packingmaterial = $packings[$pmId]['pmName'];
//包材名称
$ebay_packingCost = $packings[$pmId]['pmCost'];
//包材成本
$purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : '';
$cguser = $staffLists[$purchaseId];
//采购名称
$combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku);
//判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false
if ($combineSku !== false) {
//为组合订单
$goods_costs = 0;
$combine_weight_list = array();
$goods_costs_list = array();
foreach ($skus as $k => $v) {
$goodsInfo2 = GoodsModel::getSkuinfo($k);
示例2: combinePackage
public static function combinePackage($tableName, $plateform_arr, $carrierIds, $id_array, $storeId = 1)
{
self::initDB();
$list = self::selectList($tableName, $plateform_arr, $carrierIds, $id_array);
//var_dump($list); exit;
if (!$list) {
self::$errCode = 301;
self::$errMsg = "没有需要合并的订单!";
return false;
}
/*foreach($list as $key=>$value){
$key = $value['id'];
}
var_dump($key); exit;*/
BaseModel::begin();
$combineNum = 0;
foreach ($list as $key => $value) {
$where = "b.userName = '{$value['userName']}' \n\t\t\t\t\tAND b.countryName = '{$value['countryName']}' \n\t\t\t\t\tAND a.accountId = {$value['accountId']} \n\t\t\t\t\tAND a.transportId = {$value['transportId']} \n\t\t\t\t\tAND b.state='{$value['state']}' \n\t\t\t\t\tAND b.city='{$value['city']}' \n\t\t\t\t\tAND b.street='{$value['street']}' \n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND a.calcWeight<=2 \n\t\t\t\t\tAND a.isLock=0 \n\t\t\t\t\tAND a.is_delete=0 \n\t\t\t\t\tAND a.combinePackage=0 \n\t\t\t\t\tAND a.orderStatus={$value['orderStatus']}\n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND is_delete = 0 AND storeId = " . $storeId;
$records = combinePackageModel::selectRecord($tableName, $where, $id_array);
//var_dump($records); exit;
if (!$records) {
continue;
} else {
$weightlists = array();
$orderinfo = array();
$countryName = $records[0]['countryName'];
$transportId = $records[0]['transportId'];
foreach ($records as $record) {
$omOrderId = $record['id'];
$omOrderId = $record['id'];
$orderinfo[$record['id']] = $record;
$arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
//var_dump($arrinfo); exit;
$realweight = $arrinfo[0];
$realcosts = $arrinfo[2];
$itemprices = $arrinfo[3];
$weightlists[$omOrderId] = $realweight;
}
//var_dump($weightlists); exit;
$keyarray = array();
$keyarrays = array();
$checkweight = 0;
foreach ($weightlists as $wk => $weightlist) {
$checkweight += $weightlist;
if ($checkweight > 1.85) {
$keyarrays[] = $keyarray;
$keyarray = array();
$checkweight = $weightlist;
$keyarray[] = $wk;
} else {
$keyarray[] = $wk;
}
}
if (!empty($keyarray)) {
$keyarrays[] = $keyarray;
}
//var_dump($keyarrays); echo "<br>";
foreach ($keyarrays as $orderlist) {
if (count($orderlist) < 2) {
continue;
}
$ordervalueweight = array();
$ordervalueactualTotal = array();
foreach ($orderlist as $orderid) {
$ordervalueweight[$orderid] = $weightlists[$orderid];
$ordervalueactualTotal[$orderid] = $orderinfo[$orderid]['actualTotal'];
}
//var_dump($ordervalueactualTotal); exit;
//var_dump($ordervalueweight); exit;
$firstorder = array_shift($orderlist);
//第一个订单编号信息
//var_dump($firstorder);
$combineInfo = CommonModel::calcshippingfee(array_sum($ordervalueweight), $countryName, array_sum($ordervalueactualTotal), $transportId);
//邮寄方式计算
//var_dump($combineInfo); exit;
$weight2fee = calceveryweight($ordervalueweight, $combineInfo['fee']['fee']);
//var_dump($weight2fee); exit;
$firstweightfee = array_shift($weight2fee);
//第一个订单重量运费信息
$data = array();
$data['combinePackage'] = 1;
$data['orderStatus'] = C('STATEPENDING');
$data['orderType'] = C('STATEPENDING_CONPACK');
$where = ' WHERE id = ' . $firstorder;
if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
self::$errCode = 303;
self::$errMsg = "更新主订单失败!";
BaseModel::rollback();
return false;
}
foreach ($orderlist as $sonorder) {
$data['combinePackage'] = 2;
$data['orderStatus'] = C('STATEPENDING');
$data['orderType'] = C('STATEPENDING_CONPACK');
$where = ' WHERE id = ' . $sonorder;
if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
self::$errCode = 304;
self::$errMsg = "更新子订单失败!";
BaseModel::rollback();
return false;
//.........这里部分代码省略.........