where('switch', 1)->find(); $shippingfee = 0; if (empty($freight)) { return $shippingfee; } //当前模板 计费类型 ,1=计件 ,2=计重 $FreightItems = new FreightItems(); switch ($freight['type']) { case 1: $shippingfee = $FreightItems->numPostage($freight, $area_id, $nums, $amount); break; case 2: $shippingfee = $FreightItems->weightPostage($freight, $area_id, $nums, $weight, $amount); break; } return $shippingfee; } }