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
9938d83d
Commit
9938d83d
authored
May 21, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
eac73ff2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
140 deletions
+53
-140
OrderLog.php
application/api_broker/controller/OrderLog.php
+0
-105
OrderLogService.php
application/api_broker/service/OrderLogService.php
+53
-35
No files found.
application/api_broker/controller/OrderLog.php
View file @
9938d83d
...
...
@@ -45,53 +45,6 @@ class OrderLog extends Basic
$this
->
verifyService_
=
new
VerifyRepetitionService
();
}
/**
* 进场
* @return \think\Response
*/
public
function
marchIn
()
{
$params
=
$this
->
params
;
if
(
!
isset
(
$params
[
"march_in_area"
])
||
!
isset
(
$params
[
"report_id"
])
||
!
isset
(
$params
[
"reception_id"
])
||
!
isset
(
$params
[
"reception_name"
])
||
!
isset
(
$params
[
"order_id"
])
||
!
isset
(
$params
[
"order_no"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
/* $params = array(
"reception_id" => 10010,//带看经纪人id
"reception_name" => 1,//带看经纪人id
"report_id" => 1,//报备id
"order_id" => 1, //关联order表id
"order_no" => "123123123123123", //订单no
"march_in_remark" => "有意向购买", //进场备注
"march_in_img" => "123123", //备注图片
"march_in_area" => "上海市虹口区中山公园", //进场地址
);*/
// $params["reception_id"] = $this->agentName;
//todo 兼容2.9.9bug ios
if
(
isset
(
$params
[
"transfer_img"
]))
{
$transfer_img
=
json_decode
(
$params
[
"transfer_img"
],
true
);
$params
[
"march_in_img"
]
=
$transfer_img
[
0
];
unset
(
$params
[
"transfer_img"
]);
}
$is_execute
=
$this
->
verifyService_
->
verifyStart
(
1
,
$params
[
"reception_id"
],
$params
[
"order_id"
]);
if
(
!
$is_execute
)
{
return
$this
->
response
(
"101"
,
"请不要重复提交"
);
}
$is_ok
=
$this
->
o_march_in_model
->
addMarchIn
(
$params
);
if
(
$is_ok
>
0
)
{
$pushMarchIn
=
new
PushMessageService
();
$pushMarchIn
->
pushMarchInMessage
(
$params
[
"report_id"
],
1
,
$this
->
agentId
);
//推送
return
$this
->
response
(
"200"
,
"request success"
,
[]);
}
else
{
return
$this
->
response
(
"101"
,
"request faild"
);
}
}
/**
* @return \think\Response
* @throws Exception
...
...
@@ -143,8 +96,6 @@ class OrderLog extends Basic
}
else
{
return
$this
->
response
(
"101"
,
"request faild"
);
}
}
/**
...
...
@@ -166,62 +117,6 @@ class OrderLog extends Basic
}
}
/**
* 收款
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
collectingBillV2
()
{
$params
=
$this
->
params
;
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"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
/* $params = array(
"agent_id" => 1,//收款经纪人id
"agent_name" => 1,//收款经纪人id
"report_id" => 111,//报备id
"order_id" => 2, //关联order表id
"order_no" => "123123123", //订单no
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额 存分',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
"remark" => "没什么备注",
"transfer_img" => "12312312312"
);*/
$vip_services
=
new
VipService
();
if
(
$vip_services
->
vip
(
$params
[
'agent_id'
],
'broker/collectingBill'
))
{
return
$this
->
response
(
"101"
,
"没有权限"
);
}
$params
[
"collecting_bill"
]
=
json_decode
(
$params
[
"collecting_bill"
],
true
);
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$transfer_img
=
isset
(
$params
[
"transfer_img"
])
?
json_decode
(
$params
[
"transfer_img"
],
true
)
:
""
;
Log
::
record
(
"********************transfer_img**"
.
json_encode
(
$transfer_img
));
$source
=
isset
(
$params
[
"source"
])
?
$params
[
"source"
]
:
0
;
$income_time
=
isset
(
$params
[
"income_time"
])
?
$params
[
"income_time"
]
:
""
;
$received_money
=
isset
(
$params
[
"received_money"
])
?
$params
[
"received_money"
]
:
""
;
$type_ext
=
isset
(
$params
[
"type_ext"
])
?
$params
[
"type_ext"
]
:
""
;
$bargain_id
=
isset
(
$params
[
'bargain_id'
])
?
$params
[
'bargain_id'
]
:
0
;
$is_open
=
isset
(
$params
[
'is_open'
])
?
$params
[
'is_open'
]
:
-
1
;
$is_ok
=
$this
->
service_
->
addCollectingBillV2
(
$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
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
);
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[
"bill_id"
=>
$is_ok
]);
}
return
$this
->
response
(
"101"
,
"request faild"
);
}
/**
* 收款
* @return \think\Response
...
...
application/api_broker/service/OrderLogService.php
View file @
9938d83d
...
...
@@ -59,6 +59,8 @@ class OrderLogService
* @param $income_time
* @param $received_money
* @param $type_ext
* @param $bargain_id
* @param $is_open
* @return int|string
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
...
...
@@ -66,22 +68,25 @@ class OrderLogService
* @throws \think\exception\DbException
*/
public
function
addCollectingBillV2
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$collecting_bill
,
$house_number
,
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
)
$industry_type
,
$remark
,
$transfer_img
,
$source
,
$income_time
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
)
{
$bill_arr
=
$params
=
[];
$father_id
=
$pay_type
=
0
;
foreach
(
$collecting_bill
as
$collecting
)
{
if
(
isset
(
$collecting
[
"type"
])
&&
isset
(
$collecting
[
"pay_type"
])
&&
isset
(
$collecting
[
"money"
]))
{
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
,
0
,
0
,
$received_money
,
$type_ext
,
$bargain_id
);
$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
,
0
,
0
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
}
else
{
array_push
(
$bill_arr
,
$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
,
0
,
0
,
$received_money
,
$type_ext
,
$bargain_id
));
array_push
(
$bill_arr
,
$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
,
0
,
0
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
));
}
$this
->
updateBargainIsOpen
(
$bargain_id
,
$collecting
[
'type'
],
$is_open
);
//
$this->updateBargainIsOpen($bargain_id, $collecting['type'], $is_open);
$type
=
$collecting
[
'type'
];
}
}
...
...
@@ -122,6 +127,8 @@ class OrderLogService
* @param $transfer_name
* @param $received_money
* @param $type_ext
* @param $bargain_id
* @param $is_open
* @return int|string
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
...
...
@@ -130,7 +137,8 @@ class OrderLogService
*/
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
,
$pay_id
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
)
$last_transfer_time
,
$pay_id
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
)
{
$bill_arr
=
$params
=
[];
$father_id
=
0
;
...
...
@@ -152,14 +160,16 @@ class OrderLogService
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
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
);
$is_dividend
,
$last_transfer_time
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
);
$father_id
=
$this
->
payLogModel
->
insertPayLog
(
$params
);
}
else
{
array_push
(
$bill_arr
,
$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
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
));
$income_time
,
$is_dividend
,
$last_transfer_time
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
));
}
$this
->
updateBargainIsOpen
(
$bargain_id
,
$collecting
[
'type'
],
$is_open
);
//
$this->updateBargainIsOpen($bargain_id, $collecting['type'], $is_open);
}
}
if
(
$father_id
>
0
)
{
...
...
@@ -184,21 +194,22 @@ class OrderLogService
return
$father_id
;
}
public
function
verifyIsShowAdjustment
(
$pay_id
,
$agent_id
){
public
function
verifyIsShowAdjustment
(
$pay_id
,
$agent_id
)
{
$params
[
"id"
]
=
$pay_id
;
$pay_log_info
=
$this
->
payLogModel
->
getPayLogByOrderId
(
"a.id,a.agent_id,c.store_id"
,
$params
);
if
(
count
(
$pay_log_info
)
<=
0
)
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到相对应的收款信息"
];
$pay_log_info
=
$this
->
payLogModel
->
getPayLogByOrderId
(
"a.id,a.agent_id,c.store_id"
,
$params
);
if
(
count
(
$pay_log_info
)
<=
0
)
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到相对应的收款信息"
];
}
$agentModel
=
new
AAgents
();
$agent_info
=
$agentModel
->
getAgentById
(
"id,store_id"
,
[
"id"
=>
$agent_id
]);
if
(
count
(
$agent_info
)
<=
0
)
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到相对应的经纪人信息"
];
$agent_info
=
$agentModel
->
getAgentById
(
"id,store_id"
,
[
"id"
=>
$agent_id
]);
if
(
count
(
$agent_info
)
<=
0
)
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到相对应的经纪人信息"
];
}
if
(
$pay_log_info
[
0
][
"store_id"
]
!=
$agent_info
[
0
][
"store_id"
])
{
return
[
"code"
=>
200
,
"is_show"
=>
false
];
}
else
{
return
[
"code"
=>
200
,
"is_show"
=>
true
];
if
(
$pay_log_info
[
0
][
"store_id"
]
!=
$agent_info
[
0
][
"store_id"
])
{
return
[
"code"
=>
200
,
"is_show"
=>
false
];
}
else
{
return
[
"code"
=>
200
,
"is_show"
=>
true
];
}
}
...
...
@@ -319,11 +330,13 @@ class OrderLogService
* @param $received_money
* @param $type_ext
* @param $bargain_id
* @param $is_open
* @return mixed
*/
private
function
collectingBillBin
(
$father_id
,
$collecting_arr
,
$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
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
)
$income_time
,
$is_dividend
,
$last_transfer_time
,
$receipt_number
,
$transfer_name
,
$received_money
,
$type_ext
,
$bargain_id
,
$is_open
)
{
$arr
[
"report_id"
]
=
$report_id
;
...
...
@@ -348,13 +361,16 @@ class OrderLogService
$arr
[
"received_money"
]
=
$received_money
;
$arr
[
"type_ext"
]
=
$type_ext
;
$arr
[
"bargain_id"
]
=
$bargain_id
;
$arr
[
"is_open"
]
=
$is_open
;
if
(
$income_time
)
{
$arr
[
"income_time"
]
=
date
(
"Y-m-d H:i:s"
,
$income_time
);
}
if
(
$last_transfer_time
)
{
$arr
[
"last_transfer_time"
]
=
date
(
"Y-m-d H:i:s"
,
$last_transfer_time
);
}
if
(
$is_open
&&
$is_open
==
1
)
{
$arr
[
"open_time"
]
=
date
(
"Y-m-d H:i:s"
,
$last_transfer_time
);
}
return
$arr
;
}
...
...
@@ -662,7 +678,7 @@ class OrderLogService
$field_refund
=
"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.create_time,b.income_time"
;
$refundData
=
$oRefundModel
->
selectRefundDetailByOrderNo
(
$field_refund
,
[
"order_id"
=>
$order_id
,
'del'
=>
0
]);
$refundData
=
$oRefundModel
->
selectRefundDetailByOrderNo
(
$field_refund
,
[
"order_id"
=>
$order_id
,
'del'
=>
0
]);
if
(
count
(
$refundData
)
>
0
)
{
foreach
(
$refundData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"refund"
;
...
...
@@ -675,7 +691,7 @@ class OrderLogService
//成交报告
$field_bargain
=
"a.id,a.father_id,a.house_number,a.is_open,a.report_id,a.order_id,a.trade_type,a.submit_agent_id,a.industry_type,
a.estimated_receipt_date,a.submit_agent_name, a.price,a.commission,a.role,a.agent_id,a.scale,a.scale_fee,a.create_time,b.name,b.phone,a.is_commission"
;
$bargainData
=
$oBargainModel
->
selectBargainListByOrderNo
(
$field_bargain
,
[
"order_id"
=>
$order_id
,
'status'
=>
[
'<>'
,
30
]]);
$bargainData
=
$oBargainModel
->
selectBargainListByOrderNo
(
$field_bargain
,
[
"order_id"
=>
$order_id
,
'status'
=>
[
'<>'
,
30
]]);
if
(
count
(
$bargainData
)
>
0
)
{
$bargain_data_arr
=
$this
->
arr2TreeBargain
(
$bargainData
);
foreach
(
$bargain_data_arr
as
$k2
=>
$v2
)
{
...
...
@@ -685,7 +701,7 @@ class OrderLogService
}
//调整
$field_adjustment
=
"a.id,a.paylog_id,a.new_paylog_id,d.order_id,a.type,a.money,a.create_time,a.update_time,c.name"
;
$adjustmentData
=
$oPayLogAdjustmentModel
->
getAdjustmentListByOrderId
(
$field_adjustment
,
[
"order_id"
=>
$order_id
,
'is_del'
=>
0
]);
$adjustmentData
=
$oPayLogAdjustmentModel
->
getAdjustmentListByOrderId
(
$field_adjustment
,
[
"order_id"
=>
$order_id
,
'is_del'
=>
0
]);
if
(
count
(
$adjustmentData
)
>
0
)
{
foreach
(
$adjustmentData
as
$k2
=>
$v2
)
{
$v2
[
"step_name"
]
=
"adjustment"
;
...
...
@@ -997,7 +1013,7 @@ class OrderLogService
//客户c端提交预约看铺
$field_appoint
=
"a.id,a.create_time,b.user_name as name"
;
$appointData
=
$appointWatchShopModel
->
getAppointWatchOur
(
1
,
15
,
"a.id desc"
,
$field_appoint
,[
"a.user_id"
=>
$user_id
]);
$appointData
=
$appointWatchShopModel
->
getAppointWatchOur
(
1
,
15
,
"a.id desc"
,
$field_appoint
,
[
"a.user_id"
=>
$user_id
]);
if
(
count
(
$appointData
)
>
0
)
{
foreach
(
$appointData
as
$k
=>
$v
)
{
$v
[
"step_name"
]
=
"appoint"
;
...
...
@@ -1011,7 +1027,7 @@ class OrderLogService
$reportData
=
$oReportModel
->
selectReportByUserId
(
$field_report
,
[
"user_id"
=>
$user_id
]);
if
(
count
(
$appointData
)
>
0
&&
count
(
$reportData
)
<=
0
)
{
return
$this
->
sortByTime
(
$result
);
}
elseif
(
count
(
$appointData
)
<=
0
&&
count
(
$reportData
)
<=
0
)
{
}
elseif
(
count
(
$appointData
)
<=
0
&&
count
(
$reportData
)
<=
0
)
{
return
[];
}
...
...
@@ -1430,7 +1446,7 @@ class OrderLogService
$bargainModel
=
new
OBargainModel
();
$filed
=
"a.id,a.father_id,a.price,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address,c.order_no,a.report_id"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
1
,
15
);
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
1
,
15
);
$list
=
[];
foreach
(
$result
as
$k
=>
$v
)
{
$father_id
=
$v
[
"father_id"
];
...
...
@@ -1785,10 +1801,11 @@ class OrderLogService
return
$this
->
payLogModel
->
updatePayLog
(
$params
);
}
public
function
getCommission
(
$bargain_id
){
public
function
getCommission
(
$bargain_id
)
{
$filed
=
"a.role,a.agent_id,b.name,a.scale"
;
$params
[
"a.id|a.father_id"
]
=
$bargain_id
;
$params
[
"a.role"
]
=
array
(
"in"
,
"3,4,5"
);
$params
[
"a.role"
]
=
array
(
"in"
,
"3,4,5"
);
return
$this
->
bargainModel
->
agentBargainAll
(
$filed
,
$params
);
}
...
...
@@ -1801,16 +1818,17 @@ class OrderLogService
* @param $is_open
* @return bool|int
*/
public
function
updateBargainIsOpen
(
$bargain_id
,
$type
,
$is_open
)
{
if
(
empty
(
$bargain_id
)
||
!
in_array
(
$type
,
[
91
,
92
]))
{
public
function
updateBargainIsOpen
(
$bargain_id
,
$type
,
$is_open
)
{
if
(
empty
(
$bargain_id
)
||
!
in_array
(
$type
,
[
91
,
92
]))
{
return
false
;
}
if
(
!
in_array
(
$is_open
,
[
0
,
1
]))
{
if
(
!
in_array
(
$is_open
,
[
0
,
1
]))
{
return
false
;
}
$num
=
$this
->
bargainModel
->
updateBargainById
(
$bargain_id
,
[
'is_open'
=>
$is_open
]);
$num
=
$this
->
bargainModel
->
updateBargainById
(
$bargain_id
,
[
'is_open'
=>
$is_open
]);
if
(
$num
)
{
$result
=
1
;
}
else
{
...
...
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