From c2f03d457292402d7dc2a3ed3da890a2b9d651cd Mon Sep 17 00:00:00 2001 From: ljl Date: Thu, 25 Jan 2024 13:58:45 +0800 Subject: [PATCH] yh --- .../services/OrderPrint/ExpressTplService.php | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/app/libs/services/OrderPrint/ExpressTplService.php b/app/libs/services/OrderPrint/ExpressTplService.php index 34f7d64..98af6f8 100644 --- a/app/libs/services/OrderPrint/ExpressTplService.php +++ b/app/libs/services/OrderPrint/ExpressTplService.php @@ -283,7 +283,7 @@ class ExpressTplService extends AbstractService { public function changeExpressTplName($mallId, $expressTplId, $tplName) { CheckClient::checkAnyEmpty('参数错误', $mallId, $expressTplId, $tplName); - $affRow = $this->opVenderExpressTplDao->update( + $affRow = $this->opUserExpressTplDao->update( ['tplName' => $tplName], 'op_user_express_tpl_id = %i and `mall_id` = %s', $expressTplId, $mallId @@ -295,7 +295,7 @@ class ExpressTplService extends AbstractService { public function changeExpressTplPrinter($mallId, $expressTplId, $printer) { CheckClient::checkAnyEmpty('参数错误', $mallId, $expressTplId); - $affRow = $this->opVenderExpressTplDao->update( + $affRow = $this->opUserExpressTplDao->update( ['printer' => $printer], 'op_user_express_tpl_id = %i and `mall_id` = %s', $expressTplId, $mallId @@ -308,7 +308,7 @@ class ExpressTplService extends AbstractService { public function changeExpressTplSenderAddress($mallId, $expressTplId, $senderAddressId) { CheckClient::checkAnyEmpty('参数错误', $mallId, $expressTplId); - $affRow = $this->opVenderExpressTplDao->update( + $affRow = $this->opUserExpressTplDao->update( ['opSenderAddressId' => $senderAddressId], 'op_user_express_tpl_id = %i and `mall_id` = %s', $expressTplId, $mallId @@ -737,10 +737,48 @@ class ExpressTplService extends AbstractService { 'cancelQuantity' => $item['cancel_quantity'], 'recycledQuantity' => $item['recycled_quantity'], 'allocatedQuantity' => $item['allocated_quantity'], - 'serviceInfo' => $item['service_info_cols'], + 'serviceList' => $this->buildNetSiteServiceList($item['service_info_cols']), 'addressList' => $addressList ]; } return $netsiteList; } + + private function buildNetSiteServiceList($serviceInfo) { + $serviceList = []; + foreach ($serviceInfo as $service) { + $attributeList = []; + foreach ($service['service_attributes'] as $attribute) { + $attributeList[] = [ + 'name' => $attribute['attribute_name'], + 'code' => $attribute['attribute_code'], + 'options' => $this->getNetSiteServiceSelectOptions($service['service_code'], $attribute['attribute_code'], $attribute['type_desc']), + 'type' => $attribute['attribute_type'], + ]; + } + $serviceList[] = [ + 'name' => $service['service_name'], + 'code' => $service['service_code'], + 'attributes' => $attributeList, + ]; + } + return $serviceList; + } + + private function getNetSiteServiceSelectOptions($serviceCode, $attributeCode, $typeDesc) { + if ($serviceCode == 'TIMED-DELIVERY' && $attributeCode == 'value') { + return CommonTool::convertMapToOptions(json_decode($typeDesc, true)); + } + return []; + } + + private function getNetSiteServiceInputType($serviceCode) { + if (in_array($serviceCode, ['PRODUCT_TYPE', 'TIMED-DELIVERY'])) { + return 'select'; + } elseif (in_array($serviceCode, ['IN41'])) { + return 'checkbox'; + } elseif (in_array($serviceCode, ['INSURE', 'IN144'])) { + return 'input'; + } + } } \ No newline at end of file