123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\common\enum;
-
-
- class GoodsEnum
- {
-
- const TYPE_ACTUAL = 0;
- const TYPE_VIRTUAL = 1;
-
-
-
- const EXPRESS_TYPE_FREE = 1;
- const EXPRESS_TYPE_UNIFIED = 2;
- const EXPRESS_TYPE_TEMPLATE = 3;
-
-
-
-
- const STATUS_SOLD_OUT = 0;
- const STATUS_SHELVES = 1;
-
-
-
- const DEL_NORMAL = 0;
- const DEL_TRUE = 1;
- const DEL_RECYCLE = 2;
-
-
-
-
- const AUDIT_STATUS_STAY = 0;
- const AUDIT_STATUS_OK = 1;
- const AUDIT_STATUS_REFUSE = 2;
-
-
-
- const SALES = 1;
- const WAREHOUSE = 2;
- const WARNING = 3;
- const RECYCLE_BIN = 4;
- const WAIT_AUDIT = 5;
- const UNPASS_AUDIT = 6;
-
-
-
- const DELIVERY_EXPRESS = 1;
- const DELIVERY_VIRTUAL = 2;
- const DELIVERY_SELF = 3;
-
-
-
- const AFTER_PAY_AUTO_DELIVERY = 1;
- const AFTER_PAY_SELF_DELIVERY = 2;
-
-
- const AFTER_DELIVERY_AUTO_COMFIRM = 1;
- const AFTER_DELIVERY_SELF_COMFIRM = 2;
-
-
-
-
- public static function getTypeDesc($type = true)
- {
- $desc = [
- self::TYPE_ACTUAL => '实物商品',
- self::TYPE_VIRTUAL => '虚拟商品',
- ];
- if ($type === true) {
- return $desc;
- }
- return $desc[$type] ?? '';
- }
-
-
-
-
- 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;
- }
- }
|