GroupUserOrderLists.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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\group_activity;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\lists\ListsSearchInterface;
  17. use app\common\model\group_activity\GroupUserOrder;
  18. /**
  19. * 拼团订单列表
  20. * Class GroupUserOrderLists
  21. * @package app\adminapi\listsgroup_activity
  22. */
  23. class GroupUserOrderLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索条件
  27. * @return \string[][]
  28. * @author likeadmin
  29. * @date 2025/03/13 10:31
  30. */
  31. public function setSearch(): array
  32. {
  33. return [
  34. '=' => ['a.sn','a.status','a.pay_status','a.pay_way','a.refund_status','a.group_activity_id','a.user_equity_id','a.group_order_id','c.group_order_status','d.mobile'],
  35. ];
  36. }
  37. public function queryWhere(){
  38. $where = [];
  39. if(!empty($this->params['area'])){
  40. $where[] = ['a.area', 'like', '%'.$this->params['area'].'%'];
  41. }
  42. if(!empty($this->params['title'])){
  43. $where[] = ['b.title', 'like', '%'.$this->params['title'].'%'];
  44. }
  45. return $where;
  46. }
  47. /**
  48. * @notes 获取拼团订单列表
  49. * @return array
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\DbException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. * @author likeadmin
  54. * @date 2025/03/13 10:31
  55. */
  56. public function lists(): array
  57. {
  58. $list = GroupUserOrder::alias('a')
  59. ->leftJoin('group_activity b', 'b.id = a.group_activity_id')
  60. ->leftJoin('group_order c', 'c.id = a.group_order_id')
  61. ->leftJoin('user d', 'd.id = a.user_id')
  62. ->where($this->searchWhere)
  63. ->where($this->queryWhere())
  64. ->field(['a.*', 'b.title','b.image','c.status as group_order_status','d.mobile'])
  65. ->limit($this->limitOffset, $this->limitLength)
  66. ->order(['a.id' => 'desc'])
  67. ->select()
  68. ->toArray();
  69. return $list;
  70. }
  71. /**
  72. * @notes 获取拼团活动数量
  73. * @return int
  74. * @author likeadmin
  75. * @date 2025/03/13 10:31
  76. */
  77. public function count(): int
  78. {
  79. return GroupUserOrder::alias('a')
  80. ->leftJoin('group_activity b', 'b.id = a.group_activity_id')
  81. ->leftJoin('group_order c', 'c.id = a.group_order_id')
  82. ->leftJoin('user d', 'd.id = a.user_id')
  83. ->where($this->searchWhere)
  84. ->where($this->queryWhere())
  85. ->count();
  86. }
  87. }