WechatReply.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\wechat;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * 关键词
  16. * Class WechatReply
  17. * @package app\model\wechat
  18. */
  19. class WechatReply extends BaseModel
  20. {
  21. use ModelTrait;
  22. /**
  23. * 数据表主键
  24. * @var string
  25. */
  26. protected $pk = 'id';
  27. /**
  28. * 模型名称
  29. * @var string
  30. */
  31. protected $name = 'wechat_reply';
  32. /**
  33. * 消息类型
  34. * @var string[]
  35. */
  36. public static $replyType = ['text', 'image', 'news', 'voice'];
  37. /**
  38. * 公众号自动回复关联
  39. * @return \think\model\relation\HasMany
  40. * @author: 吴汐
  41. * @email: 442384644@qq.com
  42. * @date: 2023/8/3
  43. */
  44. public function wechatKeys()
  45. {
  46. return $this->hasMany(WechatKey::class, 'reply_id', 'id');
  47. }
  48. /**
  49. * 客服自动回复关联
  50. * @return \think\model\relation\HasOne
  51. * @author: 吴汐
  52. * @email: 442384644@qq.com
  53. * @date: 2023/8/3
  54. */
  55. public function kefuKey()
  56. {
  57. return $this->hasOne(WechatKey::class, 'reply_id', 'id')->bind(['keys']);
  58. }
  59. }