31 lines
722 B
PHP
31 lines
722 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace app\common\service\pharmacy;
|
|
|
|
final class PharmacySupplyMode
|
|
{
|
|
/** @param array<string,mixed> $order */
|
|
public static function resolve(array $order): string
|
|
{
|
|
if (strtolower(trim((string) ($order['ship_mode'] ?? ''))) === 'direct') {
|
|
return 'direct';
|
|
}
|
|
if (trim((string) ($order['gancao_reciperl_order_no'] ?? '')) !== '') {
|
|
return 'gancao';
|
|
}
|
|
|
|
return 'self';
|
|
}
|
|
|
|
public static function label(string $mode): string
|
|
{
|
|
return match (strtolower(trim($mode))) {
|
|
'direct' => '洛阳直发',
|
|
'gancao' => '甘草',
|
|
default => '自营',
|
|
};
|
|
}
|
|
}
|