Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ruer_cms
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蔡闯
ruer_cms
Commits
236e48b7
Commit
236e48b7
authored
Feb 19, 2021
by
蔡闯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2021-2-19
parent
a170f952
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
267 additions
and
264 deletions
+267
-264
app/shequ/controller/Userbind.php
app/shequ/controller/Userbind.php
+267
-264
No files found.
app/shequ/controller/Userbind.php
View file @
236e48b7
<?php
<?php
namespace
app\shequ\controller
;
namespace
app\shequ\controller
;
use
app\common\controller\Common
;
use
app\common\controller\Common
;
use
think\facade\Db
;
use
think\facade\Db
;
use
think\facade\Request
;
use
think\facade\Request
;
class
Userbind
extends
Base
class
Userbind
extends
Base
{
{
protected
$middleware
=
[
'app\middleware\CommunityLoginCheck::class'
,
'app\middleware\CommunityAfter::class'
];
protected
$middleware
=
[
'app\middleware\CommunityLoginCheck::class'
,
'app\middleware\CommunityAfter::class'
];
//用户绑定|解绑房间
//用户绑定|解绑房间
public
function
unbind
()
{
public
function
unbind
()
{
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
//现获取这一条房间的绑定的状态
//现获取这一条房间的绑定的状态
$bindInfo
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
field
(
'phone,id_card,vacancy_id,type'
)
->
find
();
$bindInfo
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
field
(
'phone,id_card,vacancy_id,type'
)
->
find
();
$status
=
Request
::
param
(
'status'
,
3
);
$status
=
Request
::
param
(
'status'
,
3
);
$save
[
'status'
]
=
$status
;
$save
[
'status'
]
=
$status
;
if
(
$status
==
1
)
{
if
(
$status
==
1
)
{
$save
[
'pass_time'
]
=
time
();
$save
[
'pass_time'
]
=
time
();
if
(
$bindInfo
[
'type'
]
==
3
)
{
//这是更换业主或审核房主
if
(
$bindInfo
[
'type'
]
==
3
)
{
//这是更换业主或审核房主
//1.更换房间表的信息
//1.更换房间表的信息
$data
[
'name'
]
=
$bindInfo
[
'name'
];
$data
[
'name'
]
=
$bindInfo
[
'name'
];
$data
[
'id_card'
]
=
$bindInfo
[
'id_card'
];
$data
[
'id_card'
]
=
$bindInfo
[
'id_card'
];
$save
[
'type'
]
=
0
;
$save
[
'type'
]
=
0
;
Db
::
startTrans
();
Db
::
startTrans
();
try
{
try
{
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
]])
->
save
(
$data
);
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
]])
->
save
(
$data
);
//更改原先的业主的绑定字段
//更改原先的业主的绑定字段
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
],
'type'
=>
0
,
'status'
=>
1
])
->
save
([
'status'
=>
3
]);
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
],
'type'
=>
0
,
'status'
=>
1
])
->
save
([
'status'
=>
3
]);
//更改现在的用户为房主
//更改现在的用户为房主
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
Db
::
commit
();
Db
::
commit
();
return
$this
->
returnJson
();
return
$this
->
returnJson
();
}
catch
(
\Exception
$e
){
}
catch
(
\Exception
$e
){
Db
::
rollback
();
Db
::
rollback
();
return
$this
->
returnJson
([],
'绑定失败,请重试!'
,
400
);
return
$this
->
returnJson
([],
'绑定失败,请重试!'
,
400
);
}
}
}
}
}
}
if
(
$status
==
3
)
{
if
(
$status
==
3
)
{
$save
[
'unbind_time'
]
=
time
();
$save
[
'unbind_time'
]
=
time
();
//如果是解绑的话,需要考虑,当前如果是业主,需要查看是否又其他的用户绑定了
//如果是解绑的话,需要考虑,当前如果是业主,需要查看是否又其他的用户绑定了
if
(
$bindInfo
[
'type'
]
==
0
)
{
if
(
$bindInfo
[
'type'
]
==
0
)
{
$is_exit
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
]])
->
where
(
'status'
,
'<>'
,
3
)
->
where
(
'type'
,
'<>'
,
0
)
->
find
();
$is_exit
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$bindInfo
[
'vacancy_id'
]])
->
where
(
'status'
,
'<>'
,
3
)
->
where
(
'type'
,
'<>'
,
0
)
->
find
();
if
(
$is_exit
)
{
if
(
$is_exit
)
{
return
$this
->
returnJson
([],
'业主解绑失败,该房间下还有用户未解绑!'
);
return
$this
->
returnJson
([],
'业主解绑失败,该房间下还有用户未解绑!'
);
}
}
}
}
}
}
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
if
(
$change
)
{
if
(
$change
)
{
return
$this
->
returnJson
([],
'success'
,
200
);
return
$this
->
returnJson
([],
'success'
,
200
);
}
else
{
}
else
{
return
$this
->
returnJson
([],
'error'
,
200
);
return
$this
->
returnJson
([],
'error'
,
200
);
}
}
}
}
//业主列表| 租客列表 | 家属列表
//业主列表| 租客列表 | 家属列表
public
function
houseOwnerList
(){
public
function
houseOwnerList
(){
$vacancy
=
new
Vacancy
(
$this
->
app
);
$vacancy
=
new
Vacancy
(
$this
->
app
);
$page
=
Request
::
param
(
'page'
,
1
);
$page
=
Request
::
param
(
'page'
,
1
);
$where
[]
=
[
'hub.type'
,
'='
,
Request
::
param
(
'type'
,
0
)];
$type
=
Request
::
param
(
'type'
);
$where
[]
=
[
'hub.village_id'
,
'='
,
$this
->
village_id
];
if
(
isset
(
$type
))
{
if
(
Request
::
param
(
'phone'
))
{
$where
[]
=
[
'hub.type'
,
'='
,
$type
];
$where
[]
=
[
'hub.phone'
,
'='
,
Request
::
param
(
'phone'
)];
}
}
$where
[]
=
[
'hub.village_id'
,
'='
,
$this
->
village_id
];
if
(
Request
::
param
(
'status'
))
{
if
(
Request
::
param
(
'phone'
))
{
$where
[]
=
[
'hub.status'
,
'='
,
Request
::
param
(
'status'
)];
$where
[]
=
[
'hub.phone'
,
'='
,
Request
::
param
(
'phone'
)];
}
}
if
(
Request
::
param
(
'status'
))
{
$total
=
DB
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
->
where
(
$where
)
->
count
();
$where
[]
=
[
'hub.status'
,
'='
,
Request
::
param
(
'status'
)];
$data
=
DB
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
}
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = hub.vacancy_id'
)
->
where
(
$where
)
$total
=
DB
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
->
where
(
$where
)
->
count
();
->
order
([
'hub.pass_time'
=>
'desc'
,
'hub.status'
=>
'desc'
])
$data
=
DB
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
->
page
(
$page
,
config
(
'app.limit'
))
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = hub.vacancy_id'
)
->
field
(
'hub.house_user_bind_id,hub.name,hub.phone,hub.id_card,hub.pass_time,hub.unbind_time,hub.status,hub.type,hv.vacancy_code,hv.layout_id'
)
->
where
(
$where
)
->
select
()
->
toArray
();
->
order
([
'hub.pass_time'
=>
'desc'
,
'hub.status'
=>
'desc'
])
->
page
(
$page
,
config
(
'app.limit'
))
->
field
(
'hub.house_user_bind_id,hub.name,hub.phone,hub.id_card,hub.pass_time,hub.unbind_time,hub.status,hub.type,hv.vacancy_code,hv.layout_id'
)
foreach
(
$data
as
$k
=>
$v
)
{
->
select
()
->
toArray
();
$res
=
$vacancy
->
getVacancyAddress
(
$v
[
'vacancy_code'
],
$v
[
'layout_id'
]);
$data
[
$k
][
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
}
foreach
(
$data
as
$k
=>
$v
)
{
$res
[
'total'
]
=
$total
;
$res
=
$vacancy
->
getVacancyAddress
(
$v
[
'vacancy_code'
],
$v
[
'layout_id'
]);
$res
[
'data'
]
=
Common
::
changeField
(
$data
,[
'pass_time'
,
'unbind_time'
]);
$data
[
$k
][
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
return
$this
->
returnJson
(
$res
,
'success'
);
}
$res
[
'total'
]
=
$total
;
}
$res
[
'data'
]
=
Common
::
changeField
(
$data
,[
'pass_time'
,
'unbind_time'
]);
return
$this
->
returnJson
(
$res
,
'success'
);
//修改入住人员信息
}
public
function
changeHouseOwner
()
{
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
$save
[
'name'
]
=
Request
::
param
(
'name'
);
//修改入住人员信息
$save
[
'phone'
]
=
Request
::
param
(
'phone'
);
public
function
changeHouseOwner
()
{
$is_card
=
Request
::
param
(
'id_card'
);
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
if
(
!
isCreditNo
(
$is_card
))
{
$save
[
'name'
]
=
Request
::
param
(
'name'
);
return
$this
->
returnJson
([],
'身份证号码不正确!'
,
400
);
$save
[
'phone'
]
=
Request
::
param
(
'phone'
);
}
$is_card
=
Request
::
param
(
'id_card'
);
$save
[
'id_card'
]
=
$is_card
;
if
(
!
isCreditNo
(
$is_card
))
{
$save
[
'type'
]
=
Request
::
param
(
'type'
);
return
$this
->
returnJson
([],
'身份证号码不正确!'
,
400
);
$save
[
'relatives_type'
]
=
Request
::
param
(
'relatives_type'
);
}
$save
[
'memo'
]
=
Request
::
param
(
'memo'
);
$save
[
'id_card'
]
=
$is_card
;
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
$save
[
'type'
]
=
Request
::
param
(
'type'
);
if
(
$change
)
{
$save
[
'relatives_type'
]
=
Request
::
param
(
'relatives_type'
);
return
$this
->
returnJson
([],
'success'
);
$save
[
'memo'
]
=
Request
::
param
(
'memo'
);
}
else
{
$change
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
update
(
$save
);
return
$this
->
returnJson
([],
'error'
,
400
);
if
(
$change
)
{
}
return
$this
->
returnJson
([],
'success'
);
}
}
else
{
return
$this
->
returnJson
([],
'error'
,
400
);
//删除绑定人员,需要用户先解绑
}
public
function
deleteHouseOwner
()
{
}
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
$where
[
'village_id'
]
=
$this
->
village_id
;
//删除绑定人员,需要用户先解绑
$bindInfo
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
field
(
'house_user_bind_id,status'
)
->
find
();
public
function
deleteHouseOwner
()
{
if
(
$bindInfo
[
'status'
]
!=
3
)
{
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
return
$this
->
returnJson
([],
'请先解绑用户!'
,
400
);
$where
[
'village_id'
]
=
$this
->
village_id
;
}
$bindInfo
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
field
(
'house_user_bind_id,status'
)
->
find
();
$del
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
delete
();
if
(
$bindInfo
[
'status'
]
!=
3
)
{
if
(
$del
)
{
return
$this
->
returnJson
([],
'请先解绑用户!'
,
400
);
return
$this
->
returnJson
([],
'success'
);
}
}
else
{
$del
=
Db
::
name
(
'house_user_bind'
)
->
where
(
$where
)
->
delete
();
return
$this
->
returnJson
([],
'error'
,
400
);
if
(
$del
)
{
}
return
$this
->
returnJson
([],
'success'
);
}
else
{
}
return
$this
->
returnJson
([],
'error'
,
400
);
}
//绑定人员详情
public
function
detailHouseOwner
()
{
}
$vacancy
=
new
Vacancy
(
$this
->
app
);
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
//绑定人员详情
$data
=
Db
::
name
(
'house_user_bind'
)
->
alias
(
'ub'
)
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = ub.vacancy_id'
)
->
where
(
$where
)
public
function
detailHouseOwner
()
{
->
field
(
'ub.*,hv.vacancy_code,hv.layout_id'
)
$vacancy
=
new
Vacancy
(
$this
->
app
);
->
find
();
$where
[
'house_user_bind_id'
]
=
Request
::
param
(
'bind_id'
);
$data
=
Common
::
changeField
(
$data
);
$data
=
Db
::
name
(
'house_user_bind'
)
->
alias
(
'ub'
)
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = ub.vacancy_id'
)
->
where
(
$where
)
if
(
$data
)
{
->
field
(
'ub.*,hv.vacancy_code,hv.layout_id'
)
$res
=
$vacancy
->
getVacancyAddress
(
$data
[
'vacancy_code'
],
$data
[
'layout_id'
]);
->
find
();
$data
[
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
$data
=
Common
::
changeField
(
$data
);
}
else
{
if
(
$data
)
{
$data
=
[];
$res
=
$vacancy
->
getVacancyAddress
(
$data
[
'vacancy_code'
],
$data
[
'layout_id'
]);
}
$data
[
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
return
$this
->
returnJson
(
$data
,
'success'
);
}
else
{
$data
=
[];
}
}
//添加绑定的人员
return
$this
->
returnJson
(
$data
,
'success'
);
public
function
createBindUser
()
{
$data
[
'village_id'
]
=
$this
->
village_id
;
}
$data
[
'name'
]
=
Request
::
param
(
'name'
);
//添加绑定的人员
$data
[
'phone'
]
=
Request
::
param
(
'phone'
);
public
function
createBindUser
()
{
$data
[
'create_time'
]
=
$data
[
'pass_time'
]
=
time
();
$data
[
'village_id'
]
=
$this
->
village_id
;
$data
[
'memo'
]
=
Request
::
param
(
'memo'
);
$data
[
'name'
]
=
Request
::
param
(
'name'
);
$data
[
'type'
]
=
Request
::
param
(
'type'
);
$data
[
'phone'
]
=
Request
::
param
(
'phone'
);
$data
[
'relatives_type'
]
=
Request
::
param
(
'relatives_type'
);
$data
[
'create_time'
]
=
$data
[
'pass_time'
]
=
time
();
$data
[
'status'
]
=
Request
::
param
(
'status'
,
1
);
$data
[
'memo'
]
=
Request
::
param
(
'memo'
);
$data
[
'id_card'
]
=
Request
::
param
(
'id_card'
);
$data
[
'type'
]
=
Request
::
param
(
'type'
);
//根据房间编号获取房间id,
$data
[
'relatives_type'
]
=
Request
::
param
(
'relatives_type'
);
$vacancy_code
=
Request
::
param
(
'vacancy_code'
);
$data
[
'status'
]
=
Request
::
param
(
'status'
,
1
);
$vacancy_id
=
DB
::
name
(
'house_vacancy'
)
->
where
([
'village_id'
=>
$this
->
village_id
,
'vacancy_code'
=>
$vacancy_code
])
->
value
(
'vacancy_id'
);
$data
[
'id_card'
]
=
Request
::
param
(
'id_card'
);
if
(
!
$vacancy_id
)
{
//根据房间编号获取房间id,
return
$this
->
returnJson
([],
'房间编号不存在!'
,
400
);
$vacancy_code
=
Request
::
param
(
'vacancy_code'
);
}
$vacancy_id
=
DB
::
name
(
'house_vacancy'
)
->
where
([
'village_id'
=>
$this
->
village_id
,
'vacancy_code'
=>
$vacancy_code
])
->
value
(
'vacancy_id'
);
$data
[
'vacancy_id'
]
=
$vacancy_id
;
if
(
!
$vacancy_id
)
{
//查看该用户是否绑定了同一个房间的多个身份
return
$this
->
returnJson
([],
'房间编号不存在!'
,
400
);
$is_exit
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
,
'id_card'
=>
$data
[
'id_card'
]])
->
find
();
}
if
(
$is_exit
)
{
$data
[
'vacancy_id'
]
=
$vacancy_id
;
return
$this
->
returnJson
([],
'该身份证用户在该房间下以绑定,请勿重复绑定!'
,
400
);
//查看该用户是否绑定了同一个房间的多个身份
}
$is_exit
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
,
'id_card'
=>
$data
[
'id_card'
]])
->
find
();
//业主只能有一个
if
(
$is_exit
)
{
if
(
$data
[
'type'
]
==
0
){
return
$this
->
returnJson
([],
'该身份证用户在该房间下以绑定,请勿重复绑定!'
,
400
);
$is_owner
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'village_id'
=>
$this
->
village_id
,
'vacancy_id'
=>
$vacancy_id
,
'type'
=>
0
,
'status'
=>
1
])
->
find
();
}
if
(
$is_owner
)
{
//业主只能有一个
return
$this
->
returnJson
([],
'该房间编号下以绑定业主,请先解绑!'
,
400
);
if
(
$data
[
'type'
]
==
0
){
}
$is_owner
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'village_id'
=>
$this
->
village_id
,
'vacancy_id'
=>
$vacancy_id
,
'type'
=>
0
,
'status'
=>
1
])
->
find
();
}
if
(
$is_owner
)
{
$add
=
Db
::
name
(
'house_user_bind'
)
->
save
(
$data
);
return
$this
->
returnJson
([],
'该房间编号下以绑定业主,请先解绑!'
,
400
);
if
(
$add
)
{
}
return
$this
->
returnJson
([],
'success'
);
}
}
else
{
$add
=
Db
::
name
(
'house_user_bind'
)
->
save
(
$data
);
return
$this
->
returnJson
([],
'添加失败'
,
400
);
if
(
$add
)
{
}
return
$this
->
returnJson
([],
'success'
);
}
else
{
}
return
$this
->
returnJson
([],
'添加失败'
,
400
);
}
//用户导入模板下载
public
function
downloadTenant
()
{
}
$file_dir
=
"./formwork/importTenant.xls"
;
$phpExcel
=
\PHPExcel_IOFactory
::
load
(
$file_dir
);
//用户导入模板下载
$village_id
=
$this
->
village_id
??
1
;
public
function
downloadTenant
()
{
$optionsArr
=
Db
::
name
(
'layout_list'
)
->
where
([
'village_id'
=>
$village_id
])
->
column
(
'code'
);
$file_dir
=
"./formwork/importTenant.xls"
;
$optionsString
=
implode
(
','
,
$optionsArr
);
//这个是选择布局
$phpExcel
=
\PHPExcel_IOFactory
::
load
(
$file_dir
);
for
(
$i
=
2
;
$i
<
20
;
$i
++
)
{
$village_id
=
$this
->
village_id
??
1
;
$phpExcel
->
getActiveSheet
()
->
getCell
(
'F'
.
$i
)
->
getDataValidation
()
->
setType
(
\PHPExcel_Cell_DataValidation
::
TYPE_LIST
)
$optionsArr
=
Db
::
name
(
'layout_list'
)
->
where
([
'village_id'
=>
$village_id
])
->
column
(
'code'
);
->
setErrorStyle
(
\PHPExcel_Cell_DataValidation
::
STYLE_INFORMATION
)
$optionsString
=
implode
(
','
,
$optionsArr
);
//这个是选择布局
->
setAllowBlank
(
false
)
for
(
$i
=
2
;
$i
<
20
;
$i
++
)
{
->
setShowInputMessage
(
true
)
$phpExcel
->
getActiveSheet
()
->
getCell
(
'F'
.
$i
)
->
getDataValidation
()
->
setType
(
\PHPExcel_Cell_DataValidation
::
TYPE_LIST
)
->
setShowErrorMessage
(
true
)
->
setErrorStyle
(
\PHPExcel_Cell_DataValidation
::
STYLE_INFORMATION
)
->
setShowDropDown
(
true
)
->
setAllowBlank
(
false
)
->
setErrorTitle
(
'输入的值有误'
)
->
setShowInputMessage
(
true
)
->
setError
(
'您输入的值不在下拉框列表内.'
)
->
setShowErrorMessage
(
true
)
->
setPromptTitle
(
'社区布局'
)
->
setShowDropDown
(
true
)
->
setFormula1
(
'"'
.
$optionsString
.
'"'
);;
//这一句为要设置数据有效性的单元格
->
setErrorTitle
(
'输入的值有误'
)
->
setError
(
'您输入的值不在下拉框列表内.'
)
$phpExcel
->
getActiveSheet
()
->
getCell
(
'E'
.
$i
)
->
getDataValidation
()
->
setType
(
\PHPExcel_Cell_DataValidation
::
TYPE_LIST
)
->
setPromptTitle
(
'社区布局'
)
->
setErrorStyle
(
\PHPExcel_Cell_DataValidation
::
STYLE_INFORMATION
)
->
setFormula1
(
'"'
.
$optionsString
.
'"'
);;
//这一句为要设置数据有效性的单元格
->
setAllowBlank
(
false
)
->
setShowInputMessage
(
true
)
$phpExcel
->
getActiveSheet
()
->
getCell
(
'E'
.
$i
)
->
getDataValidation
()
->
setType
(
\PHPExcel_Cell_DataValidation
::
TYPE_LIST
)
->
setShowErrorMessage
(
true
)
->
setErrorStyle
(
\PHPExcel_Cell_DataValidation
::
STYLE_INFORMATION
)
->
setShowDropDown
(
true
)
->
setAllowBlank
(
false
)
->
setErrorTitle
(
'输入的值有误'
)
->
setShowInputMessage
(
true
)
->
setError
(
'您输入的值不在下拉框列表内.'
)
->
setShowErrorMessage
(
true
)
->
setPromptTitle
(
'社区布局'
)
->
setShowDropDown
(
true
)
->
setFormula1
(
'"租客,业主,家属"'
);;
//这一句为要设置数据有效性的单元格
->
setErrorTitle
(
'输入的值有误'
)
->
setError
(
'您输入的值不在下拉框列表内.'
)
}
->
setPromptTitle
(
'社区布局'
)
$objWriter
=
new
\PHPExcel_Writer_Excel5
(
$phpExcel
);
->
setFormula1
(
'"租客,业主,家属"'
);;
//这一句为要设置数据有效性的单元格
header
(
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
header
(
'Content-Disposition: attachment;filename="用户导入.xls"'
);
}
header
(
'Cache-Control: max-age=0'
);
$objWriter
=
new
\PHPExcel_Writer_Excel5
(
$phpExcel
);
$objWriter
->
save
(
"php://output"
);
header
(
'Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
);
}
header
(
'Content-Disposition: attachment;filename="用户导入.xls"'
);
header
(
'Cache-Control: max-age=0'
);
$objWriter
->
save
(
"php://output"
);
//用户批量导入数据
}
public
function
importTenant
()
{
$filePath
=
Request
::
param
(
'filePath'
);
if
(
!
file_exists
(
$filePath
)){
//用户批量导入数据
return
$this
->
returnJson
([],
'文件不存在!'
,
400
);
public
function
importTenant
()
{
}
$filePath
=
Request
::
param
(
'filePath'
);
$village_id
=
$this
->
village_id
??
1
;
if
(
!
file_exists
(
$filePath
)){
$res
=
Common
::
importTenant
(
$filePath
,
$village_id
);
return
$this
->
returnJson
([],
'文件不存在!'
,
400
);
if
(
$res
[
'code'
]
!=
200
)
{
}
return
$this
->
returnJson
([],
'success'
);
$village_id
=
$this
->
village_id
??
1
;
}
$res
=
Common
::
importTenant
(
$filePath
,
$village_id
);
if
(
$res
[
'code'
]
!=
200
)
{
}
return
$this
->
returnJson
([],
'success'
);
}
//查看用户关联到车辆
}
public
function
userCar
()
{
$phone
=
Request
::
param
(
"phone"
);
$data
=
Db
::
name
(
'car'
)
->
where
([
'phone'
=>
$phone
])
->
field
(
"car_id,phone,license_plate,create_time,name,car_color,brand"
)
->
order
(
'create_time'
,
'desc'
)
->
select
()
->
toArray
();
//查看用户关联到车辆
return
$this
->
returnJson
(
Common
::
changeField
(
$data
),
'success'
);
public
function
userCar
()
{
$phone
=
Request
::
param
(
"phone"
);
}
$data
=
Db
::
name
(
'car'
)
->
where
([
'phone'
=>
$phone
])
->
field
(
"car_id,phone,license_plate,create_time,name,car_color,brand"
)
->
order
(
'create_time'
,
'desc'
)
->
select
()
->
toArray
();
return
$this
->
returnJson
(
Common
::
changeField
(
$data
),
'success'
);
}
}
}
\ 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