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
55b86b85
Commit
55b86b85
authored
Aug 21, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
0e5511bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
66 deletions
+70
-66
OfficeOrderLogService.php
application/api_broker/service/OfficeOrderLogService.php
+1
-1
OfficePayLogService.php
application/api_broker/service/OfficePayLogService.php
+69
-65
No files found.
application/api_broker/service/OfficeOrderLogService.php
View file @
55b86b85
...
@@ -124,7 +124,7 @@ class OfficeOrderLogService
...
@@ -124,7 +124,7 @@ class OfficeOrderLogService
if
(
$pay_id
>
0
)
{
if
(
$pay_id
>
0
)
{
$payLogService
=
new
OfficePayLogService
();
$payLogService
=
new
OfficePayLogService
();
$payLogService
->
addAdjustment
(
$father_id
,
$pay_id
,
$money
,
$type
,
$agent_id
);
$payLogService
->
addAdjustment
(
$father_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$store_id
);
}
}
/*$pushMarchIn = new PushMessageService();
/*$pushMarchIn = new PushMessageService();
...
...
application/api_broker/service/OfficePayLogService.php
View file @
55b86b85
...
@@ -26,9 +26,9 @@ class OfficePayLogService
...
@@ -26,9 +26,9 @@ class OfficePayLogService
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
payLogModel
=
new
OfficeOPayLogModel
();
$this
->
payLogModel
=
new
OfficeOPayLogModel
();
$this
->
payLogAdjustmentModel
=
new
OfficeOPayLogAdjustment
();
$this
->
payLogAdjustmentModel
=
new
OfficeOPayLogAdjustment
();
$this
->
oRefundModel
=
new
OfficeORefundModel
();
$this
->
oRefundModel
=
new
OfficeORefundModel
();
}
}
public
function
getBeForNum
(
$order_id
)
public
function
getBeForNum
(
$order_id
)
...
@@ -43,10 +43,10 @@ class OfficePayLogService
...
@@ -43,10 +43,10 @@ class OfficePayLogService
* @param $type
* @param $type
* @return int
* @return int
*/
*/
public
function
adjustment
(
$pay_id
,
$type
=
1
)
public
function
adjustment
(
$pay_id
,
$type
=
1
)
{
{
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed
=
"id,money"
;
$filed
=
"id,money"
;
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
if
(
count
(
$pay_log_arr
)
<
0
)
{
if
(
count
(
$pay_log_arr
)
<
0
)
{
return
-
1
;
return
-
1
;
...
@@ -54,12 +54,12 @@ class OfficePayLogService
...
@@ -54,12 +54,12 @@ class OfficePayLogService
$pay_log_arr
=
$pay_log_arr
[
0
];
$pay_log_arr
=
$pay_log_arr
[
0
];
$where_
[
"paylog_id"
]
=
$pay_id
;
$where_
[
"paylog_id"
]
=
$pay_id
;
$where_
[
"is_del"
]
=
0
;
$where_
[
"is_del"
]
=
0
;
//调整
//调整
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
//减去退款
//减去退款
$refund_params
[
"pay_log_id"
]
=
$pay_id
;
$refund_params
[
"pay_log_id"
]
=
$pay_id
;
if
(
$type
==
2
)
{
if
(
$type
==
2
)
{
//驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。
//驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。
$refund_params
[
"status"
]
=
array
(
"neq"
,
4
);
$refund_params
[
"status"
]
=
array
(
"neq"
,
4
);
}
}
...
@@ -79,14 +79,14 @@ class OfficePayLogService
...
@@ -79,14 +79,14 @@ class OfficePayLogService
* @param $agent_id
* @param $agent_id
* @return int
* @return int
*/
*/
public
function
addAdjustment
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
)
public
function
addAdjustment
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$store_id
)
{
{
$filed
=
"id,type"
;
$filed
=
"id,type"
;
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
if
(
count
(
$pay_log_arr
)
<
0
)
{
if
(
count
(
$pay_log_arr
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
$where_
=
$this
->
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$pay_log_arr
[
0
][
"type"
]);
$where_
=
$this
->
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$pay_log_arr
[
0
][
"type"
]
,
$store_id
);
$this
->
payLogAdjustmentModel
->
addAdjustment
(
$where_
);
$this
->
payLogAdjustmentModel
->
addAdjustment
(
$where_
);
}
}
...
@@ -99,13 +99,13 @@ class OfficePayLogService
...
@@ -99,13 +99,13 @@ class OfficePayLogService
* @param $old_type
* @param $old_type
* @return mixed
* @return mixed
*/
*/
private
function
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$old_type
)
private
function
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$old_type
,
$store_id
)
{
{
$arr
[
"paylog_id"
]
=
$pay_id
;
$arr
[
"paylog_id"
]
=
$pay_id
;
$arr
[
"new_paylog_id"
]
=
$new_pay_id
;
$arr
[
"new_paylog_id"
]
=
$new_pay_id
;
$arr
[
"money"
]
=
$money
;
$arr
[
"money"
]
=
$money
;
$val
=
0
;
$val
=
0
;
if
(
$old_type
==
10
)
{
//意向金
if
(
$old_type
==
10
)
{
//意向金
switch
(
$type
)
{
switch
(
$type
)
{
...
@@ -138,10 +138,11 @@ class OfficePayLogService
...
@@ -138,10 +138,11 @@ class OfficePayLogService
}
}
}
}
$arr
[
"type"
]
=
$val
;
$arr
[
"type"
]
=
$val
;
$arr
[
"operation_id"
]
=
$agent_id
;
$arr
[
"operation_id"
]
=
$agent_id
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"reckon_in_store"
]
=
$store_id
;
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
return
$arr
;
}
}
...
@@ -175,9 +176,9 @@ class OfficePayLogService
...
@@ -175,9 +176,9 @@ class OfficePayLogService
if
(
empty
(
$refund_id
))
{
if
(
empty
(
$refund_id
))
{
$where
[
'pay_log_id'
]
=
$pay_log_id
;
$where
[
'pay_log_id'
]
=
$pay_log_id
;
$where
[
'status'
]
=
4
;
$where
[
'status'
]
=
4
;
$where
[
'is_del'
]
=
0
;
$where
[
'is_del'
]
=
0
;
$id
=
$this
->
oRefundModel
->
getFind
(
'id'
,
$where
);
$id
=
$this
->
oRefundModel
->
getFind
(
'id'
,
$where
);
if
(
$id
[
'id'
]
>
0
)
{
if
(
$id
[
'id'
]
>
0
)
{
return
-
3
;
//在驳回上修改
return
-
3
;
//在驳回上修改
}
}
...
@@ -185,14 +186,14 @@ class OfficePayLogService
...
@@ -185,14 +186,14 @@ class OfficePayLogService
//验证金额是否合法
//验证金额是否合法
$payLogService
=
new
OfficePayLogService
();
$payLogService
=
new
OfficePayLogService
();
$residue_money
=
$payLogService
->
adjustment
(
$pay_log_id
,
2
);
$residue_money
=
$payLogService
->
adjustment
(
$pay_log_id
,
2
);
if
(
$residue_money
<
$refund_money
)
{
if
(
$residue_money
<
$refund_money
)
{
return
-
2
;
return
-
2
;
}
}
$insert_id
=
0
;
$insert_id
=
0
;
$arr
=
$this
->
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$arr
=
$this
->
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
,
$refund_id
);
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
,
$refund_id
);
if
(
$refund_id
<=
0
)
{
if
(
$refund_id
<=
0
)
{
$insert_id
=
$this
->
oRefundModel
->
addRefund
(
$arr
);
$insert_id
=
$this
->
oRefundModel
->
addRefund
(
$arr
);
}
else
{
}
else
{
...
@@ -203,8 +204,8 @@ class OfficePayLogService
...
@@ -203,8 +204,8 @@ class OfficePayLogService
if
(
$insert_id
>
0
&&
$remark_img
)
{
if
(
$insert_id
>
0
&&
$remark_img
)
{
$this
->
addOImg
(
$insert_id
,
3
,
$remark_img
);
$this
->
addOImg
(
$insert_id
,
3
,
$remark_img
);
}
}
if
(
$del_img
)
{
if
(
$del_img
)
{
$this
->
delOImg
(
3
,
$del_img
);
$this
->
delOImg
(
3
,
$del_img
);
}
}
/*$service_push = new PushMessageService();
/*$service_push = new PushMessageService();
...
@@ -233,31 +234,31 @@ class OfficePayLogService
...
@@ -233,31 +234,31 @@ class OfficePayLogService
*/
*/
private
function
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
private
function
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
,
$refund_id
)
$refund_way
,
$remark
,
$refund_id
)
{
{
if
(
$refund_id
>
0
)
{
//修改
if
(
$refund_id
>
0
)
{
//修改
$arr
[
"id"
]
=
$refund_id
;
$arr
[
"id"
]
=
$refund_id
;
}
else
{
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
}
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"agent_name"
]
=
$agent_name
;
$arr
[
"agent_name"
]
=
$agent_name
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"refund_money"
]
=
$refund_money
;
$arr
[
"refund_money"
]
=
$refund_money
;
$arr
[
"name"
]
=
$name
;
$arr
[
"name"
]
=
$name
;
$arr
[
"phone"
]
=
$phone
;
$arr
[
"phone"
]
=
$phone
;
$arr
[
"status"
]
=
0
;
$arr
[
"status"
]
=
0
;
$arr
[
"bank"
]
=
$bank
;
$arr
[
"bank"
]
=
$bank
;
$arr
[
"card_no"
]
=
$card_no
;
$arr
[
"card_no"
]
=
$card_no
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"remark"
]
=
$remark
;
$arr
[
"receipt_number"
]
=
$receipt_number
;
$arr
[
"receipt_number"
]
=
$receipt_number
;
$arr
[
"type"
]
=
$type
;
$arr
[
"type"
]
=
$type
;
$arr
[
"refund_cause"
]
=
$refund_cause
;
$arr
[
"refund_cause"
]
=
$refund_cause
;
$arr
[
"pay_log_id"
]
=
$pay_log_id
;
$arr
[
"pay_log_id"
]
=
$pay_log_id
;
$arr
[
"refund_way"
]
=
$refund_way
;
$arr
[
"refund_way"
]
=
$refund_way
;
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
return
$arr
;
}
}
...
@@ -283,10 +284,10 @@ class OfficePayLogService
...
@@ -283,10 +284,10 @@ class OfficePayLogService
private
function
getOImg
(
$id
,
$img_type
)
private
function
getOImg
(
$id
,
$img_type
)
{
{
//查询图片
//查询图片
$oImgModel
=
new
OfficeOImg
();
$oImgModel
=
new
OfficeOImg
();
$params
[
"img_id"
]
=
$id
;
$params
[
"img_id"
]
=
$id
;
$params
[
"img_type"
]
=
$img_type
;
$params
[
"img_type"
]
=
$img_type
;
$img_arr
=
$oImgModel
->
getImgList
(
$params
);
$img_arr
=
$oImgModel
->
getImgList
(
$params
);
return
$img_arr
;
return
$img_arr
;
}
}
...
@@ -294,11 +295,12 @@ class OfficePayLogService
...
@@ -294,11 +295,12 @@ class OfficePayLogService
* @param $type
* @param $type
* @param $del_img
* @param $del_img
*/
*/
private
function
delOImg
(
$type
,
$del_img
){
private
function
delOImg
(
$type
,
$del_img
)
$oImgModel
=
new
OfficeOImg
();
{
$ids
=
rtrim
(
$del_img
,
","
);
$oImgModel
=
new
OfficeOImg
();
$where_
[
"id"
]
=
array
(
"in"
,
$ids
);
$ids
=
rtrim
(
$del_img
,
","
);
$where_
[
"img_type"
]
=
$type
;
$where_
[
"id"
]
=
array
(
"in"
,
$ids
);
$where_
[
"img_type"
]
=
$type
;
$params
[
"img_status"
]
=
1
;
$params
[
"img_status"
]
=
1
;
$oImgModel
->
updateImgs
(
$where_
,
$params
);
$oImgModel
->
updateImgs
(
$where_
,
$params
);
...
@@ -314,16 +316,16 @@ class OfficePayLogService
...
@@ -314,16 +316,16 @@ class OfficePayLogService
*/
*/
public
function
getRefundDetail
(
$refund_id
)
public
function
getRefundDetail
(
$refund_id
)
{
{
$field
=
"a.id,a.report_id,a.agent_id,a.agent_name,a.order_no,a.order_id,a.refund_money,a.status,a.name
$field
=
"a.id,a.report_id,a.agent_id,a.agent_name,a.order_no,a.order_id,a.refund_money,a.status,a.name
,a.phone,a.bank,a.card_no, a.remark,a.receipt_number,a.type,a.refund_cause,a.pay_log_id,a.refund_way,
,a.phone,a.bank,a.card_no, a.remark,a.receipt_number,a.type,a.refund_cause,a.pay_log_id,a.refund_way,
a.create_time,b.income_time"
;
a.create_time,b.income_time"
;
$params
[
"id"
]
=
$refund_id
;
$params
[
"id"
]
=
$refund_id
;
$params
[
"is_del"
]
=
0
;
$params
[
"is_del"
]
=
0
;
$result
=
$this
->
oRefundModel
->
selectRefundDetailByOrderNo
(
$field
,
$params
);
$result
=
$this
->
oRefundModel
->
selectRefundDetailByOrderNo
(
$field
,
$params
);
if
(
count
(
$result
)
>
0
)
{
if
(
count
(
$result
)
>
0
)
{
$item
=
$result
[
0
];
$item
=
$result
[
0
];
$item
[
"img_path"
]
=
CHAT_IMG_URL
;
$item
[
"img_path"
]
=
CHAT_IMG_URL
;
$item
[
"img_arr"
]
=
$this
->
getOImg
(
$item
[
"id"
],
3
);
$item
[
"img_arr"
]
=
$this
->
getOImg
(
$item
[
"id"
],
3
);
return
[
"code"
=>
200
,
"data"
=>
$item
];
return
[
"code"
=>
200
,
"data"
=>
$item
];
}
else
{
}
else
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到此条退款数据"
];
return
[
"code"
=>
101
,
"msg"
=>
"没有找到此条退款数据"
];
...
@@ -336,20 +338,21 @@ class OfficePayLogService
...
@@ -336,20 +338,21 @@ class OfficePayLogService
* @param $bargain_id
* @param $bargain_id
* @return bool|float|int
* @return bool|float|int
*/
*/
public
function
getPayLogRefundSurplusMoney
(
$bargain_id
)
{
public
function
getPayLogRefundSurplusMoney
(
$bargain_id
)
{
if
(
empty
(
$bargain_id
))
{
if
(
empty
(
$bargain_id
))
{
return
false
;
return
false
;
}
}
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
if
(
empty
(
$pay_id
))
{
if
(
empty
(
$pay_id
))
{
return
false
;
return
false
;
}
}
$money
=
$this
->
payLogModel
->
getSum
(
'money'
,
[
'id'
=>
[
'in'
,
$pay_id
]]);
$money
=
$this
->
payLogModel
->
getSum
(
'money'
,
[
'id'
=>
[
'in'
,
$pay_id
]]);
if
(
$money
>
0
)
{
if
(
$money
>
0
)
{
$refund_money
=
$this
->
oRefundModel
->
getRefundSum
(
'refund_money'
,
[
'pay_log_id'
=>
[
'in'
,
$pay_id
]]);
$refund_money
=
$this
->
oRefundModel
->
getRefundSum
(
'refund_money'
,
[
'pay_log_id'
=>
[
'in'
,
$pay_id
]]);
$result
=
$money
-
$refund_money
;
$result
=
$money
-
$refund_money
;
}
else
{
}
else
{
$result
=
0
;
$result
=
0
;
}
}
...
@@ -360,13 +363,14 @@ class OfficePayLogService
...
@@ -360,13 +363,14 @@ class OfficePayLogService
* @param $bargain_id
* @param $bargain_id
* @return bool
* @return bool
*/
*/
public
function
checkPayLogAdjustment
(
$bargain_id
)
{
public
function
checkPayLogAdjustment
(
$bargain_id
)
{
if
(
empty
(
$bargain_id
))
{
if
(
empty
(
$bargain_id
))
{
return
false
;
return
false
;
}
}
$result
=
false
;
$result
=
false
;
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
$id
=
$this
->
payLogAdjustmentModel
->
getFieldValue
(
'id'
,
[
'paylog_id'
=>
[
'in'
,
$pay_id
]]);
$id
=
$this
->
payLogAdjustmentModel
->
getFieldValue
(
'id'
,
[
'paylog_id'
=>
[
'in'
,
$pay_id
]]);
if
(
$id
>
0
)
{
if
(
$id
>
0
)
{
$result
=
true
;
$result
=
true
;
}
}
...
...
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