20240120-ljl-routeConfig
ljl 10 months ago
parent c1bf29ee7f
commit e99dcaaa2a

@ -748,19 +748,48 @@ class ExpressTplService extends AbstractService {
foreach ($serviceInfo as $service) { foreach ($serviceInfo as $service) {
$attributeList = []; $attributeList = [];
foreach ($service['service_attributes'] as $attribute) { foreach ($service['service_attributes'] as $attribute) {
$attributeList[] = [ $attributeList[] = array_merge([
'name' => $attribute['attribute_name'], 'name' => $attribute['attribute_name'],
'code' => $attribute['attribute_code'], 'code' => $attribute['attribute_code'],
'options' => CommonTool::convertMapToOptions(json_decode($attribute['type_desc'], true)), ], $this->getNetSiteServiceAttribute($service['service_code'], $attribute));
'type' => $attribute['attribute_type'],
];
} }
$serviceList[] = [ $serviceList[] = [
'name' => $service['service_name'], 'name' => $service['service_name'],
'code' => $service['service_code'], 'code' => $service['service_code'],
'attributes' => $attributeList, 'attributes' => $attributeList,
'required' => $service['required'],
]; ];
} }
return $serviceList; return $serviceList;
} }
private function getNetSiteServiceAttribute($serviceCode, $attribute) {
$attributeCode = $attribute['attribute_code'];
$typeDesc = json_decode($attribute['type_desc'], true);
$result = [];
if ($serviceCode == 'TIMED-DELIVERY' && $attributeCode == 'value') {
$result['type'] = 'select';
} elseif ($serviceCode == 'INSURE' && $attributeCode == 'value') {
$result['type'] = 'number';
} elseif ($serviceCode == 'IN41' && $attributeCode == 'value') {
$result['type'] = 'radio';
} elseif ($serviceCode == 'IN144' && $attributeCode == 'value') {
$result['type'] = 'input';
}
if ($result['type'] == 'number') {
if (isset($typeDesc['min'])) {
$result['min'] = $typeDesc['min'];
}
if (isset($typeDesc['max'])) {
$result['max'] = $typeDesc['max'];
}
}
if ($result['type'] == 'options') {
$result['options'] = CommonTool::convertMapToOptions($typeDesc);
}
if ($result['type'] == 'radio') {
$result['options'] = CommonTool::convertMapToOptions($typeDesc);
}
return $result;
}
} }
Loading…
Cancel
Save