MasterWorkerCommissionConfigLists.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_commission;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\master_commission\MasterWorkerCommissionConfig;
  17. use app\common\lists\ListsSearchInterface;
  18. use app\common\model\master_worker\MasterWorker;
  19. /**
  20. * MasterWorkerCommissionConfig列表
  21. * Class MasterWorkerCommissionConfigLists
  22. * @package app\adminapi\lists
  23. */
  24. class MasterWorkerCommissionConfigLists extends BaseAdminDataLists implements ListsSearchInterface
  25. {
  26. /**
  27. * @notes 设置搜索条件
  28. * @return \string[][]
  29. * @author likeadmin
  30. * @date 2024/12/06 10:42
  31. */
  32. public function setSearch(): array
  33. {
  34. return [
  35. '=' => ['master_worker_id', 'submit_admin_id', 'examine_admin_id', 'voucher_status', 'notice_rule'],
  36. ];
  37. }
  38. public function queryWhere(){
  39. $where = [];
  40. if (isset($this->params['mobile_account']) && !empty($this->params['mobile_account'])) {
  41. $mw_ids = MasterWorker::where('mobile|account','like', '%' . $this->params['mobile_account'] . '%')->column('id');
  42. $where[] = [ 'master_worker_id','in',$mw_ids?:[0]];
  43. }
  44. return $where;
  45. }
  46. /**
  47. * @notes 获取列表
  48. * @return array
  49. * @throws \think\db\exception\DataNotFoundException
  50. * @throws \think\db\exception\DbException
  51. * @throws \think\db\exception\ModelNotFoundException
  52. * @author likeadmin
  53. * @date 2024/12/06 10:42
  54. */
  55. public function lists(): array
  56. {
  57. return MasterWorkerCommissionConfig::with(['masterWorker','examineAdmin'])->where($this->searchWhere)->where($this->queryWhere())
  58. ->field(['id', 'master_worker_id', 'submit_admin_id', 'examine_admin_id', 'voucher_status', 'notice_rule','block_data'])
  59. ->limit($this->limitOffset, $this->limitLength)
  60. ->order(['id' => 'desc'])
  61. ->select()
  62. ->toArray();
  63. }
  64. /**
  65. * @notes 获取数量
  66. * @return int
  67. * @author likeadmin
  68. * @date 2024/12/06 10:42
  69. */
  70. public function count(): int
  71. {
  72. return MasterWorkerCommissionConfig::where($this->searchWhere)->count();
  73. }
  74. }