SystemRoute.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * +----------------------------------------------------------------------
  4. * | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  5. * +----------------------------------------------------------------------
  6. * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  7. * +----------------------------------------------------------------------
  8. * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  9. * +----------------------------------------------------------------------
  10. * | Author: CRMEB Team <admin@crmeb.com>
  11. * +----------------------------------------------------------------------
  12. */
  13. namespace app\model\system;
  14. use crmeb\basic\BaseModel;
  15. use think\model\concern\SoftDelete;
  16. /**
  17. * Class SystemRoute
  18. * @author 等风来
  19. * @email 136327134@qq.com
  20. * @date 2023/4/6
  21. * @package app\model\system
  22. */
  23. class SystemRoute extends BaseModel
  24. {
  25. use SoftDelete;
  26. /**
  27. * @var string
  28. */
  29. protected $name = 'system_route';
  30. /**
  31. * @var string
  32. */
  33. protected $key = 'id';
  34. public function searchNameLikeAttr($query, $value)
  35. {
  36. if ('' !== $value) {
  37. $query->where('name|path', 'LIKE', '%' . $value . '%');
  38. }
  39. }
  40. public function setQueryAttr($value)
  41. {
  42. return json_encode($value);
  43. }
  44. public function getQueryAttr($value)
  45. {
  46. return json_decode($value, true);
  47. }
  48. public function setHeaderAttr($value)
  49. {
  50. return json_encode($value);
  51. }
  52. public function getHeaderAttr($value)
  53. {
  54. return json_decode($value, true);
  55. }
  56. public function setRequestAttr($value)
  57. {
  58. return json_encode($value);
  59. }
  60. public function getRequestAttr($value)
  61. {
  62. return json_decode($value, true);
  63. }
  64. public function setResponseAttr($value)
  65. {
  66. return json_encode($value);
  67. }
  68. public function getResponseAttr($value)
  69. {
  70. return json_decode($value, true);
  71. }
  72. public function setRequestExampleAttr($value)
  73. {
  74. return json_encode($value);
  75. }
  76. public function getRequestExampleAttr($value)
  77. {
  78. return json_decode($value, true);
  79. }
  80. public function setErrorCodeAttr($value)
  81. {
  82. return json_encode($value);
  83. }
  84. public function getErrorCodeAttr($value)
  85. {
  86. return json_decode($value, true);
  87. }
  88. public function setResponseExampleAttr($value)
  89. {
  90. return json_encode($value);
  91. }
  92. public function getResponseExampleAttr($value)
  93. {
  94. return json_decode($value, true);
  95. }
  96. }