AfterSaleLogEnum.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. use app\common\model\Admin;
  21. use app\common\model\User;
  22. /**
  23. * 售后日志枚举
  24. * Class AfterSaleLogEnum
  25. * @package app\common\enum
  26. */
  27. class AfterSaleLogEnum
  28. {
  29. /**
  30. * 整单退款场景
  31. */
  32. const BUYER_CANCEL_ORDER = 1;
  33. const SELLER_CANCEL_ORDER = 2;
  34. const ORDER_CLOSE = 3;
  35. /**
  36. * 操作人角色
  37. * ROLE_SYS 系统
  38. * ROLE_BUYER 买家
  39. * ROLE_SELLER 卖家
  40. */
  41. const ROLE_SYS = 1;
  42. const ROLE_BUYER = 2;
  43. const ROLE_SELLER = 3;
  44. /**
  45. * @notes 获取场景描述
  46. * @param $value
  47. * @return string
  48. * @author Tab
  49. * @date 2021/8/2 10:17
  50. */
  51. public static function getSenceDesc($value)
  52. {
  53. $desc = [
  54. self::BUYER_CANCEL_ORDER => '买家取消订单',
  55. self::SELLER_CANCEL_ORDER => '卖家取消订单',
  56. self::ORDER_CLOSE => '支付回调时订单已关闭',
  57. ];
  58. return $desc[$value] ?? '';
  59. }
  60. /**
  61. * @notes 获取操作者名称
  62. * @param $operatorID
  63. * @param $operatorRole
  64. * @return mixed|string
  65. * @author Tab
  66. * @date 2021/8/9 20:16
  67. */
  68. public static function getOpertorName($operatorID, $operatorRole)
  69. {
  70. switch ($operatorRole) {
  71. case self::ROLE_SYS:
  72. return '系统';
  73. case self::ROLE_BUYER:
  74. return User::where('id', $operatorID)->value('nickname');
  75. case self::ROLE_SELLER:
  76. return Admin::where('id', $operatorID)->value('name');
  77. }
  78. return '';
  79. }
  80. }