public function view_returnTCArrFromChannelIdArr() { $info = returnTCArrFromChannelIdArr(array(19, 67)); foreach ($info as $key => $val) { foreach ($val as $v) { $CarrierName = M("InterfaceTran")->getCarrierNameById($v); echo '$CarrierName:' . $CarrierName; } } //$info = M('orderManage')->handleOverWeightOrder($order); //var_dump($info); }
/** * 通过渠道ID获取对应的运输方式的名称和对应渠道的名称 * 组装并且展示 * @param $usefulChannel * @return string */ function get_usefulCarrierChannel($usefulChannel, $char) { $msg = ''; $channelName = ''; $channelAll = M("InterfaceTran")->key('id')->getChannelList(); $carrierAll = M('InterfaceTran')->key('id')->getCarrierList(2); if (!empty($usefulChannel)) { $usefulChannelArray = explode(',', $usefulChannel); $usefulCarrierChannelArray = returnTCArrFromChannelIdArr($usefulChannelArray); foreach ($usefulCarrierChannelArray as $carrierId => $channelArray) { $channelName .= $carrierAll[$carrierId]['carrierNameCn'] . ': '; if (is_array($channelArray)) { foreach ($channelArray as $channelId) { $channelName .= $channelAll[$channelId]['channelName'] . ','; } } $channelName = trim($channelName, ','); $channelName .= $char; } } else { $channelName = '无可用渠道ID'; } $channelName = trim($channelName, $char); return $channelName . ' ' . $msg; }
/** * 提供错误信息列表 * @return array * @author lzx */ public function act_getTransportStrategyLists() { $data = array(); $data['is_delete'] = array('$e' => 0); if (isset($_GET['accountId']) > 0) { $data['id'] = array('$e' => intval($_GET['accountId'])); } $accountList = M('Account')->getAccountList($data, $this->page, $this->perpage); //print_r(M('InterfaceTran')->key('id')->getAllCountryList());exit; //print_r(C('TRANSPORT_STRATEGY_CURRENCY_ARRAY'));exit; if (!empty($accountList)) { $TSObject = M('TransportStrategy'); $carrierlist = M('InterfaceTran')->key('id')->getCarrierList(2); //id=>array() $channelList = M('InterfaceTran')->key('id')->getChannelList(); //id=>array() //print_r($channelList);exit; $countryList = M('InterfaceTran')->key('id')->getAllCountryList(); $currencyList = C('TRANSPORT_STRATEGY_CURRENCY_ARRAY'); foreach ($accountList as $k => $v) { $constraintTypeList = $TSObject->getAccountConstraintTypeByAccountId($v['id']); $constraintTypeList = $constraintTypeList[0]; $accountList[$k]['constraintType'] = $constraintTypeList; $constraintTypeStrArr = array(); if (!empty($constraintTypeList)) { $constraintTypeStrArr['isSpecialSpuForce'] = $constraintTypeList['isSpecialSpuForce'] == 1 ? '允许特殊料号运输方式' : '无视特殊料号运输方式'; $constraintTypeStrArr['isPlatOrAccountPri'] = $constraintTypeList['isPlatOrAccountPri'] == 1 ? '平台优先' : '账号优先'; } $accountList[$k]['accountConstraintTypeStr'] = implode(',', array_filter($constraintTypeStrArr)); //账号约束/优先级显示字符串 $conditionTransportList = $TSObject->getConditionTransportByAccountId($v['id']); if (!empty($conditionTransportList[0]['channelIdStr'])) { $conditionTransportList[0]['transportIdArr'] = explode(',', $conditionTransportList[0]['channelIdStr']); } $accountList[$k]['conditionTransport'] = $conditionTransportList[0]; $tmpChannelNameArr = array(); $returnTCArr = returnTCArrFromChannelIdArr(explode(',', $conditionTransportList[0]['channelIdStr'])); //print_r($returnTCArr); foreach ($returnTCArr as $tmpTransportId => $tmpChannelIdArr) { foreach ($tmpChannelIdArr as $tmpChannelId) { $tmpChannelNameArr[$carrierlist[$tmpTransportId]['carrierNameCn']][] = $channelList[$tmpChannelId]['channelName']; } } //print_r($tmpChannelNameArr);exit; $accountList[$k]['conditionTransportStr'] = Tarr2Str($tmpChannelNameArr); //基础运输方式ids渠道ids对应名称字符串 $conditionCountryList = $TSObject->getConditionCountryByAccountId($v['id']); //国家对应transportId的json字符串 $countryTransportArr = explode('&', $conditionCountryList[0]['countryId_channelIdStr']); //每个数组是countryId和channelId的关系字符串 if (!empty($countryTransportArr)) { $tmpConditionCountryArr = array(); foreach ($countryTransportArr as $ctStr) { //$ctStr 每个数组是countryId和transportId的关系字符串 $tmpArr = array(); $ctStrArr = explode(':', $ctStr); //$ctStrArr 0为countryIds,1为channelIds $tmpCountryIdArr = array(); $tmpCountryNameArr = array(); $tmpTransportIdArr = array(); $tmpTransportNameArr = array(); if (!empty($ctStrArr[0]) && !empty($ctStrArr[1])) { //$ctStrArr 0为countryIds,1为transportIds 都不为空 foreach (explode(',', $ctStrArr[0]) as $tmpCountryId) { $tmpCountryIdArr[] = $tmpCountryId; //国家id $tmpCountryNameArr[] = $countryList[$tmpCountryId]['countryNameEn']; //国家英文名 } $tmpArr['countryIdArr'] = $tmpCountryIdArr; $tmpArr['countryNameArr'] = $tmpCountryNameArr; foreach (explode(',', $ctStrArr[1]) as $tmpChannelId) { $tmpTransportIdArr[] = $tmpChannelId; //运输方式id //$tmpTransportNameArr[] = $channelList[$tmpChannelId]['channelName'];//运输方式中文名 } $tmpArr['transportIdArr'] = $tmpTransportIdArr; $returnTCArr = returnTCArrFromChannelIdArr($tmpTransportIdArr); $tmpChannelNameArr = array(); foreach ($returnTCArr as $tmpTransportId => $tmpChannelIdArr) { foreach ($tmpChannelIdArr as $tmpChannelId) { $tmpChannelNameArr[$carrierlist[$tmpTransportId]['carrierNameCn']][] = $channelList[$tmpChannelId]['channelName']; } } $tmpArr['transportNameArr'] = Tarr2Str($tmpChannelNameArr); $tmpArr['priority'] = $conditionCountryList[0]['priority']; } if (!empty($tmpArr)) { $tmpConditionCountryArr[] = $tmpArr; } } $accountList[$k]['conditionCountry'] = $tmpConditionCountryArr; $conditionCountryStr = ''; foreach ($tmpConditionCountryArr as $v3) { $conditionCountryStr .= implode(',', $v3['countryNameArr']) . ':' . $v3['transportNameArr'] . '&'; } if ($conditionCountryStr != '') { $conditionCountryStr .= '优先级:' . $tmpConditionCountryArr[0]['priority']; } $accountList[$k]['conditionCountryStr'] = $conditionCountryStr; } $conditionCurrencyList = $TSObject->getConditionCurrencyByAccountId($v['id']); //币种对应transportId的json字符串 $currencyTransportArr = json_decode($conditionCurrencyList[0]['currencyId_channelIdJson'], true); if (!empty($currencyTransportArr) && is_array($currencyTransportArr)) { $currencyTransportIdStrArr = array(); foreach ($currencyTransportArr as $currencyId => $currencyTransportIdArr) { $tmpCurrencyStr = $currencyList[$currencyId]['CN']; $tmpCurrencyTransportNameArr = array(); $returnTCArr = returnTCArrFromChannelIdArr($currencyTransportIdArr); $tmpChannelNameArr = array(); foreach ($returnTCArr as $tmpTransportId => $tmpChannelIdArr) { foreach ($tmpChannelIdArr as $tmpChannelId) { $tmpChannelNameArr[$carrierlist[$tmpTransportId]['carrierNameCn']][] = $channelList[$tmpChannelId]['channelName']; } } $currencyTransportIdStrArr[] = $tmpCurrencyStr . '->' . Tarr2Str($tmpChannelNameArr); } $accountList[$k]['conditionCurrency'] = $currencyTransportArr; $accountList[$k]['conditionCurrencyPriority'] = $conditionCurrencyList[0]['priority']; $accountList[$k]['conditionCurrencyStr'] = implode('&', $currencyTransportIdStrArr) . '&' . '优先级:' . $conditionCurrencyList[0]['priority']; } $conditionAmountList = $TSObject->getConditionAmountByAccountId($v['id']); //金额 $conditionAmountList = $conditionAmountList[0]; $accountList[$k]['conditionAmount'] = $conditionAmountList; if (!empty($conditionAmountList)) { $conditionStr1 = ''; $conditionStr2 = ''; if (!empty($conditionAmountList['symbolCondition1'])) { $conditionStr1 = "条件:" . $conditionAmountList['symbolCondition1'] . ' ' . $conditionAmountList['amountCondition1']; } if (!empty($conditionAmountList['symbolCondition2'])) { $conditionStr2 = "条件:" . $conditionAmountList['symbolCondition2'] . ' ' . $conditionAmountList['amountCondition2']; } $allowTypeStr = $conditionAmountList['allowType'] == 1 ? '满足一项' : '满足所有'; $tmpTransportIdArr = explode(',', $conditionAmountList['channelIdStr']); $tmpTransportNameArr = array(); $tmpTransportStr = ''; if (!empty($tmpTransportIdArr)) { $returnTCArr = returnTCArrFromChannelIdArr($tmpTransportIdArr); $tmpChannelNameArr = array(); foreach ($returnTCArr as $tmpTransportId => $tmpChannelIdArr) { foreach ($tmpChannelIdArr as $tmpChannelId) { $tmpChannelNameArr[$carrierlist[$tmpTransportId]['carrierNameCn']][] = $channelList[$tmpChannelId]['channelName']; } } $tmpTransportStr = Tarr2Str($tmpChannelNameArr); if ($tmpTransportStr != '') { $tmpTransportStr = '[' . $tmpTransportStr . ']'; } } $tmpPriorityStr = "(优先级:" . $conditionAmountList['priority'] . ")"; $accountList[$k]['conditionAmountTransportIdArr'] = $tmpTransportIdArr; $accountList[$k]['conditionAmountStr'] = implode(',', array($conditionStr1, $conditionStr2, $allowTypeStr, $tmpPriorityStr, $tmpTransportStr)); //金额-约束 } } } //print_r($accountList);exit; return $accountList; }