'实物商品', self::TYPE_VIRTUAL => '虚拟商品', ]; if ($type === true) { return $desc; } return $desc[$type] ?? ''; } /** * @notes 配送方式 * @param bool $type * @return string|string[] * @author ljj * @date 2023/6/28 5:07 下午 */ public static function getDeliveryTypeDesc($type = true) { $desc = [ self::DELIVERY_EXPRESS => '快递发货', self::DELIVERY_VIRTUAL => '虚拟发货', self::DELIVERY_SELF => '线下自提', ]; if ($type === true) { return $desc; } return $desc[$type] ?? ''; } static function getDeliveryLists($delivery_types) : array { $result = []; $delivery_types = array_unique($delivery_types); $lists = self::getDeliveryTypeDesc(); foreach ($delivery_types as $delivery_type) { if (isset($lists[$delivery_type])) { $result[] = [ 'delivery_type' => $delivery_type, 'delivery_type_text' => $lists[$delivery_type], ]; } } return $result; } }