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
7aa8af94
Commit
7aa8af94
authored
Dec 13, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
a97dd824
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
10 deletions
+112
-10
OrderLog.php
application/api_broker/controller/OrderLog.php
+8
-3
OrderLogService.php
application/api_broker/service/OrderLogService.php
+11
-1
PayLogService.php
application/api_broker/service/PayLogService.php
+80
-6
OPayLogAdjustment.php
application/model/OPayLogAdjustment.php
+13
-0
No files found.
application/api_broker/controller/OrderLog.php
View file @
7aa8af94
...
...
@@ -204,7 +204,7 @@ class OrderLog extends Basic
if
(
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"agent_id"
])
||
!
isset
(
$params
[
"report_id"
])
||
!
isset
(
$params
[
"order_id"
])
||
!
isset
(
$params
[
"order_no"
])
|
!
isset
(
$params
[
"collecting_bill"
])
||
!
isset
(
$params
[
"house_number"
])
||
!
isset
(
$params
[
"industry_type"
])
||
!
isset
(
$params
[
"is_dividend"
])
)
{
!
isset
(
$params
[
"house_number"
])
||
!
isset
(
$params
[
"industry_type"
])
)
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
...
...
@@ -225,6 +225,7 @@ class OrderLog extends Basic
"transfer_img" => "12312312312",
"is_dividend" => 1, //是否分红 1否 0是
"last_transfer_time" => "2018-10-18", //最后转定时间
"pay_id" => 1,
);*/
...
...
@@ -233,12 +234,16 @@ class OrderLog extends Basic
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$transfer_img
=
isset
(
$params
[
"transfer_img"
])
?
json_decode
(
$params
[
"transfer_img"
]
,
true
)
:
""
;
$source
=
$params
[
"source"
]
?
$params
[
"source"
]
:
0
;
$income_time
=
isset
(
$params
[
"income_time"
])
?
$params
[
"income_time"
]
:
""
;
$pay_id
=
isset
(
$params
[
"pay_id"
])
?
$params
[
"pay_id"
]
:
0
;
$source
=
$params
[
"source"
]
?
$params
[
"source"
]
:
0
;
if
(
$pay_id
>
0
){
$source
=
2
;
}
$is_ok
=
$this
->
service_
->
addCollectingBill
(
$params
[
"agent_id"
],
$params
[
"agent_name"
],
$params
[
"report_id"
],
$params
[
"order_id"
],
$params
[
"order_no"
],
$params
[
"collecting_bill"
],
$params
[
"house_number"
],
$params
[
"industry_type"
],
$remark
,
$transfer_img
,
$source
,
$income_time
,
$params
[
"is_dividend"
],
$params
[
"last_transfer_time"
]);
$remark
,
$transfer_img
,
$source
,
$income_time
,
$params
[
"is_dividend"
],
$params
[
"last_transfer_time"
]
,
$pay_id
);
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[
"bill_id"
=>
$is_ok
]);
...
...
application/api_broker/service/OrderLogService.php
View file @
7aa8af94
...
...
@@ -8,6 +8,7 @@ use app\model\GHousesToAgents;
use
app\model\OBargainModel
;
use
app\model\OImg
;
use
app\model\OMarchInModel
;
use
app\model\OPayLogAdjustment
;
use
app\model\OPayLogModel
;
use
app\model\OrderModel
;
use
app\model\ORealIncome
;
...
...
@@ -111,15 +112,20 @@ class OrderLogService
* @throws \think\exception\DbException
*/
public
function
addCollectingBill
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
,
$is_dividend
,
$last_transfer_time
)
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
,
$is_dividend
,
$last_transfer_time
,
$pay_id
)
{
$bill_arr
=
$params
=
[];
$father_id
=
0
;
$money
=
0
;
$type
=
0
;
foreach
(
$collecting_bill
as
$collecting
)
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
if
(
!
$this
->
verifyType
(
$collecting
[
"type"
],
$collecting
[
"pay_type"
],
$last_transfer_time
)){
return
-
1
;
}
$money
=
$collecting
[
"money"
];
$type
=
$collecting
[
"type"
];
if
(
$father_id
==
0
)
{
$params
=
$this
->
collectingBillBin
(
$father_id
,
$collecting
,
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
,
$is_dividend
,
$last_transfer_time
);
...
...
@@ -134,6 +140,10 @@ class OrderLogService
//保存图片
$oImgModel
=
new
OImg
();
$oImgModel
->
addImgAll
(
$father_id
,
2
,
$transfer_img
);
if
(
$pay_id
>
0
){
$payLogService
=
new
PayLogService
();
$payLogService
->
addAdjustment
(
$father_id
,
$pay_id
,
$money
,
$type
,
$agent_id
);
}
$pushMarchIn
=
new
PushMessageService
();
$pushMarchIn
->
pushMarchInMessage
(
$params
[
"report_id"
],
2
,
$agent_id
);
//推送
...
...
application/api_broker/service/PayLogService.php
View file @
7aa8af94
...
...
@@ -19,7 +19,7 @@ class PayLogService
public
function
__construct
()
{
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
payLogAdjustmentModel
=
new
OPayLogAdjustment
();
}
...
...
@@ -34,23 +34,96 @@ class PayLogService
* @param $pay_id
* @return int
*/
public
function
adjustment
(
$pay_id
){
public
function
adjustment
(
$pay_id
)
{
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed
=
"id,money"
;
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
if
(
count
(
$pay_log_arr
)
<
0
)
{
return
-
1
;
if
(
count
(
$pay_log_arr
)
<
0
)
{
return
-
1
;
}
$pay_log_arr
=
$pay_log_arr
[
0
];
$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_
);
$residue_money
=
$pay_log_arr
[
"money"
]
-
$adjustment_sum
[
"money"
];
return
$residue_money
;
}
/**
* @param $new_pay_id
* @param $pay_id
* @param $money
* @param $type
* @param $agent_id
* @return int
*/
public
function
addAdjustment
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
)
{
$filed
=
"id,type"
;
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
if
(
count
(
$pay_log_arr
)
<
0
)
{
return
-
1
;
}
$oPayLogAdjustment
=
new
OPayLogAdjustment
();
$where_
=
$this
->
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$pay_log_arr
[
0
][
"type"
]);
$oPayLogAdjustment
->
addAdjustment
(
$where_
);
}
/**
* @param $new_pay_id
* @param $pay_id
* @param $money
* @param $type
* @param $agent_id
* @param $old_type
* @return mixed
*/
private
function
adjustmentBin
(
$new_pay_id
,
$pay_id
,
$money
,
$type
,
$agent_id
,
$old_type
)
{
$arr
[
"paylog_id"
]
=
$pay_id
;
$arr
[
"new_paylog_id"
]
=
$new_pay_id
;
$arr
[
"money"
]
=
$money
;
$val
=
0
;
if
(
$old_type
==
10
)
{
//意向金
switch
(
$type
)
{
case
10
:
$val
=
3
;
break
;
case
91
:
$val
=
1
;
break
;
case
92
:
$val
=
2
;
break
;
default
:
}
}
elseif
(
$old_type
==
30
)
{
//保管金
switch
(
$type
)
{
case
30
:
$val
=
6
;
break
;
case
91
:
$val
=
4
;
break
;
case
92
:
$val
=
5
;
break
;
default
:
}
}
$arr
[
"type"
]
=
$val
;
$arr
[
"operation_id"
]
=
$agent_id
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
}
\ No newline at end of file
application/model/OPayLogAdjustment.php
View file @
7aa8af94
...
...
@@ -56,4 +56,16 @@ class OPayLogAdjustment extends Model{
->
value
(
$field
);
}
public
function
addAdjustment
(
$params
){
Db
::
startTrans
();
try
{
$res
=
$this
->
insertGetId
(
$params
);
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
$res
=
0
;
}
return
$res
;
}
}
\ 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