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
ad0f02a1
Commit
ad0f02a1
authored
Jan 26, 2021
by
蔡闯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除错误的文件
parent
fc5b7e05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
208 deletions
+31
-208
app/admin/controller/Payorder.php
app/admin/controller/Payorder.php
+0
-189
app/api/controller/Index.php
app/api/controller/Index.php
+1
-0
app/api/controller/User.php
app/api/controller/User.php
+30
-19
No files found.
app/admin/controller/Payorder.php
deleted
100644 → 0
View file @
fc5b7e05
<?php
namespace
app\api\controller
;
use
app\common\controller\Common
;
use
think\facade\Db
;
use
think\facade\Request
;
class
Payorder
extends
Base
{
//查看当前房间下的未缴费的水电物业等,只有业主才能看到记录
public
function
payList
()
{
$convertArr
=
$this
->
convertArr
;
$vacancy_id
=
Request
::
param
(
'vacancy_id'
);
$uid
=
$this
->
uid
;
$page
=
Request
::
param
(
'page'
,
1
);
$isPay
=
Request
::
param
(
'is_pay'
,
0
);
//不是房主不显示费用明细
$isOwner
=
Db
::
name
(
'house_user_bind'
)
->
where
([
'uid'
=>
$uid
,
'vacancy_id'
=>
$vacancy_id
])
->
find
();
if
(
$isOwner
[
'type'
]
!=
0
)
{
return
$this
->
returnJson
([]);
}
$where
[
'vacancy_id'
]
=
$vacancy_id
;
$where
[
'is_pay'
]
=
$isPay
;
$data
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
order
(
'cost_month'
,
'asc'
)
->
page
(
$page
,
config
(
'app.limit'
))
->
select
()
->
toArray
();
foreach
(
$data
as
$k
=>
$v
){
$data
[
$k
][
'type'
]
=
isset
(
$convertArr
[
$v
[
'type'
]])
?
$convertArr
[
$v
[
'type'
]]
:
$v
[
'type'
]
;
}
$total
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
count
();
$res
[
'total'
]
=
$total
;
$res
[
'data'
]
=
Common
::
changeField
(
$data
);
return
$this
->
returnJson
(
$res
);
}
//生成订单
public
function
createOrder
(){
$vacancy_id
=
Request
::
param
(
'vacancy_id'
);
$bind_id
=
Request
::
param
(
'bind_id'
);
$cost_ids
=
Request
::
param
(
'cost_ids'
);
$total_money
=
Request
::
param
(
'total_money'
,
0
);
//验证物业费订单是否是连续的
$where
[
'type'
]
=
'property'
;
$where
[
'is_pay'
]
=
0
;
$where
[
'vacancy_id'
]
=
$vacancy_id
;
$property_cost_ids
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
column
(
'cost_id'
);
//上传的未缴物业费的连续cost_id
$limit
=
count
(
$property_cost_ids
);
$cost_property_ids
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
limit
(
$limit
)
->
column
(
'cost_id'
);
if
(
$cost_property_ids
!=
$property_cost_ids
)
{
return
$this
->
returnJson
([],
'物业费缴费必须连续!'
);
}
//判断金额是否一致
unset
(
$where
[
'type'
]);
$total
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
sum
(
'pay_money'
);
if
(
$total
!=
$total_money
)
{
return
$this
->
returnJson
([],
'支付金额不正确!'
,
400
);
}
$data
[
'uid'
]
=
$this
->
uid
;
if
(
count
(
$cost_ids
)
>
1
){
$data
[
'order_type'
]
=
"多订单收费"
;
}
else
{
$type
=
Db
::
name
(
'cost'
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
value
(
'type'
);
$data
[
'order_type'
]
=
$type
;
}
$data
[
'order_name'
]
=
"社区收费"
;
$data
[
'order_num'
]
=
createOrderNum
();
$data
[
'vacancy_id'
]
=
$vacancy_id
;
$res
=
$this
->
getProperty
(
$data
[
'vacancy_id'
]);
if
(
$res
[
'code'
]
!=
200
){
return
$this
->
returnJson
([],
$res
[
'data'
],
400
);
}
$data
[
'property_id'
]
=
$res
[
'data'
][
'property_id'
];
$data
[
'village_id'
]
=
$res
[
'data'
][
'village_id'
];
$data
[
'bind_id'
]
=
$bind_id
;
$data
[
'money'
]
=
$total
;
$data
[
'create_time'
]
=
time
();
$data
[
'cost_ids'
]
=
json_encode
(
$cost_ids
);
$data
[
'money'
]
=
$total
;
$order_id
=
Db
::
name
(
'pay_order'
)
->
insertGetId
(
$data
);
if
(
$order_id
)
{
unset
(
$res
);
$res
[
'order_id'
]
=
$order_id
;
return
$this
->
returnJson
(
$res
);
}
else
{
return
$this
->
returnJson
([],
'添加失败!'
,
400
);
}
}
//根据房间id获取当前的物业id和小区id
public
function
getProperty
(
$vacancy_id
)
{
$data
=
Db
::
name
(
'house_vacancy'
)
->
alias
(
'hv'
)
->
leftJoin
(
'house_village hvi'
,
'hvi.village_id = hv.village_id'
)
->
where
([
'hv.vacancy_id'
=>
$vacancy_id
])
->
field
(
'hvi.village_id,hvi.property_id'
)
->
find
();
if
(
$data
){
return
[
'code'
=>
200
,
'data'
=>
$data
];
}
else
{
return
[
'code'
=>
400
,
'data'
=>
'数据错误!'
];
}
}
//生成支付参数
public
function
createPaySign
()
{
$order_id
=
Request
::
param
(
'order_id'
);
$total_money
=
Request
::
param
(
'total_money'
);
$vacancy_id
=
Request
::
param
(
'vacancy_id'
);
$pay_type
=
Request
::
param
(
'pay_type'
,
'alipay'
);
//weixin|alipay
if
(
empty
(
$order_id
))
{
return
$this
->
returnJson
([],
'订单未找到!'
,
400
);
}
if
(
$this
->
checkOrder
(
$order_id
,
$total_money
,
$vacancy_id
)){
$orderInfo
=
Db
::
name
(
'pay_order'
)
->
where
([
'order_id'
=>
$order_id
])
->
find
();
//支付宝支付
if
(
$pay_type
==
'alipay'
)
{
$param
[
'out_trade_no'
]
=
$orderInfo
[
'order_num'
];
$param
[
'subject'
]
=
$orderInfo
[
'order_name'
];
$param
[
'total_amount'
]
=
floatval
(
$orderInfo
[
'money'
]);
$res
=
$this
->
getAliPaySign
(
$param
);
//微信支付
}
else
{
$param
[
'order_id'
]
=
$orderInfo
[
'order_id'
];
$param
[
'total_money'
]
=
$orderInfo
[
'money'
];
$param
[
'order_name'
]
=
$orderInfo
[
'order_name'
];
$param
[
'order_num'
]
=
$orderInfo
[
'order_num'
];
$res
=
$this
->
getWeiXinPaySign
(
$param
);
}
return
$this
->
returnJson
(
$res
);
}
else
{
return
$this
->
returnJson
([],
'非法的订单信息!'
,
400
);
}
}
//获取支付宝支付参数
public
function
getAliPaySign
(
$param
)
{
require_once
"../extend/aliPay/AopClient.php"
;
require_once
"../extend/aliPay/request/AlipayTradeAppPayRequest.php"
;
$aop
=
new
\AopClient
();
$aop
->
gatewayUrl
=
'https://openapi.alipay.com/gateway.do'
;
$aop
->
appId
=
config
(
'app.pay_alipay_appid'
);
$aop
->
rsaPrivateKey
=
config
(
'app.pay_alipay_merchant_private_key'
);
$aop
->
alipayrsaPublicKey
=
config
(
'app.pay_alipay_public_key'
);
$aop
->
apiVersion
=
'1.0'
;
$aop
->
signType
=
config
(
'app.pay_alipay_sign_type'
);
$aop
->
postCharset
=
'utf-8'
;
$aop
->
format
=
'json'
;
$request
=
new
\AlipayTradeAppPayRequest
();
$request
->
setNotifyUrl
(
config
(
'app.notifyurl'
));
$request
->
setBizContent
(
json_encode
(
$param
));
$response
=
$aop
->
sdkExecute
(
$request
);
return
$response
;
}
//获取微信支付参数
public
function
getWeiXinPaySign
(
$param
)
{
require_once
"../extend/weixin/Weixin.php"
;
$configArr
=
config
(
'app.weixinPay'
);
$configArr
[
'notifyurl'
]
=
config
(
'app.notifyurl'
);
$weixin
=
new
\Weixin
(
$param
,
$configArr
);
return
$weixin
->
pay
();
}
//检查订单是否合法
public
function
checkOrder
(
$order_id
,
$total_money
,
$vacancy_id
)
{
$where
[
'order_id'
]
=
$order_id
;
$where
[
'uid'
]
=
$this
->
uid
;
$where
[
'vacancy_id'
]
=
$vacancy_id
;
$money
=
Db
::
name
(
'pay_order'
)
->
where
(
$where
)
->
value
(
'money'
);
if
(
$money
!=
$total_money
)
{
return
false
;
}
return
true
;
}
}
\ No newline at end of file
app/api/controller/Index.php
View file @
ad0f02a1
...
@@ -22,6 +22,7 @@ class Index extends Base
...
@@ -22,6 +22,7 @@ class Index extends Base
->
where
([
'hub.is_lately_login'
=>
1
,
'hub.uid'
=>
$uid
])
->
where
([
'hub.is_lately_login'
=>
1
,
'hub.uid'
=>
$uid
])
->
whereOr
([
'hub.uid'
=>
$uid
])
->
whereOr
([
'hub.uid'
=>
$uid
])
->
field
(
$field
)
->
find
();
->
field
(
$field
)
->
find
();
echo
Db
::
name
(
'house_user_bind'
)
->
getLastSql
();
exit
;
}
else
{
}
else
{
$data
=
Db
::
name
(
'house_village'
)
->
alias
(
'hvi'
)
->
where
([
'village_id'
=>
$village_id
])
->
field
(
$field
)
->
find
();
$data
=
Db
::
name
(
'house_village'
)
->
alias
(
'hvi'
)
->
where
([
'village_id'
=>
$village_id
])
->
field
(
$field
)
->
find
();
}
}
...
...
app/api/controller/User.php
View file @
ad0f02a1
...
@@ -100,8 +100,6 @@ class User extends Base
...
@@ -100,8 +100,6 @@ class User extends Base
$data
[
'status'
]
=
2
;
$data
[
'status'
]
=
2
;
$data
[
'create_time'
]
=
$car
[
'create_time'
]
=
time
();
$data
[
'create_time'
]
=
$car
[
'create_time'
]
=
time
();
$data
[
'memo'
]
=
Request
::
param
(
'memo'
);
$data
[
'memo'
]
=
Request
::
param
(
'memo'
);
// $data['emer_user'] = Request::param('emer_user');//紧急联系人
// $data['emer_phone'] = Request::param('emer_phone'); //紧急联系人电话
$car
[
'brand'
]
=
Request
::
param
(
'brand'
);
$car
[
'brand'
]
=
Request
::
param
(
'brand'
);
$car
[
'car_type'
]
=
Request
::
param
(
'car_type'
);
$car
[
'car_type'
]
=
Request
::
param
(
'car_type'
);
$car
[
'license_plate'
]
=
Request
::
param
(
'license_plate'
);
$car
[
'license_plate'
]
=
Request
::
param
(
'license_plate'
);
...
@@ -115,7 +113,7 @@ class User extends Base
...
@@ -115,7 +113,7 @@ class User extends Base
if
(
$data
[
'type'
]
==
0
)
{
//申请业主不需要填写业主后四位手机号
if
(
$data
[
'type'
]
==
0
)
{
//申请业主不需要填写业主后四位手机号
//检查该房间是否有房主绑定
//检查该房间是否有房主绑定
if
(
!
empty
(
$is_exit
)){
if
(
!
empty
(
$is_exit
)){
return
$this
->
returnJson
([],
'该房间下已有业主!'
,);
return
$this
->
returnJson
([],
'该房间下已有业主!'
,
400
);
}
}
$save
[
'id_card'
]
=
$data
[
'id_card'
];
$save
[
'id_card'
]
=
$data
[
'id_card'
];
$save
[
'name'
]
=
$data
[
'name'
];
$save
[
'name'
]
=
$data
[
'name'
];
...
@@ -125,12 +123,12 @@ class User extends Base
...
@@ -125,12 +123,12 @@ class User extends Base
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
])
->
save
(
$save
);
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
])
->
save
(
$save
);
}
else
{
}
else
{
if
(
empty
(
$is_exit
)){
if
(
empty
(
$is_exit
)){
return
$this
->
returnJson
([],
'该房间未绑定业主,不能绑定租客!'
,);
return
$this
->
returnJson
([],
'该房间未绑定业主,不能绑定租客!'
,
400
);
}
}
$ownerPhone
=
$is_exit
[
'phone'
];
$ownerPhone
=
$is_exit
[
'phone'
];
$phone_num
=
Request
::
param
(
'phone_num'
);
$phone_num
=
Request
::
param
(
'phone_num'
);
if
(
$phone_num
!=
substr
(
$ownerPhone
,
7
)){
if
(
$phone_num
!=
substr
(
$ownerPhone
,
7
)){
return
$this
->
returnJson
([],
'业主后四位手机号不正确!'
);
return
$this
->
returnJson
([],
'业主后四位手机号不正确!'
,
400
);
}
}
}
}
...
@@ -194,29 +192,39 @@ class User extends Base
...
@@ -194,29 +192,39 @@ class User extends Base
// }
// }
//个人中心
//个人中心
,如果没与传递bind_id,则返回最新的已绑定的房间信息
public
function
person
(){
public
function
person
(){
$bind_id
=
Request
::
param
(
'bind_id'
);
$bind_id
=
Request
::
param
(
'bind_id'
);
$where
[
'hub.house_user_bind_id'
]
=
$bind_id
;
$village_id
=
Request
::
param
(
'village_id'
);
if
(
$bind_id
){
$where
[
'hub.house_user_bind_id'
]
=
$bind_id
;
$where
[
'hub.status'
]
=
1
;
}
$where
[
'hub.uid'
]
=
$this
->
uid
;
$where
[
'hub.uid'
]
=
$this
->
uid
;
$data
=
Db
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
$data
=
Db
::
name
(
'house_user_bind'
)
->
alias
(
'hub'
)
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = hub.vacancy_id'
)
->
leftJoin
(
'house_vacancy hv'
,
'hv.vacancy_id = hub.vacancy_id'
)
->
leftJoin
(
'user'
,
'user.uid = hub.uid'
)
->
leftJoin
(
'user'
,
'user.uid = hub.uid'
)
->
where
(
$where
)
->
order
(
'hub.create_time'
,
'desc'
)
->
field
(
'hub.name,hv.vacancy_code,hv.layout_id,hv.village_id,user.sex,user.nickname,user.avatar'
)
->
where
(
$where
)
->
find
();
->
field
(
'hub.house_user_bind_id as bind_id,hub.name,hv.vacancy_code,hv.layout_id,hv.village_id,user.sex,user.nickname,user.avatar,user.face_img'
)
->
find
();
if
(
!
$data
)
{
//如果,新用户,只能返回基础信息
$whereOne
[
'uid'
]
=
$this
->
uid
;
$data
=
Db
::
name
(
'user'
)
->
alias
(
'user'
)
->
where
(
$whereOne
)
->
field
(
'user.sex,user.nickname,user.avatar,user.face_img'
)
->
find
();
}
//获取当日值班电话
//获取当日值班电话
if
(
$data
)
{
$phone
=
Db
::
name
(
'village_phone'
)
->
where
([
'village_id'
=>
$village_id
,
'is_on_call_phone'
=>
1
,
'status'
=>
1
])
->
value
(
'phone'
);
$phone
=
Db
::
name
(
'village_phone'
)
->
where
([
'village_id'
=>
$data
[
'village_id'
],
'is_on_call_phone'
=>
1
,
'status'
=>
1
])
->
value
(
'phone'
);
$data
[
'today_phone'
]
=
$phone
;
if
(
isset
(
$data
[
'vacancy_code'
]))
{
$res
=
Common
::
getVacancyAddress
(
$data
[
'vacancy_code'
],
$data
[
'layout_id'
]);
$res
=
Common
::
getVacancyAddress
(
$data
[
'vacancy_code'
],
$data
[
'layout_id'
]);
$data
[
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
$data
[
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
$data
[
'today_phone'
]
=
$phone
;
}
else
{
$data
=
[];
}
}
return
$this
->
returnJson
(
$data
);
return
$this
->
returnJson
(
$data
);
}
}
...
@@ -239,8 +247,11 @@ class User extends Base
...
@@ -239,8 +247,11 @@ class User extends Base
//人脸图片文件上传
//人脸图片文件上传
public
function
uploadFaceImg
()
{
public
function
uploadFaceImg
()
{
$file
=
request
()
->
file
(
'img'
);
$path
=
Request
::
param
(
'path'
,
'face'
);
$path
=
Request
::
param
(
'path'
,
'face'
);
$file
=
request
()
->
file
(
'img'
);
if
(
!
$file
||
!
in_array
(
$path
,[
'header '
,
'face'
])){
return
$this
->
returnJson
([],
'参数错误!'
,
400
);
}
$path
=
'/'
.
$path
;
$path
=
'/'
.
$path
;
$data
=
Common
::
uploadImg
(
$file
,
$path
);
$data
=
Common
::
uploadImg
(
$file
,
$path
);
if
(
$data
)
{
if
(
$data
)
{
...
...
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