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
f6791767
Commit
f6791767
authored
Sep 24, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8b9a027b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
78 deletions
+119
-78
Amercement.php
application/api_broker/controller/Amercement.php
+3
-41
AmercementService.php
application/index/service/AmercementService.php
+107
-37
OAmercementPayModel.php
application/model/OAmercementPayModel.php
+9
-0
No files found.
application/api_broker/controller/Amercement.php
View file @
f6791767
...
...
@@ -145,50 +145,13 @@ class Amercement extends Basic
}
$arr
[
"oritranflow"
]
=
$params
[
"tranflow"
];
$data
=
json_encode
(
$arr
);
$curl
=
new
\app\chat\utils\CurlUtil
();
$curl
->
headers
=
[
"Accept"
=>
"application/json"
,
"Content-Type"
=>
"application/json;charset=utf-8"
,
];
$curl
->
options
=
[
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
$url
=
$this
->
buildSendUrl
();
$response
=
$curl
->
post
(
$url
,
$data
);
$result
=
json_decode
(
$response
,
true
);
if
(
$result
&&
$result
[
"code"
]
==
0
)
{
$status
=
0
;
$is_success
=
$result
[
"data"
][
"oritranstatus"
];
if
(
$is_success
==
"01"
)
{
$status
=
1
;
}
elseif
(
$is_success
==
"02"
)
{
$status
=
3
;
}
else
{
$status
=
2
;
}
$remark
=
$result
[
"data"
][
"orirespmsg"
];
$is_ok
=
$this
->
s_amercement
->
updatePayAmercement
(
$params
[
"tranflow"
],
$status
,
$remark
);
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"success"
,
[
"status"
=>
$status
,
"remark"
=>
$remark
]);
}
else
{
return
$this
->
response
(
"101"
,
"查询异常请稍后再试"
);
}
$result
=
$this
->
s_amercement
->
getPayStatusByNo
(
$arr
);
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"msg"
]);
}
else
{
return
$this
->
response
(
"101"
,
$result
[
"msg"
]);
}
}
/**
* 请求api
* @return string
*/
private
function
buildSendUrl
()
{
return
"http://120.55.43.9/api/pay/trans_result"
;
}
}
\ No newline at end of file
application/index/service/AmercementService.php
View file @
f6791767
...
...
@@ -300,9 +300,9 @@ class AmercementService
$result
[
'operation_name'
]
=
$agent_data
[
'name'
];
}
}
$result
[
'img'
]
=
$this
->
getAmercementImage
(
$result
[
'id'
]);
$payInfo
=
$this
->
isPay
(
$id
);
$result
[
'trade_no'
]
=
isset
(
$payInfo
[
'trade_no'
])
&&
!
empty
(
$payInfo
[
'trade_no'
])
?
$payInfo
[
'trade_no'
]
:
''
;
$result
[
'img'
]
=
$this
->
getAmercementImage
(
$result
[
'id'
]);
$payInfo
=
$this
->
isPay
(
$id
);
$result
[
'trade_no'
]
=
isset
(
$payInfo
[
'trade_no'
])
&&
!
empty
(
$payInfo
[
'trade_no'
])
?
$payInfo
[
'trade_no'
]
:
''
;
return
$result
;
}
...
...
@@ -318,7 +318,7 @@ class AmercementService
public
function
editAmercement
(
$id
,
$params
,
$edit_type
,
$operation_id
)
{
$code
=
200
;
$msg
=
'成功'
;
$msg
=
'成功'
;
switch
(
$edit_type
)
{
case
0
:
//0编辑
...
...
@@ -347,13 +347,13 @@ class AmercementService
break
;
case
1
:
//1取消
$res
=
$this
->
cancelAmercement
(
$id
);
$res
=
$this
->
cancelAmercement
(
$id
);
$code
=
$res
[
'code'
];
$msg
=
$res
[
'msg'
];
break
;
default
:
//2转已支付
$res
=
$this
->
consummationAmercement
(
$id
,
$operation_id
);
$res
=
$this
->
consummationAmercement
(
$id
,
$operation_id
);
$code
=
$res
[
'code'
];
$msg
=
$res
[
'msg'
];
}
...
...
@@ -401,15 +401,15 @@ class AmercementService
public
function
cancelAmercement
(
$id
)
{
//判断是否有支付过
$payInfo
=
$this
->
isPay
(
$id
,
-
1
);
$payInfo
=
$this
->
isPay
(
$id
,
-
1
);
if
(
$payInfo
)
{
//有支付订单号 不允许取消
return
[
'code'
=>
101
,
'msg'
=>
'失败!该罚款有支付订单'
];
return
[
'code'
=>
101
,
'msg'
=>
'失败!该罚款有支付订单'
];
}
else
{
//无支付订单号 允许取消
$data
=
[];
$data
[
'id'
]
=
$id
;
$data
=
[];
$data
[
'id'
]
=
$id
;
$data
[
'status'
]
=
2
;
$this
->
m_amercement
->
updateAmercementData
(
$data
);
return
[
'code'
=>
200
,
'msg'
=>
'已取消'
];
return
[
'code'
=>
200
,
'msg'
=>
'已取消'
];
}
}
...
...
@@ -425,15 +425,15 @@ class AmercementService
//判断是否有支付过
$payInfo
=
$this
->
isPay
(
$id
);
if
(
$payInfo
)
{
//已支付
$data
=
[];
$data
[
'id'
]
=
$id
;
$data
[
'status'
]
=
1
;
$data
[
'operation_id'
]
=
$operation_id
;
$data
=
[];
$data
[
'id'
]
=
$id
;
$data
[
'status'
]
=
1
;
$data
[
'operation_id'
]
=
$operation_id
;
$data
[
'operation_time'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$this
->
m_amercement
->
updateAmercementData
(
$data
);
return
[
'code'
=>
200
,
'msg'
=>
'已转为已支付'
];
return
[
'code'
=>
200
,
'msg'
=>
'已转为已支付'
];
}
else
{
//未支付
return
[
'code'
=>
101
,
'msg'
=>
'失败!暂未支付'
];
return
[
'code'
=>
101
,
'msg'
=>
'失败!暂未支付'
];
}
}
...
...
@@ -445,18 +445,17 @@ class AmercementService
*/
public
function
isPay
(
$amercement_id
,
$status
=
1
)
{
$amercementPayModel
=
new
OAmercementPayModel
();
$amercementPayModel
=
new
OAmercementPayModel
();
$where
[
"amercement_id"
]
=
$amercement_id
;
$where
[
"status"
]
=
$status
;
if
(
$status
==
-
1
)
{
$where
[
"status"
]
=
array
(
'neq'
,
2
);
//排除支付失败的
$where
[
"status"
]
=
$status
;
if
(
$status
==
-
1
)
{
$where
[
"status"
]
=
array
(
'neq'
,
2
);
//排除支付失败的
}
$payInfo
=
$amercementPayModel
->
getAmercementPayInfo
(
$where
,
"id,status,trade_no"
);
return
$payInfo
;
}
/**
* 后台罚款账单表
* @param $params
...
...
@@ -696,18 +695,32 @@ class AmercementService
public
function
savePayAmercement
(
$amercement_id
,
$trade_no
,
$pay_type
,
$pay_money
,
$pay_time
)
{
//todo 判断是否有支付过
$amercementPayModel
=
new
OAmercementPayModel
();
$amercementPayModel
=
new
OAmercementPayModel
();
$where
[
"amercement_id"
]
=
$amercement_id
;
$where
[
"status"
]
=
1
;
$payInfo1
=
$amercementPayModel
->
getAmercementPayInfo
(
$where
,
"id,status,trade_no"
);
if
(
$payInfo1
)
{
if
(
count
(
$payInfo1
)
>
0
)
{
return
[
"code"
=>
'101'
,
"msg"
=>
"订单已支付"
];
}
$where
[
"amercement_id"
]
=
$amercement_id
;
$where
[
"trade_no"
]
=
$trade_no
;
$payInfo2
=
$amercementPayModel
->
getAmercementPayInfo
(
$where
,
"id,status,trade_no"
);
$where_
[
"amercement_id"
]
=
$amercement_id
;
$payInfo
=
$amercementPayModel
->
getAmercementPayList
(
$where_
,
"id,status,trade_no"
);
$is_exits
=
false
;
foreach
(
$payInfo
as
$item
)
{
if
(
$item
[
"trade_no"
]
==
$trade_no
)
{
$is_exits
=
true
;
}
$arr
[
"oritranflow"
]
=
$item
[
"trade_no"
];
$curlRes
=
$this
->
getPayStatusByNo
(
$arr
);
if
(
$curlRes
[
"code"
]
==
200
&&
$curlRes
[
"status"
]
==
1
)
{
return
[
"code"
=>
'101'
,
"msg"
=>
"订单已支付"
];
}
else
if
(
$curlRes
[
"code"
]
==
200
&&
$curlRes
[
"status"
]
>
1
)
{
return
[
"code"
=>
'101'
,
"msg"
=>
"该笔支付已发起,请到支付宝>>我的>>账单进行支付。如已支付,则请等待几分钟该列表的状态才会刷新!"
];
}
if
(
$payInfo2
)
{
}
if
(
$is_exits
)
{
return
[
"code"
=>
'101'
,
"msg"
=>
"订单等待支付中"
];
}
else
{
$arr
[
"amercement_id"
]
=
$amercement_id
;
...
...
@@ -723,22 +736,78 @@ class AmercementService
public
function
updatePayAmercement
(
$trade_no
,
$status
,
$remark
)
{
$amercementPayModel
=
new
OAmercementPayModel
();
big_log
(
'status'
.
$status
);
big_log
(
'trade_no'
.
$trade_no
);
//罚款记录改已支付
if
(
$status
==
1
)
{
$payInfo
=
$amercementPayModel
->
getAmercementPayInfo
([
'trade_no'
=>
$trade_no
],
"amercement_id"
);
if
(
isset
(
$payInfo
[
'amercement_id'
])
&&
$payInfo
[
'amercement_id'
]
>
0
)
{
$data
=
[];
$data
[
'id'
]
=
$payInfo
[
'amercement_id'
];
$data
[
'status'
]
=
1
;
$data
[
'operation_id'
]
=
0
;
if
(
$status
==
1
)
{
$payInfo
=
$amercementPayModel
->
getAmercementPayInfo
([
'trade_no'
=>
$trade_no
],
"amercement_id"
);
if
(
isset
(
$payInfo
[
'amercement_id'
])
&&
$payInfo
[
'amercement_id'
]
>
0
)
{
$data
=
[];
$data
[
'id'
]
=
$payInfo
[
'amercement_id'
];
$data
[
'status'
]
=
1
;
$data
[
'operation_id'
]
=
0
;
$data
[
'operation_time'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$this
->
m_amercement
->
updateAmercementData
(
$data
);
}
}
$update
[
"status"
]
=
$status
;
$update
[
"remark"
]
=
$remark
;
$update
[
"status"
]
=
$status
;
$update
[
"remark"
]
=
$remark
;
return
$amercementPayModel
->
updateAmercementPayData
(
$trade_no
,
$update
);
}
/**
* @param $arr
* @return array
*/
public
function
getPayStatusByNo
(
$arr
)
{
$data
=
json_encode
(
$arr
);
$curl
=
new
\app\chat\utils\CurlUtil
();
$curl
->
headers
=
[
"Accept"
=>
"application/json"
,
"Content-Type"
=>
"application/json;charset=utf-8"
,
];
$curl
->
options
=
[
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
$url
=
$this
->
buildSendUrl
();
$response
=
$curl
->
post
(
$url
,
$data
);
$result
=
json_decode
(
$response
,
true
);
if
(
$result
&&
$result
[
"code"
]
==
0
)
{
$status
=
0
;
$is_success
=
$result
[
"data"
][
"oritranstatus"
];
if
(
$is_success
==
"01"
)
{
$status
=
1
;
}
elseif
(
$is_success
==
"02"
)
{
$status
=
3
;
}
else
{
$status
=
2
;
}
$remark
=
$result
[
"data"
][
"orirespmsg"
];
$is_ok
=
$this
->
updatePayAmercement
(
$arr
[
"tranflow"
],
$status
,
$remark
);
if
(
$is_ok
>
0
)
{
$res
[
"status"
]
=
$status
;
$res
[
"remark"
]
=
$remark
;
return
[
"code"
=>
"200"
,
"msg"
=>
$res
];
}
else
{
return
[
"code"
=>
"101"
,
"msg"
=>
"查询异常请稍后再试"
];
}
}
else
{
return
[
"code"
=>
"101"
,
"msg"
=>
$result
[
"msg"
]];
}
}
/**
* 请求api
* @return string
*/
private
function
buildSendUrl
()
{
return
"http://120.55.43.9/api/pay/trans_result"
;
}
}
\ No newline at end of file
application/model/OAmercementPayModel.php
View file @
f6791767
...
...
@@ -41,6 +41,15 @@ class OAmercementPayModel extends Model
return
$result
;
}
public
function
getAmercementPayList
(
$params
,
$field
)
{
$result
=
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$result
;
}
/**更新数据
* @param $params
...
...
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