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
cf7575fb
Commit
cf7575fb
authored
Feb 02, 2021
by
蔡闯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单接口
parent
ddea9757
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
35 deletions
+51
-35
app/api/controller/Payorder.php
app/api/controller/Payorder.php
+49
-34
app/api/controller/Payreturn.php
app/api/controller/Payreturn.php
+2
-1
No files found.
app/api/controller/Payorder.php
View file @
cf7575fb
...
...
@@ -30,31 +30,41 @@ class Payorder extends Base
$vacancys
[
$k
][
'vacancy_address'
]
=
$res
[
'vacancy_address'
];
foreach
(
$convertArr
as
$key
=>
$value
)
{
$where
[
'type'
]
=
$key
;
//总金额
$data
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
sum
(
'pay_money'
);
$time
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
order
(
'create_time'
,
'desc'
)
->
value
(
'create_time'
);
if
(
!
$data
)
{
$dataInfo
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
order
(
'create_time'
,
'desc'
)
->
field
(
'cost_id,pay_money,create_time'
)
->
select
()
->
toArray
();
if
(
!
$dataInfo
)
{
continue
;
}
$rest
[
'money'
]
=
$data
;
$total
=
0
;
$costIds
=
[];
foreach
(
$dataInfo
as
$ke
=>
$va
)
{
$total
+=
$va
[
'pay_money'
];
$costIds
[]
=
$va
[
'cost_id'
];
}
//总金额
$rest
[
'money'
]
=
$total
;
$rest
[
'type'
]
=
$key
;
$rest
[
'type_zh'
]
=
$convertArr
[
$key
];
$rest
[
'create_time'
]
=
$
time
;
$rest
[
'create_time'
]
=
$
dataInfo
[
0
][
'create_time'
];
//最近的账单生成的时间
$rest
[
'cost_ids'
]
=
$costIds
;
$vacancys
[
$k
][
'pay_list'
][]
=
Common
::
changeField
(
$rest
);;
}
//获取自定义的
unset
(
$where
[
'type'
]);
$money
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
whereNotIn
(
'type'
,
$array_keys
)
->
sum
(
'pay_money'
);
$time
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
whereNotIn
(
'type'
,
$array_keys
)
->
order
(
'create_time'
,
'desc'
)
->
value
(
'create_time'
);
if
(
$money
){
$rest_other
[
'money'
]
=
$money
;
$rest_other
[
'type'
]
=
"other"
;
$rest_other
[
'type_zh'
]
=
"自定义"
;
$rest_other
[
'create_time'
]
=
$time
;
$dataInfo
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
whereNotIn
(
'type'
,
$array_keys
)
->
order
(
'create_time'
,
'desc'
)
->
field
(
'cost_id,pay_money,create_time'
)
->
select
()
->
toArray
();
if
(
!
$dataInfo
)
{
continue
;
}
$total
=
0
;
$costIds
=
[];
foreach
(
$dataInfo
as
$ke
=>
$va
)
{
$total
+=
$va
[
'pay_money'
];
$costIds
[]
=
$va
[
'cost_id'
];
}
$rest_other
[
'money'
]
=
$total
;
$rest_other
[
'type'
]
=
"other"
;
$rest_other
[
'type_zh'
]
=
"自定义"
;
$rest_other
[
'create_time'
]
=
$dataInfo
[
0
][
'create_time'
];
//最近的账单生成的时间
$rest_other
[
'cost_ids'
]
=
$costIds
;
$vacancys
[
$k
][
'pay_list'
][]
=
Common
::
changeField
(
$rest_other
);
}
}
else
{
...
...
@@ -159,6 +169,7 @@ class Payorder extends Base
}
//某个房间下的某个收费项的未缴费缴费列表
//具体房间未缴费列表
public
function
vacancyPayList
()
{
$vacancy_id
=
Request
::
param
(
'vacancy_id'
);
$type
=
Request
::
param
(
'type'
);
//property|water|electric|gas|park|other,除了other,其他都能对应表中的type
...
...
@@ -174,7 +185,7 @@ class Payorder extends Base
$where
[]
=
[
'is_pay'
,
'='
,
0
];
//查询该房间的服务结束时间
$property_end_time
=
Db
::
name
(
'house_
user_
vacancy'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
])
->
value
(
'property_end_time'
);
$property_end_time
=
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
])
->
value
(
'property_end_time'
);
if
(
$property_end_time
){
$where
[]
=
[
'cost_month'
,
'>'
,
$property_end_time
];
}
else
{
...
...
@@ -187,7 +198,7 @@ class Payorder extends Base
return
$this
->
returnJson
([],
'查询错误!'
,
400
);
}
$data
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
page
(
$page
,
config
(
'app.limit'
))
->
order
(
'cost_month'
,
'
de
sc'
)
->
field
(
'cost_id,cost_month,pay_money,type'
)
->
select
()
->
toArray
();
$data
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
page
(
$page
,
config
(
'app.limit'
))
->
order
(
'cost_month'
,
'
a
sc'
)
->
field
(
'cost_id,cost_month,pay_money,type'
)
->
select
()
->
toArray
();
$total
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
count
();
$res
[
'total'
]
=
$total
;
$res
[
'data'
]
=
$data
;
...
...
@@ -240,13 +251,24 @@ class Payorder extends Base
$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
([],
'物业费缴费必须连续!'
);
}
//获取房间的物业服务时间,
$property_end_time
=
Db
::
name
(
'house_vacancy'
)
->
where
([
'vacancy_id'
=>
$vacancy_id
])
->
value
(
'property_end_time'
);
if
(
$property_end_time
)
{
$whereOne
[]
=
[
'cost_month'
,
'>'
,
$property_end_time
];
}
else
{
$whereOne
=
[];
}
$property_cost_ids
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
where
(
$whereOne
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
column
(
'cost_id'
);
//上传的未缴物业费的连续cost_id
//如果物业费选择了,则判断
if
(
$property_cost_ids
)
{
$limit
=
count
(
$property_cost_ids
);
$cost_property_ids
=
Db
::
name
(
'cost'
)
->
where
(
$where
)
->
where
(
$whereOne
)
->
limit
(
$limit
)
->
column
(
'cost_id'
);
if
(
$cost_property_ids
!=
$property_cost_ids
)
{
return
$this
->
returnJson
([],
'物业费缴费必须连续!'
,
400
);
}
}
$total_money
=
Request
::
param
(
'total_money'
,
0
);
//判断金额是否一致
unset
(
$where
[
'type'
]);
...
...
@@ -268,7 +290,6 @@ class Payorder extends Base
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
;
...
...
@@ -280,6 +301,8 @@ class Payorder extends Base
if
(
$order_id
)
{
unset
(
$res
);
$res
[
'order_id'
]
=
$order_id
;
//cost表中关联order_id
Db
::
name
(
'cost'
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
save
([
'order_id'
=>
$order_id
]);
return
$this
->
returnJson
(
$res
);
}
else
{
return
$this
->
returnJson
([],
'添加失败!'
,
400
);
...
...
@@ -314,12 +337,7 @@ class Payorder extends Base
$param
[
'subject'
]
=
$orderInfo
[
'order_name'
];
$param
[
'total_amount'
]
=
floatval
(
$orderInfo
[
'money'
]);
$res
=
$this
->
getAliPaySign
(
$param
);
Db
::
name
(
'pay_order'
)
->
where
([
'order_id'
=>
$order_id
])
->
save
([
'pay_type'
=>
"支付宝"
]);
$cost_ids
=
json_encode
(
$orderInfo
[
'cost_ids'
]);
Db
::
name
(
'pay_order'
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
save
([
'order_id'
=>
$order_id
]);
//微信支付
}
else
{
$param
[
'order_id'
]
=
$orderInfo
[
'order_id'
];
...
...
@@ -330,9 +348,7 @@ class Payorder extends Base
//更改订单的支付方式
Db
::
name
(
'pay_order'
)
->
where
([
'order_id'
=>
$order_id
])
->
save
([
'pay_type'
=>
"微信"
]);
}
//修改cost表
$cost_ids
=
json_encode
(
$orderInfo
[
'cost_ids'
]);
Db
::
name
(
'pay_order'
)
->
whereIn
(
'cost_id'
,
$cost_ids
)
->
save
([
'order_id'
=>
$order_id
]);
return
$this
->
returnJson
(
$res
);
}
else
{
return
$this
->
returnJson
([],
'非法的订单信息!'
,
400
);
...
...
@@ -365,7 +381,6 @@ class Payorder extends Base
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
();
}
...
...
app/api/controller/Payreturn.php
View file @
cf7575fb
...
...
@@ -11,6 +11,7 @@ class Payreturn extends BaseController
{
//支付宝支付成功后的异步通知地址
public
function
aliPayReturn
()
{
require_once
"../extend/aliPay/AopClient.php"
;
//生成日志
$this
->
createPayLog
(
$_POST
,
"支付宝"
);
...
...
@@ -51,7 +52,7 @@ class Payreturn extends BaseController
private
function
changePayStatus
(
$out_trade_no
)
{
$where
[
'order_num'
]
=
$out_trade_no
;
$save
[
'pay_time'
]
=
time
();
$save
[
'
paid
'
]
=
1
;
$save
[
'
is_pay
'
]
=
1
;
$cost_ids
=
DB
::
name
(
'pay_order'
)
->
where
([
'order_num'
=>
$out_trade_no
])
->
value
(
'cost_ids'
);
$cost_ids_arr
=
json_decode
(
$cost_ids
);
Db
::
startTrans
();
...
...
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