1
0

PropertyHeadLists.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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\property;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\property\PropertyHead;
  17. use app\common\lists\ListsSearchInterface;
  18. use app\common\model\sale\Sale;
  19. /**
  20. * PropertyHead列表
  21. * Class PropertyHeadLists
  22. * @package app\adminapi\lists
  23. */
  24. class PropertyHeadLists extends BaseAdminDataLists implements ListsSearchInterface
  25. {
  26. /**
  27. * @notes 设置搜索条件
  28. * @return \string[][]
  29. * @author likeadmin
  30. * @date 2024/09/19 10:48
  31. */
  32. public function setSearch(): array
  33. {
  34. return [
  35. '=' => ['is_cooperate','sale_type','sale_id','property_name', 'village_name', 'address', 'head_name', 'head_mobile', 'ratio', 'head_bank_card', 'remark', 'user_id', 'all_profit_amount', 'surplus_profit_amount', 'extract_profit_amount'],
  36. ];
  37. }
  38. /**
  39. * 获取数据权限
  40. * $this->adminInfo['data_rules']
  41. * province city admin_id sale_group_id sale_id property_head_id
  42. */
  43. public function queryDataWhere(){
  44. $where = [];
  45. $data_rules = $this->adminInfo['data_rules'];
  46. if (isset($data_rules['province']) && !empty($data_rules['province'])) {
  47. $where[] = ['province','in' ,$data_rules['province']];
  48. }
  49. if (isset($data_rules['city']) && !empty($data_rules['city'])) {
  50. $where[] = ['city','in' ,$data_rules['city']];
  51. }
  52. if (isset($data_rules['sale_group_id']) && !empty($data_rules['sale_group_id'])) {
  53. $sale_ids = Sale::where('sale_group_id','in',$data_rules['sale_group_id'])->column('id')??[];
  54. $where[] = ['sale_id','in' ,$sale_ids];
  55. }
  56. if (isset($data_rules['sale_id']) && !empty($data_rules['sale_id'])) {
  57. $where[] = ['sale_id','in' ,$data_rules['sale_id']];
  58. }
  59. if (isset($data_rules['property_head_id']) && !empty($data_rules['property_head_id'])) {
  60. $where[] = ['id','in' ,$data_rules['property_head_id']];
  61. }
  62. return $where;
  63. }
  64. /**
  65. * @notes 获取列表
  66. * @return array
  67. * @throws \think\db\exception\DataNotFoundException
  68. * @throws \think\db\exception\DbException
  69. * @throws \think\db\exception\ModelNotFoundException
  70. * @author likeadmin
  71. * @date 2024/09/19 10:48
  72. */
  73. public function lists(): array
  74. {
  75. return PropertyHead::where($this->searchWhere)->where($this->queryDataWhere())
  76. ->field(['*'])
  77. ->limit($this->limitOffset, $this->limitLength)
  78. ->order(['id' => 'desc'])
  79. ->select()
  80. ->toArray();
  81. }
  82. /**
  83. * @notes 获取数量
  84. * @return int
  85. * @author likeadmin
  86. * @date 2024/09/19 10:48
  87. */
  88. public function count(): int
  89. {
  90. return PropertyHead::where($this->searchWhere)->where($this->queryDataWhere())->count();
  91. }
  92. public function setExcelComplexFields(): array
  93. {
  94. $zh_cn_fields = [
  95. '是否合作','代理名称','小区名称','小区地址','负责人名称', '负责人手机号',
  96. '提成比例','对公账户名称','对公银行','对公银行卡号','备注','注册用户ID',
  97. '总收益金额(累计)','剩余收益金额','已提收益金额(累计)','经度','纬度','绑定天数'
  98. ];
  99. $data_fields = [function($row){
  100. switch ($row['is_cooperate']){
  101. case 1:
  102. return '合作中';
  103. case 2:
  104. return '已结束';
  105. case 3:
  106. return '待审核';
  107. case 4:
  108. return '不通过';
  109. default:
  110. return '';
  111. }
  112. },'property_name','village_name','address','head_name','head_mobile',
  113. 'ratio','corporate_bank_name','head_corporate_bank','head_bank_card','remark','user_id',
  114. 'all_profit_amount','surplus_profit_amount','extract_profit_amount','lon','lat','bind_date'];
  115. return [
  116. 'zh_cn_fields' => $zh_cn_fields,
  117. 'data_fields' => $data_fields
  118. ];
  119. }
  120. }