BankAccountLists.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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\master_worker;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\master_worker\BankAccount;
  17. use app\common\lists\ListsSearchInterface;
  18. /**
  19. * BankAccount列表
  20. * Class BankAccountLists
  21. * @package app\adminapi\listsmaster_worker
  22. */
  23. class BankAccountLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索条件
  27. * @return \string[][]
  28. * @author likeadmin
  29. * @date 2024/10/08 09:41
  30. */
  31. public function setSearch(): array
  32. {
  33. return [
  34. '=' => ['account_holder', 'bank_name', 'province', 'city', 'opening_branch', 'account', 'mobile', 'worker_id', 'audit_state'],
  35. ];
  36. }
  37. public function queryWhere(){
  38. $where = [];
  39. if(isset($this->params['range_update_time']) && !empty($this->params['range_update_time'])){
  40. $time = [strtotime($this->params['range_update_time'][0]), strtotime($this->params['range_update_time'][1])];
  41. $where[] = ['update_time', 'between', $time];
  42. }
  43. return $where;
  44. }
  45. /**
  46. * @notes 获取列表
  47. * @return array
  48. * @throws \think\db\exception\DataNotFoundException
  49. * @throws \think\db\exception\DbException
  50. * @throws \think\db\exception\ModelNotFoundException
  51. * @author likeadmin
  52. * @date 2024/10/08 09:41
  53. */
  54. public function lists(): array
  55. {
  56. return BankAccount::where($this->searchWhere)->where($this->queryWhere())
  57. ->field(['id', 'account_holder', 'bank_name', 'province', 'city', 'opening_branch', 'account', 'bank_image', 'mobile', 'worker_id', 'audit_state','create_time','update_time'])
  58. ->limit($this->limitOffset, $this->limitLength)
  59. ->order(['id' => 'desc'])
  60. ->select()
  61. ->toArray();
  62. }
  63. /**
  64. * @notes 获取数量
  65. * @return int
  66. * @author likeadmin
  67. * @date 2024/10/08 09:41
  68. */
  69. public function count(): int
  70. {
  71. return BankAccount::where($this->searchWhere)->where($this->queryWhere())->count();
  72. }
  73. }