Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

WorkClientFollow.php 1.2KB

vor 2 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace app\model\work;
  3. use crmeb\basic\BaseModel;
  4. use crmeb\traits\ModelTrait;
  5. use think\model\relation\HasMany;
  6. use think\model\relation\HasOne;
  7. /**
  8. * 企业微信客户跟踪
  9. * Class WorkClientFollow
  10. * @package app\model\work
  11. */
  12. class WorkClientFollow extends BaseModel
  13. {
  14. use ModelTrait;
  15. /**
  16. * @var string
  17. */
  18. protected $name = 'work_client_follow';
  19. /**
  20. * @var string
  21. */
  22. protected $key = 'id';
  23. /**
  24. * @var string
  25. */
  26. protected $autoWriteTimestamp = 'int';
  27. /**
  28. * @return HasOne
  29. */
  30. public function client()
  31. {
  32. return $this->hasOne(WorkClient::class, 'id', 'client_id');
  33. }
  34. /**
  35. * @return HasMany
  36. */
  37. public function tags()
  38. {
  39. return $this->hasMany(WorkClientFollowTags::class, 'follow_id', 'id');
  40. }
  41. /**
  42. * @return HasOne
  43. */
  44. public function member()
  45. {
  46. return $this->hasOne(WorkMember::class, 'userid', 'userid');
  47. }
  48. /**
  49. * @param $query
  50. * @param $value
  51. */
  52. public function searchClientIdAttr($query, $value)
  53. {
  54. if (is_array($value)) {
  55. $query->whereIn('client_id', $value);
  56. } else {
  57. $query->where('client_id', $value);
  58. }
  59. }
  60. }