OfficialAccountReplyLists.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\lists\channel;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\lists\ListsSearchInterface;
  17. use app\common\model\channel\OfficialAccountReply;
  18. /**
  19. * 微信公众号回复列表
  20. * Class OfficialAccountLists
  21. * @package app\adminapi\lists
  22. */
  23. class OfficialAccountReplyLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索
  27. * @return \string[][]
  28. * @author 段誉
  29. * @date 2022/3/30 15:02
  30. */
  31. public function setSearch(): array
  32. {
  33. return [
  34. '=' => ['reply_type']
  35. ];
  36. }
  37. /**
  38. * @notes 回复列表
  39. * @return array
  40. * @throws \think\db\exception\DataNotFoundException
  41. * @throws \think\db\exception\DbException
  42. * @throws \think\db\exception\ModelNotFoundException
  43. * @author 段誉
  44. * @date 2022/3/30 15:02
  45. */
  46. public function lists(): array
  47. {
  48. $field = 'id,name,keyword,matching_type,content,content_type,status,sort';
  49. $field .= ',matching_type as matching_type_desc,content_type as content_type_desc,status as status_desc';
  50. $lists = OfficialAccountReply::field($field)
  51. ->where($this->searchWhere)
  52. ->order(['sort' => 'desc', 'id' => 'desc'])
  53. ->limit($this->limitOffset, $this->limitLength)
  54. ->select()
  55. ->toArray();
  56. return $lists;
  57. }
  58. /**
  59. * @notes 回复记录数
  60. * @return int
  61. * @author 段誉
  62. * @date 2022/3/30 15:02
  63. */
  64. public function count(): int
  65. {
  66. $count = OfficialAccountReply::where($this->searchWhere)->count();
  67. return $count;
  68. }
  69. }