EquityOrderLists.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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\equity;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\equity\EquityOrder;
  17. use app\common\lists\ListsSearchInterface;
  18. use app\common\model\user\User;
  19. /**
  20. * EquityOrder列表
  21. * Class EquityOrderLists
  22. * @package app\adminapi\lists
  23. */
  24. class EquityOrderLists extends BaseAdminDataLists implements ListsSearchInterface
  25. {
  26. /**
  27. * @notes 设置搜索条件
  28. * @return \string[][]
  29. * @author likeadmin
  30. * @date 2024/12/25 13:32
  31. */
  32. public function setSearch(): array
  33. {
  34. if(isset($this->params['mobile']) && !empty($this->params['mobile'])){
  35. $userId = User::where('mobile',$this->params['mobile'])->value('id')??-1;
  36. $this->params['user_id'] = $userId;
  37. }
  38. return [
  39. '=' => ['user_id', 'description', 'price', 'create_order_time', 'service_work_id', 'equity_id', 'status', 'property_head_id', 'remark'],
  40. ];
  41. }
  42. /**
  43. * @notes 获取列表
  44. * @return array
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\DbException
  47. * @throws \think\db\exception\ModelNotFoundException
  48. * @author likeadmin
  49. * @date 2024/12/25 13:32
  50. */
  51. public function lists(): array
  52. {
  53. return EquityOrder::with(['equityConfig','user','propertyHead','serviceWork'])->where($this->searchWhere)
  54. ->field(['id', 'user_id', 'description', 'price', 'create_order_time', 'service_work_id', 'equity_id', 'status', 'property_head_id', 'remark'])
  55. ->limit($this->limitOffset, $this->limitLength)
  56. ->order(['id' => 'desc'])
  57. ->select()
  58. ->toArray();
  59. }
  60. /**
  61. * @notes 获取数量
  62. * @return int
  63. * @author likeadmin
  64. * @date 2024/12/25 13:32
  65. */
  66. public function count(): int
  67. {
  68. return EquityOrder::where($this->searchWhere)->count();
  69. }
  70. }