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
78ddd270
Commit
78ddd270
authored
Jul 31, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
393c1a55
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
182 additions
and
38 deletions
+182
-38
PayLog.php
application/api_broker/controller/PayLog.php
+65
-10
Basic.php
application/api_broker/extend/Basic.php
+1
-1
PayLogService.php
application/api_broker/service/PayLogService.php
+89
-18
OPayLogModel.php
application/model/OPayLogModel.php
+17
-0
route.php
application/route.php
+10
-9
No files found.
application/api_broker/controller/PayLog.php
View file @
78ddd270
...
...
@@ -3,6 +3,7 @@
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\OrderLogService
;
use
app\api_broker\service\PayLogService
;
use
app\model\GHouses
;
use
app\model\OfficeOImg
;
...
...
@@ -116,7 +117,7 @@ class PayLog extends Basic
);*/
$refund_id
=
isset
(
$params
[
"refund_id"
])
?
$params
[
"refund_id"
]
:
0
;
if
(
$refund_id
==
0
&&
!
isset
(
$params
[
"remark_img"
]))
{
if
(
$refund_id
==
0
&&
!
isset
(
$params
[
"remark_img"
]))
{
return
$this
->
response
(
"101"
,
"请上传图片"
);
}
$agent_id
=
$params
[
"agent_id"
];
...
...
@@ -136,11 +137,11 @@ class PayLog extends Basic
$refund_way
=
$params
[
"refund_way"
];
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$remark_img
=
isset
(
$params
[
"remark_img"
])
?
json_decode
(
$params
[
"remark_img"
],
true
)
:
""
;
$del_img
=
isset
(
$params
[
"del_img"
])
?
$params
[
"del_img"
]
:
""
;
$del_img
=
isset
(
$params
[
"del_img"
])
?
$params
[
"del_img"
]
:
""
;
//todo 判断此单是否有付款
$is_ok
=
$this
->
service_
->
addRefund
(
$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
,
$remark_img
,
$refund_id
,
$del_img
);
,
$refund_id
,
$del_img
);
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[]);
}
elseif
(
$is_ok
==
-
2
)
{
...
...
@@ -158,21 +159,22 @@ class PayLog extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRefund
(){
public
function
getRefund
()
{
$params
=
$this
->
params
;
/* $params = array(
"refund_id" =>1
);*/
if
(
!
isset
(
$params
[
"refund_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
if
(
!
isset
(
$params
[
"refund_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
service_
->
getRefundDetail
(
$params
[
"refund_id"
]);
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"data"
]);
}
elseif
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"msg"
]);
if
(
$result
[
"code"
]
==
200
)
{
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"data"
]);
}
elseif
(
$result
[
"code"
]
==
101
)
{
return
$this
->
response
(
"101"
,
$result
[
"msg"
]);
}
}
...
...
@@ -227,4 +229,56 @@ class PayLog extends Basic
}
return
$this
->
response
(
"101"
,
$refund_data
);
}
/**我的收款记录列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getPayLogList
()
{
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 1,
"search_type" => 1,//1商铺编号,2商铺地址 3收款id,4带看id
"keyword" => "121",
"submit_time_start" => '123123123123',//时间戳
"submit_time_end" => '123123',
"type" => 10,//入账类型, 10.意向金 30.保管金 91.中介费 92.案场费
"source" => 0,//来源0app 1智能pos机 2调整
"is_open" => 0, //是否开业:0未开业 1开业
"is_all" => 0, //是否查看全部:0自己 1全部
"page_no" => 1,
"page_size" => 15
);*/
if
(
!
isset
(
$params
[
"agent_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$pageNo
=
empty
(
$params
[
'page_no'
])
?
1
:
$params
[
'page_no'
];
$pageSize
=
empty
(
$params
[
'page_size'
])
?
15
:
$params
[
'page_size'
];
$agentModel
=
new
AAgents
();
$agents_data
=
$agentModel
->
getAgentInfo
(
'id,level'
,
$this
->
agentId
);
$result
=
[];
$check_type
=
0
;
if
(
isset
(
$params
[
"is_all"
])
&&
$params
[
"is_all"
]
==
1
)
{
$check_type
=
1
;
if
(
$agents_data
[
"level"
]
<
30
)
{
$orderLogService
=
new
ReportService
();
$check_type
=
$orderLogService
->
getCheckType
(
$this
->
agentId
);
if
(
$check_type
==
0
)
{
return
$this
->
response
(
101
,
"暂无权限"
);
}
}
}
$field
=
"a.type,a.id,a.create_time,a.income_time,a.money,a.type_ext,a.bargain_id,a.is_open,a.source,a.agent_id,a.agent_name"
;
$result
=
$this
->
service_
->
getPayLogList
(
$field
,
$params
,
$pageNo
,
$pageSize
,
$check_type
);
if
(
count
(
$result
)
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
else
{
return
$this
->
response
(
"200"
,
"request null"
);
}
}
}
\ No newline at end of file
application/api_broker/extend/Basic.php
View file @
78ddd270
...
...
@@ -113,7 +113,7 @@ class Basic extends Controller
$requestPath
=
$this
->
request
->
routeInfo
()[
"rule"
][
0
]
.
"/"
.
$this
->
request
->
routeInfo
()[
"rule"
][
1
];
//过滤掉不需要验证token的接口
if
(
!
in_array
(
trim
(
$requestPath
),
$this
->
filterVerify
))
{
$this
->
tokenVerify
();
//
$this->tokenVerify();
//$this->userAuth(trim($requestPath));
}
unset
(
$this
->
params
[
"AuthToken"
]);
...
...
application/api_broker/service/PayLogService.php
View file @
78ddd270
...
...
@@ -39,7 +39,7 @@ class PayLogService
* @param $type
* @return int
*/
public
function
adjustment
(
$pay_id
,
$type
=
1
)
public
function
adjustment
(
$pay_id
,
$type
=
1
)
{
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed
=
"id,money"
;
...
...
@@ -55,7 +55,7 @@ class PayLogService
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
//减去退款
$refund_params
[
"pay_log_id"
]
=
$pay_id
;
if
(
$type
==
2
)
{
if
(
$type
==
2
)
{
//驳回退款 不会改变入账的状态,驳回退款是为了让店长重新编辑上传的东西。
$refund_params
[
"status"
]
=
array
(
"neq"
,
4
);
}
...
...
@@ -182,14 +182,14 @@ class PayLogService
//验证金额是否合法
$payLogService
=
new
PayLogService
();
$residue_money
=
$payLogService
->
adjustment
(
$pay_log_id
,
2
);
$residue_money
=
$payLogService
->
adjustment
(
$pay_log_id
,
2
);
if
(
$residue_money
<
$refund_money
)
{
return
-
2
;
}
$insert_id
=
0
;
$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
)
{
$insert_id
=
$this
->
oRefundModel
->
addRefund
(
$arr
);
}
else
{
...
...
@@ -200,8 +200,8 @@ class PayLogService
if
(
$insert_id
>
0
&&
$remark_img
)
{
$this
->
addOImg
(
$insert_id
,
3
,
$remark_img
);
}
if
(
$del_img
)
{
$this
->
delOImg
(
3
,
$del_img
);
if
(
$del_img
)
{
$this
->
delOImg
(
3
,
$del_img
);
}
$service_push
=
new
PushMessageService
();
...
...
@@ -230,11 +230,11 @@ class PayLogService
*/
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
,
$refund_way
,
$remark
,
$refund_id
)
$refund_way
,
$remark
,
$refund_id
)
{
if
(
$refund_id
>
0
)
{
//修改
if
(
$refund_id
>
0
)
{
//修改
$arr
[
"id"
]
=
$refund_id
;
}
else
{
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
$arr
[
"report_id"
]
=
$report_id
;
...
...
@@ -291,10 +291,11 @@ class PayLogService
* @param $type
* @param $del_img
*/
private
function
delOImg
(
$type
,
$del_img
){
private
function
delOImg
(
$type
,
$del_img
)
{
$oImgModel
=
new
OImg
();
$ids
=
rtrim
(
$del_img
,
","
);
$where_
[
"id"
]
=
array
(
"in"
,
$ids
);
$where_
[
"id"
]
=
array
(
"in"
,
$ids
);
$where_
[
"img_type"
]
=
$type
;
$params
[
"img_status"
]
=
1
;
...
...
@@ -333,19 +334,20 @@ class PayLogService
* @param $bargain_id
* @return bool|float|int
*/
public
function
getPayLogRefundSurplusMoney
(
$bargain_id
)
{
public
function
getPayLogRefundSurplusMoney
(
$bargain_id
)
{
if
(
empty
(
$bargain_id
))
{
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
))
{
return
false
;
}
$money
=
$this
->
payLogModel
->
getSum
(
'money'
,
[
'id'
=>
[
'in'
,
$pay_id
]]);
$money
=
$this
->
payLogModel
->
getSum
(
'money'
,
[
'id'
=>
[
'in'
,
$pay_id
]]);
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
;
}
else
{
$result
=
0
;
...
...
@@ -357,17 +359,85 @@ class PayLogService
* @param $bargain_id
* @return bool
*/
public
function
checkPayLogAdjustment
(
$bargain_id
)
{
public
function
checkPayLogAdjustment
(
$bargain_id
)
{
if
(
empty
(
$bargain_id
))
{
return
false
;
}
$result
=
false
;
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
$id
=
$this
->
payLogAdjustmentModel
->
getFieldValue
(
'id'
,
[
'paylog_id'
=>
[
'in'
,
$pay_id
]]);
$pay_id
=
$this
->
payLogModel
->
getFieldColumn
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
$id
=
$this
->
payLogAdjustmentModel
->
getFieldValue
(
'id'
,
[
'paylog_id'
=>
[
'in'
,
$pay_id
]]);
if
(
$id
>
0
)
{
$result
=
true
;
}
return
$result
;
}
/**
* 查询所有收款记录
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @param $check_type
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getPayLogList
(
$field
,
$params
,
$pageNo
,
$pageSize
,
$check_type
)
{
$conditions
=
[];
switch
(
$params
[
"search_type"
])
{
case
1
:
$conditions
[
"b.house_id"
]
=
trim
(
$params
[
"keyword"
]);
break
;
case
2
:
$conditions
[
"h.internal_title"
]
=
array
(
"like"
,
"%"
.
trim
(
$params
[
'keyword'
])
.
"%"
);
break
;
case
3
:
$conditions
[
"a.id"
]
=
trim
(
$params
[
"keyword"
]);
break
;
case
4
:
$conditions
[
"a.report_id"
]
=
trim
(
$params
[
"keyword"
]);
break
;
default
:
break
;
}
if
(
isset
(
$params
[
'submit_time_start'
])
&&
isset
(
$params
[
'submit_time_end'
]))
{
$start_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'submit_time_start'
]);
$end_time
=
date
(
'Y-m-d H:i:s'
,
$params
[
'submit_time_end'
]);
$conditions
[
'a.create_time'
]
=
array
(
'between'
,
array
(
$start_time
,
$end_time
));
}
if
(
isset
(
$params
[
'type'
]))
{
$conditions
[
"a.type"
]
=
$params
[
"type"
];
}
if
(
isset
(
$params
[
'source'
]))
{
$conditions
[
"a.source"
]
=
$params
[
"source"
];
}
if
(
isset
(
$params
[
'is_open'
]))
{
$conditions
[
"a.is_open"
]
=
$params
[
"is_open"
];
}
switch
(
$check_type
)
{
case
0
://
自己的
$conditions
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
break
;
case
1
://
公司
case
2
://
部门
和公司都可以看全部
break
;
case
3
://
门店
$vModel
=
new
VerifyService
();
$agentArr
=
$vModel
->
getAgentsByAgentIdAndType
(
$params
[
"agent_id"
],
$check_type
);
$conditions
[
"a.agent_id"
]
=
array
(
"in"
,
$agentArr
);
break
;
default
:
return
""
;
}
$result
=
$this
->
payLogModel
->
getPayLogList
(
$conditions
,
$field
,
$pageNo
,
$pageSize
);
foreach
(
$result
as
$item
){
}
}
}
\ No newline at end of file
application/model/OPayLogModel.php
View file @
78ddd270
...
...
@@ -631,5 +631,21 @@ class OPayLogModel extends Model
->
find
();
}
public
function
getPayLogList
(
$params
,
$field
,
$page_no
,
$page_size
)
{
$params
[
"a.is_del"
]
=
0
;
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_order b"
,
"a.order_id = b.id"
,
"left"
)
->
join
(
"g_houses h"
,
"b.house_id = h.id"
,
"left"
)
->
where
(
$params
)
->
limit
(
$page_size
)
->
page
(
$page_no
)
->
select
();
//echo $this->getLastSql();
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
78ddd270
...
...
@@ -552,16 +552,16 @@ Route::group('index', [
'getApplyForFeeStore'
=>
[
'index/StoreFee/getApplyForFeeStore'
,
[
'method'
=>
'GET'
]],
//获取费用承担办公室
'addFeeImage'
=>
[
'index/StoreFee/addFeeImage'
,
[
'method'
=>
'POST'
]],
//新增报销申请图片
'getStoreOffice'
=>
[
'index/Store/getStoreOffice'
,
[
'method'
=>
'GET'
]],
//获取费用承担办公室
'creationStoreFee'
=>
[
'index/StoreFee/creationStoreFee'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreFeeDetail'
=>
[
'index/StoreFee/getStoreFeeDetail'
,
[
'method'
=>
'POST|GET'
]
],
'creationStoreFee'
=>
[
'index/StoreFee/creationStoreFee'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreFeeDetail'
=>
[
'index/StoreFee/getStoreFeeDetail'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreCostParameterList'
=>
[
'index/CostParameter/getStoreCostParameterList'
,
[
'method'
=>
'POST|GET'
]
],
'editCostParameter'
=>
[
'index/CostParameter/editCostParameter'
,
[
'method'
=>
'POST|GET'
]
],
'checkCostParameter'
=>
[
'index/CostParameter/checkCostParameter'
,
[
'method'
=>
'POST'
]
],
//核对参数
'getCostParameter'
=>
[
'index/CostParameter/getCostParameter'
,
[
'method'
=>
'GET'
]
],
//核对记录
'getCompanyCostParameterList'
=>
[
'index/CostParameter/getCompanyCostParameterList'
,
[
'method'
=>
'POST|GET'
]
],
'editCompanyData'
=>
[
'index/CostParameter/editCompanyData'
,
[
'method'
=>
'POST|GET'
]
],
'editDiscounts'
=>
[
'index/CostParameter/editDiscounts'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreCostParameterList'
=>
[
'index/CostParameter/getStoreCostParameterList'
,
[
'method'
=>
'POST|GET'
]
],
'editCostParameter'
=>
[
'index/CostParameter/editCostParameter'
,
[
'method'
=>
'POST|GET'
]
],
'checkCostParameter'
=>
[
'index/CostParameter/checkCostParameter'
,
[
'method'
=>
'POST'
]
],
//核对参数
'getCostParameter'
=>
[
'index/CostParameter/getCostParameter'
,
[
'method'
=>
'GET'
]
],
//核对记录
'getCompanyCostParameterList'
=>
[
'index/CostParameter/getCompanyCostParameterList'
,
[
'method'
=>
'POST|GET'
]
],
'editCompanyData'
=>
[
'index/CostParameter/editCompanyData'
,
[
'method'
=>
'POST|GET'
]
],
'editDiscounts'
=>
[
'index/CostParameter/editDiscounts'
,
[
'method'
=>
'POST|GET'
]
],
]);
...
...
@@ -977,6 +977,7 @@ Route::group('broker', [
'getBeForNum'
=>
[
'api_broker/PayLog/getBeForNum'
,
[
'method'
=>
'get|post'
]],
'adjustment'
=>
[
'api_broker/PayLog/adjustment'
,
[
'method'
=>
'get|post'
]],
'getPayLogList'
=>
[
'api_broker/PayLog/getPayLogList'
,
[
'method'
=>
'get|post'
]],
//原生客户详情
'getUserLabels'
=>
[
'api_broker/User/getUserLabels'
,
[
'method'
=>
'get|post'
]],
//获取电话跟进标签列表
...
...
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