You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WorkGroupChatAuth.php 2.2KB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace app\model\work;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. use think\model\concern\SoftDelete;
  6. /**
  7. * 企业微信自动拉群
  8. * Class WorkGroupChatAuth
  9. * @package app\model\work
  10. */
  11. class WorkGroupChatAuth extends BaseModel
  12. {
  13. use ModelTrait, SoftDelete;
  14. /**
  15. * @var string
  16. */
  17. protected $name = 'work_group_chat_auth';
  18. /**
  19. * @var string
  20. */
  21. protected $key = 'id';
  22. /**
  23. * @var string
  24. */
  25. protected $autoWriteTimestamp = 'int';
  26. /**
  27. * @param $value
  28. * @return false|string
  29. */
  30. public function setWelcomeWordsAttr($value)
  31. {
  32. return json_encode($value);
  33. }
  34. /**
  35. * @param $value
  36. * @return mixed
  37. */
  38. public function getWelcomeWordsAttr($value)
  39. {
  40. return json_decode($value, true);
  41. }
  42. /**
  43. * @param $value
  44. * @return false|string
  45. */
  46. public function setAdminUserAttr($value)
  47. {
  48. return json_encode($value);
  49. }
  50. /**
  51. * @param $value
  52. * @return mixed
  53. */
  54. public function getAdminUserAttr($value)
  55. {
  56. return json_decode($value, true);
  57. }
  58. /**
  59. * @param $value
  60. * @return false|string
  61. */
  62. public function setChatIdAttr($value)
  63. {
  64. return json_encode($value);
  65. }
  66. /**
  67. * @param $value
  68. * @return mixed
  69. */
  70. public function getChatIdAttr($value)
  71. {
  72. return json_decode($value, true);
  73. }
  74. /**
  75. * @param $value
  76. * @return false|string
  77. */
  78. public function setLabelAttr($value)
  79. {
  80. return json_encode($value);
  81. }
  82. /**
  83. * @param $value
  84. * @return mixed
  85. */
  86. public function getLabelAttr($value)
  87. {
  88. return json_decode($value, true);
  89. }
  90. /**
  91. * @param $query
  92. * @param $value
  93. */
  94. public function searchNameAttr($query, $value)
  95. {
  96. if ('' !== $value) {
  97. $query->whereLike('name', '%' . $value . '%');
  98. }
  99. }
  100. /**
  101. * @param $query
  102. * @param $value
  103. */
  104. public function searchCreateTimeAttr($query, $value)
  105. {
  106. if ('' !== $value) {
  107. $this->searchTimeAttr($query, $value, ['timeKey' => 'create_time']);
  108. }
  109. }
  110. }