TenantRatingCommissionLists.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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\tenant;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\tenant\TenantRatingCommission;
  17. use app\common\lists\ListsSearchInterface;
  18. /**
  19. * TenantRatingCommission列表
  20. * Class TenantRatingCommissionLists
  21. * @package app\adminapi\lists
  22. */
  23. class TenantRatingCommissionLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索条件
  27. * @return \string[][]
  28. * @author likeadmin
  29. * @date 2025/02/26 18:03
  30. */
  31. public function setSearch(): array
  32. {
  33. return [
  34. '=' => ['rating_start', 'rating_end', 'commission', 'tenant_id'],
  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 likeadmin
  44. * @date 2025/02/26 18:03
  45. */
  46. public function lists(): array
  47. {
  48. //'id', 'rating_start', 'rating_end', 'commission',
  49. return TenantRatingCommission::with(['allCommission'])->where($this->searchWhere)
  50. ->field(['tenant_id'])
  51. ->group('tenant_id')
  52. ->order(['create_time' => 'desc'])
  53. ->limit($this->limitOffset, $this->limitLength)
  54. ->select()
  55. ->toArray();
  56. }
  57. /**
  58. * @notes 获取数量
  59. * @return int
  60. * @author likeadmin
  61. * @date 2025/02/26 18:03
  62. */
  63. public function count(): int
  64. {
  65. return TenantRatingCommission::field(['tenant_id'])->where($this->searchWhere)->group('tenant_id')->count('tenant_id');
  66. }
  67. }