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
962f34f5
Commit
962f34f5
authored
Jun 06, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
31daa520
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
314 additions
and
0 deletions
+314
-0
OfficeBargain.php
application/api_broker/controller/OfficeBargain.php
+155
-0
OfficeBargainService.php
application/api_broker/service/OfficeBargainService.php
+155
-0
route.php
application/route.php
+4
-0
No files found.
application/api_broker/controller/OfficeBargain.php
0 → 100644
View file @
962f34f5
<?php
namespace
app\api_broker\controller
;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\BargainService
;
use
app\api_broker\service\OfficeBargainService
;
use
app\model\AAgents
;
use
think\Log
;
use
think\Request
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/23
* Time : 14:39
* Intro:
*/
class
Bargain
extends
Basic
{
private
$service_
;
private
$agentModel
;
public
function
__construct
(
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
service_
=
new
OfficeBargainService
();
$this
->
agentModel
=
new
AAgents
();
}
public
function
bargainList
()
{
$params
=
$this
->
params
;
/* $params = array(
"submit_agent_id" => 93,
"status" => 1,//0全部 1未结单 2已结单 3 撤销审核 4已撤销
"is_my_correlation" => 1, //是否与我相关 0全部 1与我相关
// "keyword" => "17717536291",
"page_no" => 1,
"page_size" => 10,
"bargain_id" =>10
);*/
$checkResult
=
$this
->
validate
(
$params
,
"BargainValidate.bargainList"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"10111"
,
$checkResult
);
}
$pageNo
=
empty
(
$params
[
"page_no"
])
?
1
:
$params
[
"page_no"
];
$pageSize
=
empty
(
$params
[
"page_size"
])
?
15
:
$params
[
"page_size"
];
$submit_agent_id
=
$params
[
"submit_agent_id"
];
$status
=
$params
[
"status"
];
$is_my_correlation
=
$params
[
"is_my_correlation"
];
$keyword
=
empty
(
$params
[
"keyword"
])
?
""
:
$params
[
"keyword"
];
$bargain_id
=
empty
(
$params
[
'bargain_id'
])
?
''
:
$params
[
'bargain_id'
];
/*业务员不允许点击查看全部成交报告 start*/
$agent_field
=
"a.level"
;
$agent_res
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$agent_field
,
[
"agent_id"
=>
$submit_agent_id
]);
if
((
$agent_res
[
0
][
'level'
]
==
10
)
&&
(
$is_my_correlation
==
0
))
{
return
$this
->
response
(
"101"
,
"暂无权限!"
);
}
/*业务员不允许点击查看全部成交报告 end*/
$result
=
$this
->
service_
->
getBargainList
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
public
function
bargainListV2
()
{
$params
=
$this
->
params
;
/* $params = array(
"submit_agent_id" => 93,
"status" => 1,//0全部 1未结单 2已结单 3 撤销审核 4已撤销
"is_my_correlation" => 1, //是否与我相关 0全部 1与我相关
// "keyword" => "17717536291",
"page_no" => 1,
"page_size" => 10,
"bargain_id" =>10
);*/
$checkResult
=
$this
->
validate
(
$params
,
"BargainValidate.bargainList"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"10111"
,
$checkResult
);
}
$pageNo
=
empty
(
$params
[
"page_no"
])
?
1
:
$params
[
"page_no"
];
$pageSize
=
empty
(
$params
[
"page_size"
])
?
15
:
$params
[
"page_size"
];
$submit_agent_id
=
$params
[
"submit_agent_id"
];
$status
=
$params
[
"status"
];
$is_my_correlation
=
$params
[
"is_my_correlation"
];
$keyword
=
empty
(
$params
[
"keyword"
])
?
""
:
$params
[
"keyword"
];
$bargain_id
=
empty
(
$params
[
'bargain_id'
])
?
''
:
$params
[
'bargain_id'
];
/*业务员不允许点击查看全部成交报告 start*/
$agent_field
=
"a.level"
;
$agent_res
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$agent_field
,
[
"agent_id"
=>
$submit_agent_id
]);
if
((
$agent_res
[
0
][
'level'
]
==
10
)
&&
(
$is_my_correlation
==
0
))
{
return
$this
->
response
(
"101"
,
"暂无权限!"
);
}
/*业务员不允许点击查看全部成交报告 end*/
$result
=
$this
->
service_
->
getBargainList
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
/**
* 调整 搜索成交报告id
* @return \think\Response
*/
public
function
bargainListSearchBargainId
()
{
$params
=
$this
->
params
;
/*
AuthToken:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7ImlkIjo1Nzc1LCJuYW1lIjoiXHU2ZDRiXHU4YmQ1MiIsInBob25lIjoiMTU2MDE2NTIzNTIiLCJsZXZlbCI6MjB9LCJ0aW1lU3RhbXBfIjoxNTU2MDc0NjY1fQ.EmHCH_QtMdymkAbYSLBGJ6q2-DUtrcv0ngXBDAKlMU4
is_my_correlation:0
keyword:288
page_no:1
page_size:15
status:5
submit_agent_id:5775
type:3
*/
$checkResult
=
$this
->
validate
(
$params
,
"BargainValidate.bargainList"
);
if
(
true
!==
$checkResult
)
{
return
$this
->
response
(
"10111"
,
$checkResult
);
}
$pageNo
=
empty
(
$params
[
"page_no"
])
?
1
:
$params
[
"page_no"
];
$pageSize
=
empty
(
$params
[
"page_size"
])
?
15
:
$params
[
"page_size"
];
$submit_agent_id
=
$params
[
"submit_agent_id"
];
$status
=
$params
[
"status"
];
$is_my_correlation
=
$params
[
"is_my_correlation"
];
$keyword
=
empty
(
$params
[
"keyword"
])
?
""
:
$params
[
"keyword"
];
$bargain_id
=
empty
(
$params
[
'bargain_id'
])
?
''
:
$params
[
'bargain_id'
];
$type
=
empty
(
$params
[
'type'
])
?
''
:
$params
[
'type'
];
/*业务员不允许点击查看全部成交报告 start
$agent_field = "a.level";
$agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $submit_agent_id ]);
if(($agent_res[0]['level'] == 10) && ($is_my_correlation == 0)){
return $this->response("101", "暂无权限!");
}
业务员不允许点击查看全部成交报告 end*/
$result
=
$this
->
service_
->
getBargainListV2
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
,
$type
);
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
}
\ No newline at end of file
application/api_broker/service/OfficeBargainService.php
0 → 100644
View file @
962f34f5
<?php
namespace
app\api_broker\service
;
use
app\model\OfficeOBargainModel
;
use
think\Log
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/8/23
* Time : 14:45
* Intro:
*/
class
OfficeBargainService
{
/**
* 获取成交报告列表
* @param $pageNo
* @param $pageSize
* @param $submit_agent_id
* @param $status
* @param $is_my_correlation
* @param $keyword
* @return array|false|\PDOStatement|string|\think\Collection
*/
public
function
getBargainList
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
)
{
$condition
=
[];
if
(
$is_my_correlation
==
1
)
{
$aService
=
new
VerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$condition
[
"ids"
]
=
$ids
;
}
else
{
$condition
[
"father_id"
]
=
0
;
}
switch
(
$status
)
{
case
1
:
$condition
[
"account_statement"
]
=
0
;
break
;
case
2
:
$condition
[
"account_statement"
]
=
1
;
break
;
case
3
:
$condition
[
"status"
]
=
20
;
break
;
case
4
:
$condition
[
"status"
]
=
21
;
break
;
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
break
;
default
:
}
if
(
!
empty
(
$keyword
))
{
$condition
[
"keyword"
]
=
$keyword
;
}
if
(
!
empty
(
$bargain_id
))
{
$condition
[
"id"
]
=
$bargain_id
;
}
$bargainModel
=
new
OfficeOBargainModel
();
$filed
=
"a.id,a.father_id,a.house_number,a.price,a.commission,a.agent_id,a.create_time,b.user_phone,
b.user_name,b.user_id,c.id as order_id,c.order_no,d.id as house_id,d.internal_title,d.internal_address,b.id as report_id"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$condition
,
$pageNo
,
$pageSize
);
$convertResult
[
"total"
]
=
count
(
$result
);
$convertResult
[
"result"
]
=
$this
->
convert
(
$is_my_correlation
,
$result
);
return
$convertResult
;
}
public
function
getBargainListV2
(
$pageNo
,
$pageSize
,
$submit_agent_id
,
$status
,
$is_my_correlation
,
$keyword
,
$bargain_id
,
$type
)
{
$condition
=
[];
if
(
$is_my_correlation
==
1
)
{
$aService
=
new
VerifyService
();
$ids
=
$aService
->
getAgentsByAgentId
(
$submit_agent_id
);
$condition
[
"ids"
]
=
$ids
;
}
else
{
$condition
[
"father_id"
]
=
0
;
}
switch
(
$status
)
{
case
1
:
$condition
[
"account_statement"
]
=
0
;
break
;
case
2
:
$condition
[
"account_statement"
]
=
1
;
break
;
case
3
:
$condition
[
"status"
]
=
20
;
break
;
case
4
:
$condition
[
"status"
]
=
21
;
break
;
case
5
://
调账
->
搜成交报告
不包括
待撤销和已撤销
$condition
[
"status"
]
=
array
(
'not in'
,
'20,21'
);
break
;
default
:
}
if
(
!
empty
(
$keyword
))
{
$condition
[
"keyword"
]
=
$keyword
;
}
if
(
!
empty
(
$bargain_id
))
{
$condition
[
"id"
]
=
$bargain_id
;
}
if
(
!
empty
(
$type
))
{
$condition
[
"type"
]
=
$type
;
}
$bargainModel
=
new
OfficeOBargainModel
();
$filed
=
"a.id,a.father_id,a.house_number,a.price,a.commission,a.agent_id,a.create_time,b.user_phone,
b.user_name,b.user_id,c.id as order_id,c.order_no,d.id as house_id,d.internal_title,d.internal_address,b.id as report_id"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$condition
,
$pageNo
,
$pageSize
);
$convertResult
[
"total"
]
=
count
(
$result
);
$convertResult
[
"result"
]
=
$this
->
convert
(
$is_my_correlation
,
$result
);
return
$convertResult
;
}
private
function
convert
(
$is_my_correlation
,
$result
)
{
$sortResult
=
[];
if
(
$is_my_correlation
==
1
)
{
$list
=
[];
foreach
(
$result
as
$k
=>
$v
)
{
$father_id
=
$v
[
"father_id"
]
==
0
?
$v
[
"id"
]
:
$v
[
"father_id"
];
if
(
$father_id
>
0
&&
in_array
(
$father_id
,
$list
))
{
unset
(
$result
[
$k
]);
}
else
{
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
$result
[
$k
][
"id"
]
=
$v
[
"father_id"
]
==
0
?
$v
[
"id"
]
:
$v
[
"father_id"
];
array_push
(
$list
,
$father_id
);
}
}
foreach
(
$result
as
$k
=>
$v
)
{
$sortResult
[]
=
$v
;
}
}
else
{
$sortResult
=
$result
;
}
return
$sortResult
;
}
}
\ No newline at end of file
application/route.php
View file @
962f34f5
...
...
@@ -998,6 +998,10 @@ Route::group('office', [
'adjustment'
=>
[
'api_broker/OfficePayLog/adjustment'
,
[
'method'
=>
'get|post'
]],
'refund'
=>
[
'api_broker/OfficePayLog/refund'
,
[
'method'
=>
'get|post'
]],
'getRefund'
=>
[
'api_broker/OfficePayLog/getRefund'
,
[
'method'
=>
'get|post'
]],
'bargainListSearchBargainId'
=>
[
'api_broker/OfficeBargain/bargainListSearchBargainId'
,
[
'method'
=>
'POST|GET'
]],
'bargainMain'
=>
[
'api_broker/OfficeBargain/bargainList'
,
[
'method'
=>
'POST|GET'
]],
'bargainMainV2'
=>
[
'api_broker/OfficeBargain/bargainListV2'
,
[
'method'
=>
'POST|GET'
]],
]);
Route
::
group
(
'office_index'
,
[
...
...
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