SystemNoticeConfig.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\system\notice;
  12. use app\common\model\BaseModel;
  13. use app\common\model\wechat\TemplateMessage;
  14. /**
  15. * Class SystemNoticeLog
  16. * @package app\common\model\system\notice
  17. * @author xaboy
  18. * @day 2020/11/6
  19. */
  20. class SystemNoticeConfig extends BaseModel
  21. {
  22. /**
  23. * @return string|null
  24. * @author xaboy
  25. * @day 2020/11/6
  26. */
  27. public static function tablePk(): ?string
  28. {
  29. return 'notice_config_id';
  30. }
  31. /**
  32. * @return string
  33. * @author xaboy
  34. * @day 2020/11/6
  35. */
  36. public static function tableName(): string
  37. {
  38. return 'system_notice_config';
  39. }
  40. public function wechatTemplate()
  41. {
  42. return $this->hasOne(TemplateMessage::class,'tempkey','wechat_tempkey');
  43. }
  44. public function routineTemplate()
  45. {
  46. return $this->hasOne(TemplateMessage::class,'tempkey','routine_tempkey');
  47. }
  48. public function searchKeywordAttr($query, $value)
  49. {
  50. $query->whereLike("notice_title|notice_key|notice_info","%{$value}%");
  51. }
  52. public function searchTypeAttr($query, $value)
  53. {
  54. $query->where("type",$value);
  55. }
  56. public function searchConstKeyAttr($query, $value)
  57. {
  58. $query->where("const_key",$value);
  59. }
  60. }