GoodsEnum.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop100%开源免费商用商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | 商业版本务必购买商业授权,以免引起法律纠纷
  8. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  9. // | gitee下载:https://gitee.com/likeshop_gitee
  10. // | github下载:https://github.com/likeshop-github
  11. // | 访问官网:https://www.likeshop.cn
  12. // | 访问社区:https://home.likeshop.cn
  13. // | 访问手册:http://doc.likeshop.cn
  14. // | 微信公众号:likeshop技术社区
  15. // | likeshop团队 版权所有 拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshopTeam
  18. // +----------------------------------------------------------------------
  19. namespace app\common\enum;
  20. /**
  21. * 商品枚举
  22. * Class GoodsEnum
  23. * @package app\common\enum
  24. */
  25. class GoodsEnum
  26. {
  27. const GOODS_REALITY = 1; //实物商品
  28. const GOODS_VIRTUAL = 2; //虚拟商品
  29. const STATUS_SELL = 1;
  30. const STATUS_STORAGE = 0;
  31. const SEPC_TYPE_SIGNLE = 1;
  32. const SEPC_TYPE_MORE = 2;
  33. const SPEC_SEPARATOR = ','; //规格名称分隔符
  34. const AFTER_PAY_AUTO = 1; //自动发货
  35. const AFTER_PAY_HANDOPERSTION = 2; //手动发货
  36. const AFTER_DELIVERY_AUTO = 1; //自动完成订单
  37. const AFTER_DELIVERY_HANDOPERSTION = 2; //需要买家确认
  38. const GATHER_CHANNEL_UNKNOWN = 0;//未知
  39. const GATHER_CHANNEL_TAOBAO = 1;//淘宝
  40. const GATHER_CHANNEL_TMALL = 2;//天猫
  41. const GATHER_CHANNEL_JD = 3;//京东
  42. const GATHER_CHANNEL_1688 = 4;//阿里巴巴
  43. const LIMIT_TYPE_NO = 1;//不限制
  44. const LIMIT_TYPE_USER = 2;//每人限购
  45. const LIMIT_TYPE_ORDER = 3;//每笔订单限购
  46. /**
  47. * @notes 商品规格类型
  48. * @param bool $from
  49. * @return array|mixed|string
  50. * @author cjhao
  51. * @date 2021/8/23 10:30
  52. */
  53. public static function getSpecTypeDesc($from = true)
  54. {
  55. $desc = [
  56. self::SEPC_TYPE_SIGNLE => '单规格',
  57. self::SEPC_TYPE_MORE => '多规格',
  58. ];
  59. if(true === $from){
  60. return $desc;
  61. }
  62. return $desc[$from] ?? '';
  63. }
  64. /**
  65. * @notes 商品状态
  66. * @param bool $from
  67. * @return array|mixed|string
  68. * @author cjhao
  69. * @date 2021/9/10 15:09
  70. */
  71. public static function getStatusDesc($from = true)
  72. {
  73. $desc = [
  74. self::STATUS_SELL => '销售中',
  75. self::STATUS_STORAGE => '仓库中',
  76. ];
  77. if(true === $from){
  78. return $desc;
  79. }
  80. return $desc[$from] ?? '';
  81. }
  82. /**
  83. * @notes 获取商品类型
  84. * @param bool $from
  85. * @return array|mixed|string
  86. * @author cjhao
  87. * @date 2022/4/19 12:09
  88. */
  89. public static function getGoodsTypeDesc($from = true){
  90. $desc = [
  91. self::GOODS_REALITY => '实物商品',
  92. self::GOODS_VIRTUAL => '虚拟商品',
  93. ];
  94. if(true === $from){
  95. return $desc;
  96. }
  97. return $desc[$from] ?? '';
  98. }
  99. /**
  100. * @notes 采集渠道
  101. * @param bool $from
  102. * @return string|string[]
  103. * @author ljj
  104. * @date 2023/3/14 11:03 上午
  105. */
  106. public static function getGatherChannelDesc($from = true)
  107. {
  108. $desc = [
  109. self::GATHER_CHANNEL_UNKNOWN => '未知',
  110. self::GATHER_CHANNEL_TAOBAO => '淘宝',
  111. self::GATHER_CHANNEL_TMALL => '天猫',
  112. self::GATHER_CHANNEL_JD => '京东',
  113. self::GATHER_CHANNEL_1688 => '阿里巴巴',
  114. ];
  115. if(true === $from){
  116. return $desc;
  117. }
  118. return $desc[$from] ?? '';
  119. }
  120. }