AccountConst.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. /**
  3. * AccountConst.php UTF-8
  4. *
  5. *
  6. * @date : 2018/6/13 17:12
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\constant;
  13. class AccountConst {
  14. const STATUS_AUDITING = 1;//审核中
  15. const STATUS_PULL_ON_SHELVES = 2;//已上架
  16. const STATUS_PULL_OFF_SHELVES = 3;//已下架
  17. const STATUS_SOLD_OUT = 4;//已出售
  18. const STATUS_AUDIT_NOT_PASSED = 5;//审核不通过
  19. const STATUS_LOCKED = 6;//锁定中
  20. const ACCOUNT_IS_MINE = 2;//是否自己
  21. const ACCOUNT_IS_BUY = 1;//1 购买
  22. const ACCOUNT_IS_SELL = 2;// 2 出卖
  23. const STATUS_KEEP_NOT = 1;//1 取消收藏
  24. const STATUS_KEEP = 2;//2收藏
  25. const ACCOUNT_STATUS_LOCKED = 1;//1锁定
  26. const ACCOUNT_STATUS_UNLOCKED = 2;//状态 2正常
  27. const ACCOUNT_MAX_LOCK_TIME = 600;//最长锁定时间10min
  28. /**
  29. * @param $status
  30. * @param bool $all
  31. *
  32. * @return array|bool|mixed
  33. */
  34. public static function getStatusMsg($status, $all = false) {
  35. $_msg = array(
  36. self::STATUS_AUDITING => '审核中',
  37. self::STATUS_PULL_ON_SHELVES => '已上架',
  38. self::STATUS_PULL_OFF_SHELVES => '已下架',
  39. self::STATUS_SOLD_OUT => '已出售',
  40. self::STATUS_AUDIT_NOT_PASSED => '审核不通过',
  41. self::STATUS_LOCKED => '锁定中',
  42. );
  43. if (true == $all) {
  44. return $_msg;
  45. }
  46. if (!isset($_msg[$status])) {
  47. return false;
  48. }
  49. return $_msg[$status];
  50. }
  51. /**
  52. * @param bool $inc
  53. *
  54. * @return array
  55. */
  56. public static function getStatuss($inc = false) {
  57. $_statuss = self::getStatusMsg(null, true);
  58. if (true == $inc) {
  59. $_default = ["0" => "选择状态"];
  60. $_statuss = $_default + $_statuss;
  61. }
  62. return $_statuss;
  63. }
  64. /**
  65. * @param $status
  66. * @param bool $all
  67. *
  68. * @return array|bool|mixed
  69. */
  70. public static function getAmlStatusMsg($status, $all = false) {
  71. $_msg = array(
  72. self::STATUS_KEEP_NOT => '收藏',
  73. self::STATUS_KEEP => '取消收藏',
  74. );
  75. if (true == $all) {
  76. return $_msg;
  77. }
  78. if (!isset($_msg[$status])) {
  79. return false;
  80. }
  81. return $_msg[$status];
  82. }
  83. /**
  84. * @param bool $inc
  85. *
  86. * @return array
  87. */
  88. public static function getAmlStatuss($inc = false) {
  89. $_statuss = self::getAmlStatusMsg(null, true);
  90. if (true == $inc) {
  91. $_default = ["0" => "选择状态"];
  92. $_statuss = $_default + $_statuss;
  93. }
  94. return $_statuss;
  95. }
  96. /**
  97. * @param $status
  98. * @param bool $all
  99. *
  100. * @return array|bool|mixed
  101. */
  102. public static function getAccountStatusMsg($status, $all = false) {
  103. $_msg = array(
  104. self::ACCOUNT_STATUS_LOCKED => '锁定',
  105. self::ACCOUNT_STATUS_UNLOCKED => '正常',
  106. );
  107. if (true == $all) {
  108. return $_msg;
  109. }
  110. if (!isset($_msg[$status])) {
  111. return false;
  112. }
  113. return $_msg[$status];
  114. }
  115. /**
  116. * @param bool $inc
  117. *
  118. * @return array
  119. */
  120. public static function getAccountStatuss($inc = false) {
  121. $_statuss = self::getAccountStatusMsg(null, true);
  122. if (true == $inc) {
  123. $_default = ["0" => "选择状态"];
  124. $_statuss = $_default + $_statuss;
  125. }
  126. return $_statuss;
  127. }
  128. }