Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
e8c17c28
Commit
e8c17c28
authored
Aug 20, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excel导出
parent
7298f2e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
7 deletions
+64
-7
Broker.php
application/index/controller/Broker.php
+51
-7
AAgentsBank.php
application/model/AAgentsBank.php
+13
-0
No files found.
application/index/controller/Broker.php
View file @
e8c17c28
...
...
@@ -16,7 +16,9 @@ use app\index\service\BrokerService;
use
app\api_broker\service\CallPhoneService
;
use
app\api_broker\service\PushMessageService
;
use
app\index\extend\Basic
;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\AAgentsBank
;
use
app\model\AAgentsBlackList
;
use
app\model\AAgentsBlackListImg
;
use
app\model\ABindingDevice
;
...
...
@@ -397,7 +399,7 @@ class Broker extends Basic
}
$field
=
"a.id,a.store_id,a.img,a.district_id,a.`level`,a.`name`,a.phone,a.`status`,a.inviter_id,a.create_time,
ifnull(s.store_name,'')store_name,ifnull(d.district_name,'')district_name,ifnull(g.title,'无')groupname"
;
ifnull(s.store_name,'')store_name,ifnull(d.district_name,'')district_name,ifnull(g.title,'无')groupname
,a.site_id
"
;
$order
=
'a.id DESC'
;
$join
=
[
[
'a_store s'
,
' a.store_id=s.id'
,
'left'
],
...
...
@@ -405,13 +407,55 @@ class Broker extends Basic
[
'auth_group g'
,
'a.auth_group_id=g.id'
,
'left'
]
];
$data
[
'list'
]
=
$table
->
getListJoin
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
foreach
(
$data
[
'list'
]
as
$k
=>
$v
)
{
$data
[
'list'
][
$k
][
'agent_img'
]
=
$v
[
'img'
]
?
AGENTHEADERIMGURL
.
$v
[
'img'
]
:
AGENTHEADERIMGURL
.
'icon_head.png'
;
if
(
empty
(
$this
->
params
[
'excel'
]))
{
$data
[
'list'
]
=
$table
->
getListJoin
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
foreach
(
$data
[
'list'
]
as
$k
=>
$v
)
{
$data
[
'list'
][
$k
][
'agent_img'
]
=
$v
[
'img'
]
?
AGENTHEADERIMGURL
.
$v
[
'img'
]
:
AGENTHEADERIMGURL
.
'icon_head.png'
;
}
$data
[
'total'
]
=
$table
->
getTotal2
(
$join
,
$where
);
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
$s_redis
=
new
RedisCacheService
();
$list
=
$table
->
getListJoin
(
1
,
40000
,
$order
,
$field
,
$join
,
$where
);
$excel_data
=
[];
$level_array
=
[
10
=>
'业务员'
,
20
=>
'店长'
,
30
=>
'总监'
,
40
=>
'总监和店长'
];
foreach
(
$list
as
$v
)
{
$key_array
[]
=
$key
=
$v
[
'id'
];
$excel_data
[
$key
][
'create_time'
]
=
$v
[
'create_time'
];
$excel_data
[
$key
][
'id'
]
=
$v
[
'id'
];
$excel_data
[
$key
][
'level_name'
]
=
$level_array
[
$v
[
'level'
]];
$excel_data
[
$key
][
'city'
]
=
$s_redis
->
getRedisCache
(
4
,
$v
[
'site_id'
]);
$excel_data
[
$key
][
'district_name'
]
=
$v
[
'district_name'
];
$excel_data
[
$key
][
'store_name'
]
=
$v
[
'store_name'
];
$excel_data
[
$key
][
'name'
]
=
$v
[
'name'
];
$excel_data
[
$key
][
'phone'
]
=
$v
[
'phone'
];
}
unset
(
$list
);
if
(
isset
(
$key_array
))
{
$total
=
count
(
$key_array
);
$max
=
400
;
$m_bank
=
new
AAgentsBank
();
$bank_field
=
'agent_id,account,bank,card_no,id_card'
;
for
(
$i
=
0
;
$i
<
$total
;
$i
++
)
{
$id_string
[]
=
$key_array
[
$i
];
if
(
$i
==
$max
)
{
$max
+=
400
;
$bank_data
=
$m_bank
->
getDataAll
(
$bank_field
,
[
'agent_id'
=>
[
'in'
,
$id_string
],
'is_del'
=>
0
]);
foreach
(
$bank_data
as
$v2
)
{
$key
=
$v2
[
'agent_id'
];
$excel_data
[
$key
][
'id_card'
]
=
$v2
[
'id_card'
];
$excel_data
[
$key
][
'account'
]
=
$v2
[
'account'
];
$excel_data
[
$key
][
'card_no'
]
=
$v2
[
'card_no'
];
$excel_data
[
$key
][
'bank'
]
=
$v2
[
'bank'
];
}
unset
(
$id_string
);
unset
(
$bank_data
);
}
}
}
$data
[
'total'
]
=
$table
->
getTotal2
(
$join
,
$where
);
return
$this
->
response
(
200
,
'成功'
,
$data
);
$export
=
new
ExportExcelUntil
();
$title
=
[
'注册时间'
,
'经纪人ID'
,
'账号类型'
,
'账号城市'
,
'所在部门'
,
'所在门店'
,
'姓名'
,
'手机号'
,
'身份证号码'
,
'户名'
,
'卡号'
,
'开户行'
];
$export
->
exportTable
(
'经纪人信息'
,
$excel_data
,
11
,
'经纪人信息'
,
$title
);
}
/**
...
...
application/model/AAgentsBank.php
View file @
e8c17c28
...
...
@@ -122,4 +122,16 @@ class AAgentsBank extends BaseModel
->
where
(
$where
)
->
find
();
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
*/
public
function
getDataAll
(
$field
,
$where
)
{
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment